@huggingface/inference 2.6.3 → 2.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -190,7 +190,7 @@ await hf.imageToText({
190
190
  })
191
191
 
192
192
  await hf.imageToImage({
193
- inputs: readFileSync("test/stormtrooper_depth.png"),
193
+ inputs: new Blob([readFileSync("test/stormtrooper_depth.png")]),
194
194
  parameters: {
195
195
  prompt: "elmo's lecture",
196
196
  },
package/dist/index.d.ts CHANGED
@@ -24,6 +24,10 @@ export interface Options {
24
24
  * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers.
25
25
  */
26
26
  fetch?: typeof fetch;
27
+ /**
28
+ * Abort Controller signal to use for request interruption.
29
+ */
30
+ signal?: AbortSignal;
27
31
 
28
32
  /**
29
33
  * (Default: "same-origin"). String | Boolean. Credentials to use for the request. If this is a string, it will be passed straight on. If it's a boolean, true will be "include" and false will not send credentials at all.
@@ -786,6 +790,10 @@ export type TextGenerationArgs = BaseArgs & {
786
790
  * (Default: None). Integer. The maximum number of tokens from the input.
787
791
  */
788
792
  truncate?: number;
793
+ /**
794
+ * (Default: []) List of strings. The model will stop generating text when one of the strings in the list is generated.
795
+ * **/
796
+ stop_sequences?: string[];
789
797
  };
790
798
  };
791
799
  export interface TextGenerationOutput {
package/dist/index.js CHANGED
@@ -192,7 +192,8 @@ async function makeRequestOptions(args, options) {
192
192
  ...otherArgs,
193
193
  options: options && otherOptions
194
194
  }),
195
- credentials
195
+ credentials,
196
+ signal: options?.signal
196
197
  };
197
198
  return { url, info };
198
199
  }
package/dist/index.mjs CHANGED
@@ -140,7 +140,8 @@ async function makeRequestOptions(args, options) {
140
140
  ...otherArgs,
141
141
  options: options && otherOptions
142
142
  }),
143
- credentials
143
+ credentials,
144
+ signal: options?.signal
144
145
  };
145
146
  return { url, info };
146
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huggingface/inference",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
4
4
  "packageManager": "pnpm@8.3.1",
5
5
  "license": "MIT",
6
6
  "author": "Tim Mikeladze <tim.mikeladze@gmail.com>",
@@ -106,6 +106,7 @@ export async function makeRequestOptions(
106
106
  options: options && otherOptions,
107
107
  }),
108
108
  credentials,
109
+ signal: options?.signal,
109
110
  };
110
111
 
111
112
  return { url, info };
@@ -48,6 +48,10 @@ export type TextGenerationArgs = BaseArgs & {
48
48
  * (Default: None). Integer. The maximum number of tokens from the input.
49
49
  */
50
50
  truncate?: number;
51
+ /**
52
+ * (Default: []) List of strings. The model will stop generating text when one of the strings in the list is generated.
53
+ * **/
54
+ stop_sequences?: string[];
51
55
  };
52
56
  };
53
57
 
package/src/types.ts CHANGED
@@ -24,6 +24,10 @@ export interface Options {
24
24
  * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers.
25
25
  */
26
26
  fetch?: typeof fetch;
27
+ /**
28
+ * Abort Controller signal to use for request interruption.
29
+ */
30
+ signal?: AbortSignal;
27
31
 
28
32
  /**
29
33
  * (Default: "same-origin"). String | Boolean. Credentials to use for the request. If this is a string, it will be passed straight on. If it's a boolean, true will be "include" and false will not send credentials at all.