@huggingface/inference 2.1.1 → 2.1.2

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/dist/index.js CHANGED
@@ -116,7 +116,7 @@ function makeRequestOptions(args, options) {
116
116
  // src/tasks/custom/request.ts
117
117
  async function request(args, options) {
118
118
  const { url, info } = makeRequestOptions(args, options);
119
- const response = await (options?.custom_fetch ?? fetch)(url, info);
119
+ const response = await (options?.fetch ?? fetch)(url, info);
120
120
  if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) {
121
121
  return request(args, {
122
122
  ...options,
@@ -240,7 +240,7 @@ function newMessage() {
240
240
  // src/tasks/custom/streamingRequest.ts
241
241
  async function* streamingRequest(args, options) {
242
242
  const { url, info } = makeRequestOptions({ ...args, stream: true }, options);
243
- const response = await (options?.custom_fetch ?? fetch)(url, info);
243
+ const response = await (options?.fetch ?? fetch)(url, info);
244
244
  if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) {
245
245
  return streamingRequest(args, {
246
246
  ...options,
package/dist/index.mjs CHANGED
@@ -71,7 +71,7 @@ function makeRequestOptions(args, options) {
71
71
  // src/tasks/custom/request.ts
72
72
  async function request(args, options) {
73
73
  const { url, info } = makeRequestOptions(args, options);
74
- const response = await (options?.custom_fetch ?? fetch)(url, info);
74
+ const response = await (options?.fetch ?? fetch)(url, info);
75
75
  if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) {
76
76
  return request(args, {
77
77
  ...options,
@@ -195,7 +195,7 @@ function newMessage() {
195
195
  // src/tasks/custom/streamingRequest.ts
196
196
  async function* streamingRequest(args, options) {
197
197
  const { url, info } = makeRequestOptions({ ...args, stream: true }, options);
198
- const response = await (options?.custom_fetch ?? fetch)(url, info);
198
+ const response = await (options?.fetch ?? fetch)(url, info);
199
199
  if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) {
200
200
  return streamingRequest(args, {
201
201
  ...options,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huggingface/inference",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "license": "MIT",
5
5
  "author": "Tim Mikeladze <tim.mikeladze@gmail.com>",
6
6
  "description": "Typescript wrapper for the Hugging Face Inference API",
@@ -12,7 +12,7 @@ export async function request<T>(
12
12
  }
13
13
  ): Promise<T> {
14
14
  const { url, info } = makeRequestOptions(args, options);
15
- const response = await (options?.custom_fetch ?? fetch)(url, info);
15
+ const response = await (options?.fetch ?? fetch)(url, info);
16
16
 
17
17
  if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) {
18
18
  return request(args, {
@@ -14,7 +14,7 @@ export async function* streamingRequest<T>(
14
14
  }
15
15
  ): AsyncGenerator<T> {
16
16
  const { url, info } = makeRequestOptions({ ...args, stream: true }, options);
17
- const response = await (options?.custom_fetch ?? fetch)(url, info);
17
+ const response = await (options?.fetch ?? fetch)(url, info);
18
18
 
19
19
  if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) {
20
20
  return streamingRequest(args, {
package/src/types.ts CHANGED
@@ -23,7 +23,7 @@ export interface Options {
23
23
  /**
24
24
  * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers.
25
25
  */
26
- custom_fetch?: typeof fetch;
26
+ fetch?: typeof fetch;
27
27
  }
28
28
 
29
29
  export interface BaseArgs {