@huggingface/inference 4.3.2 → 4.5.0

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.
Files changed (81) hide show
  1. package/dist/commonjs/index.d.ts +1 -0
  2. package/dist/commonjs/index.d.ts.map +1 -1
  3. package/dist/commonjs/index.js +3 -1
  4. package/dist/commonjs/lib/getInferenceProviderMapping.d.ts.map +1 -1
  5. package/dist/commonjs/lib/getInferenceProviderMapping.js +6 -3
  6. package/dist/commonjs/lib/getProviderHelper.d.ts.map +1 -1
  7. package/dist/commonjs/lib/getProviderHelper.js +1 -0
  8. package/dist/commonjs/lib/logger.d.ts +4 -0
  9. package/dist/commonjs/lib/logger.d.ts.map +1 -0
  10. package/dist/commonjs/lib/logger.js +11 -0
  11. package/dist/commonjs/package.d.ts +1 -1
  12. package/dist/commonjs/package.js +1 -1
  13. package/dist/commonjs/providers/black-forest-labs.d.ts.map +1 -1
  14. package/dist/commonjs/providers/black-forest-labs.js +3 -1
  15. package/dist/commonjs/providers/fal-ai.d.ts +11 -2
  16. package/dist/commonjs/providers/fal-ai.d.ts.map +1 -1
  17. package/dist/commonjs/providers/fal-ai.js +64 -1
  18. package/dist/commonjs/providers/hf-inference.d.ts +6 -3
  19. package/dist/commonjs/providers/hf-inference.d.ts.map +1 -1
  20. package/dist/commonjs/providers/hf-inference.js +32 -7
  21. package/dist/commonjs/providers/providerHelper.d.ts +2 -0
  22. package/dist/commonjs/providers/providerHelper.d.ts.map +1 -1
  23. package/dist/commonjs/snippets/getInferenceSnippets.d.ts.map +1 -1
  24. package/dist/commonjs/snippets/getInferenceSnippets.js +4 -4
  25. package/dist/commonjs/tasks/custom/request.d.ts.map +1 -1
  26. package/dist/commonjs/tasks/custom/request.js +3 -1
  27. package/dist/commonjs/tasks/custom/streamingRequest.d.ts.map +1 -1
  28. package/dist/commonjs/tasks/custom/streamingRequest.js +3 -1
  29. package/dist/commonjs/tasks/cv/imageSegmentation.d.ts +1 -2
  30. package/dist/commonjs/tasks/cv/imageSegmentation.d.ts.map +1 -1
  31. package/dist/commonjs/tasks/cv/imageSegmentation.js +4 -3
  32. package/dist/commonjs/types.d.ts +7 -0
  33. package/dist/commonjs/types.d.ts.map +1 -1
  34. package/dist/esm/index.d.ts +1 -0
  35. package/dist/esm/index.d.ts.map +1 -1
  36. package/dist/esm/index.js +1 -0
  37. package/dist/esm/lib/getInferenceProviderMapping.d.ts.map +1 -1
  38. package/dist/esm/lib/getInferenceProviderMapping.js +6 -3
  39. package/dist/esm/lib/getProviderHelper.d.ts.map +1 -1
  40. package/dist/esm/lib/getProviderHelper.js +1 -0
  41. package/dist/esm/lib/logger.d.ts +4 -0
  42. package/dist/esm/lib/logger.d.ts.map +1 -0
  43. package/dist/esm/lib/logger.js +7 -0
  44. package/dist/esm/package.d.ts +1 -1
  45. package/dist/esm/package.js +1 -1
  46. package/dist/esm/providers/black-forest-labs.d.ts.map +1 -1
  47. package/dist/esm/providers/black-forest-labs.js +3 -1
  48. package/dist/esm/providers/fal-ai.d.ts +11 -2
  49. package/dist/esm/providers/fal-ai.d.ts.map +1 -1
  50. package/dist/esm/providers/fal-ai.js +62 -0
  51. package/dist/esm/providers/hf-inference.d.ts +6 -3
  52. package/dist/esm/providers/hf-inference.d.ts.map +1 -1
  53. package/dist/esm/providers/hf-inference.js +32 -7
  54. package/dist/esm/providers/providerHelper.d.ts +2 -0
  55. package/dist/esm/providers/providerHelper.d.ts.map +1 -1
  56. package/dist/esm/snippets/getInferenceSnippets.d.ts.map +1 -1
  57. package/dist/esm/snippets/getInferenceSnippets.js +4 -4
  58. package/dist/esm/tasks/custom/request.d.ts.map +1 -1
  59. package/dist/esm/tasks/custom/request.js +3 -1
  60. package/dist/esm/tasks/custom/streamingRequest.d.ts.map +1 -1
  61. package/dist/esm/tasks/custom/streamingRequest.js +3 -1
  62. package/dist/esm/tasks/cv/imageSegmentation.d.ts +1 -2
  63. package/dist/esm/tasks/cv/imageSegmentation.d.ts.map +1 -1
  64. package/dist/esm/tasks/cv/imageSegmentation.js +4 -3
  65. package/dist/esm/types.d.ts +7 -0
  66. package/dist/esm/types.d.ts.map +1 -1
  67. package/package.json +3 -3
  68. package/src/index.ts +1 -0
  69. package/src/lib/getInferenceProviderMapping.ts +6 -3
  70. package/src/lib/getProviderHelper.ts +1 -0
  71. package/src/lib/logger.ts +11 -0
  72. package/src/package.ts +1 -1
  73. package/src/providers/black-forest-labs.ts +3 -1
  74. package/src/providers/fal-ai.ts +87 -2
  75. package/src/providers/hf-inference.ts +44 -12
  76. package/src/providers/providerHelper.ts +2 -0
  77. package/src/snippets/getInferenceSnippets.ts +4 -4
  78. package/src/tasks/custom/request.ts +3 -1
  79. package/src/tasks/custom/streamingRequest.ts +3 -1
  80. package/src/tasks/cv/imageSegmentation.ts +5 -4
  81. package/src/types.ts +8 -0
@@ -1,12 +1,14 @@
1
1
  import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
2
2
  import { getProviderHelper } from "../../lib/getProviderHelper.js";
3
3
  import { innerRequest } from "../../utils/request.js";
4
+ import { getLogger } from "../../lib/logger.js";
4
5
  /**
5
6
  * Primitive to make custom calls to the inference provider
6
7
  * @deprecated Use specific task functions instead. This function will be removed in a future version.
7
8
  */
8
9
  export async function request(args, options) {
9
- console.warn("The request method is deprecated and will be removed in a future version of huggingface.js. Use specific task functions instead.");
10
+ const logger = getLogger();
11
+ logger.warn("The request method is deprecated and will be removed in a future version of huggingface.js. Use specific task functions instead.");
10
12
  const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
11
13
  const providerHelper = getProviderHelper(provider, options?.task);
12
14
  const result = await innerRequest(args, providerHelper, options);
@@ -1 +1 @@
1
- {"version":3,"file":"streamingRequest.d.ts","sourceRoot":"","sources":["../../../../src/tasks/custom/streamingRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG1E;;;GAGG;AACH,wBAAuB,gBAAgB,CAAC,CAAC,EACxC,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,oEAAoE;IACpE,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB,GACC,cAAc,CAAC,CAAC,CAAC,CAOnB"}
1
+ {"version":3,"file":"streamingRequest.d.ts","sourceRoot":"","sources":["../../../../src/tasks/custom/streamingRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI1E;;;GAGG;AACH,wBAAuB,gBAAgB,CAAC,CAAC,EACxC,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,oEAAoE;IACpE,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB,GACC,cAAc,CAAC,CAAC,CAAC,CAQnB"}
@@ -1,12 +1,14 @@
1
1
  import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
2
2
  import { getProviderHelper } from "../../lib/getProviderHelper.js";
3
3
  import { innerStreamingRequest } from "../../utils/request.js";
4
+ import { getLogger } from "../../lib/logger.js";
4
5
  /**
5
6
  * Primitive to make custom inference calls that expect server-sent events, and returns the response through a generator
6
7
  * @deprecated Use specific task functions instead. This function will be removed in a future version.
7
8
  */
8
9
  export async function* streamingRequest(args, options) {
9
- console.warn("The streamingRequest method is deprecated and will be removed in a future version of huggingface.js. Use specific task functions instead.");
10
+ const logger = getLogger();
11
+ logger.warn("The streamingRequest method is deprecated and will be removed in a future version of huggingface.js. Use specific task functions instead.");
10
12
  const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
11
13
  const providerHelper = getProviderHelper(provider, options?.task);
12
14
  yield* innerStreamingRequest(args, providerHelper, options);
@@ -1,7 +1,6 @@
1
1
  import type { ImageSegmentationInput, ImageSegmentationOutput } from "@huggingface/tasks";
2
2
  import type { BaseArgs, Options } from "../../types.js";
3
- import { type LegacyImageInput } from "./utils.js";
4
- export type ImageSegmentationArgs = BaseArgs & (ImageSegmentationInput | LegacyImageInput);
3
+ export type ImageSegmentationArgs = BaseArgs & ImageSegmentationInput;
5
4
  /**
6
5
  * This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects.
7
6
  * Recommended model: facebook/detr-resnet-50-panoptic
@@ -1 +1 @@
1
- {"version":3,"file":"imageSegmentation.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/imageSegmentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG1F,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnE,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,CAAC;AAE3F;;;GAGG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,uBAAuB,CAAC,CASlC"}
1
+ {"version":3,"file":"imageSegmentation.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/imageSegmentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG1F,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAIxD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,sBAAsB,CAAC;AAEtE;;;GAGG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,uBAAuB,CAAC,CAUlC"}
@@ -1,7 +1,7 @@
1
1
  import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
2
2
  import { getProviderHelper } from "../../lib/getProviderHelper.js";
3
3
  import { innerRequest } from "../../utils/request.js";
4
- import { preparePayload } from "./utils.js";
4
+ import { makeRequestOptions } from "../../lib/makeRequestOptions.js";
5
5
  /**
6
6
  * This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects.
7
7
  * Recommended model: facebook/detr-resnet-50-panoptic
@@ -9,10 +9,11 @@ import { preparePayload } from "./utils.js";
9
9
  export async function imageSegmentation(args, options) {
10
10
  const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
11
11
  const providerHelper = getProviderHelper(provider, "image-segmentation");
12
- const payload = preparePayload(args);
12
+ const payload = await providerHelper.preparePayloadAsync(args);
13
13
  const { data: res } = await innerRequest(payload, providerHelper, {
14
14
  ...options,
15
15
  task: "image-segmentation",
16
16
  });
17
- return providerHelper.getResponse(res);
17
+ const { url, info } = await makeRequestOptions(args, providerHelper, { ...options, task: "image-segmentation" });
18
+ return providerHelper.getResponse(res, url, info.headers);
18
19
  }
@@ -3,6 +3,13 @@ import type { ChatCompletionInput, PipelineType, WidgetType } from "@huggingface
3
3
  * HF model id, like "meta-llama/Llama-3.3-70B-Instruct"
4
4
  */
5
5
  export type ModelId = string;
6
+ export interface Logger {
7
+ debug: (message: string, ...args: unknown[]) => void;
8
+ info: (message: string, ...args: unknown[]) => void;
9
+ warn: (message: string, ...args: unknown[]) => void;
10
+ error: (message: string, ...args: unknown[]) => void;
11
+ log: (message: string, ...args: unknown[]) => void;
12
+ }
6
13
  export interface Options {
7
14
  /**
8
15
  * (Default: true) Boolean. If a request 503s, the request will be retried with the same parameters.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExF;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,OAAO;IACvB;;O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pD,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huggingface/inference",
3
- "version": "4.3.2",
3
+ "version": "4.5.0",
4
4
  "license": "MIT",
5
5
  "author": "Hugging Face and Tim Mikeladze <tim.mikeladze@gmail.com>",
6
6
  "description": "Typescript client for the Hugging Face Inference Providers and Inference Endpoints",
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "type": "module",
42
42
  "dependencies": {
43
- "@huggingface/tasks": "^0.19.22",
44
- "@huggingface/jinja": "^0.5.0"
43
+ "@huggingface/tasks": "^0.19.23",
44
+ "@huggingface/jinja": "^0.5.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "18.13.0"
package/src/index.ts CHANGED
@@ -5,5 +5,6 @@ export * from "./tasks/index.js";
5
5
  import * as snippets from "./snippets/index.js";
6
6
  export * from "./lib/getProviderHelper.js";
7
7
  export * from "./lib/makeRequestOptions.js";
8
+ export { setLogger } from "./lib/logger.js";
8
9
 
9
10
  export { snippets };
@@ -5,6 +5,7 @@ import { EQUIVALENT_SENTENCE_TRANSFORMERS_TASKS } from "../providers/hf-inferenc
5
5
  import type { InferenceProvider, InferenceProviderMappingEntry, InferenceProviderOrPolicy, ModelId } from "../types.js";
6
6
  import { typedInclude } from "../utils/typedInclude.js";
7
7
  import { InferenceClientHubApiError, InferenceClientInputError } from "../errors.js";
8
+ import { getLogger } from "./logger.js";
8
9
 
9
10
  export const inferenceProviderMappingCache = new Map<ModelId, InferenceProviderMappingEntry[]>();
10
11
 
@@ -122,6 +123,7 @@ export async function getInferenceProviderMapping(
122
123
  fetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
123
124
  }
124
125
  ): Promise<InferenceProviderMappingEntry | null> {
126
+ const logger = getLogger();
125
127
  if (HARDCODED_MODEL_INFERENCE_MAPPING[params.provider][params.modelId]) {
126
128
  return HARDCODED_MODEL_INFERENCE_MAPPING[params.provider][params.modelId];
127
129
  }
@@ -138,7 +140,7 @@ export async function getInferenceProviderMapping(
138
140
  );
139
141
  }
140
142
  if (providerMapping.status === "staging") {
141
- console.warn(
143
+ logger.warn(
142
144
  `Model ${params.modelId} is in staging mode for provider ${params.provider}. Meant for test purposes only.`
143
145
  );
144
146
  }
@@ -152,6 +154,7 @@ export async function resolveProvider(
152
154
  modelId?: string,
153
155
  endpointUrl?: string
154
156
  ): Promise<InferenceProvider> {
157
+ const logger = getLogger();
155
158
  if (endpointUrl) {
156
159
  if (provider) {
157
160
  throw new InferenceClientInputError("Specifying both endpointUrl and provider is not supported.");
@@ -160,7 +163,7 @@ export async function resolveProvider(
160
163
  return "hf-inference";
161
164
  }
162
165
  if (!provider) {
163
- console.log(
166
+ logger.log(
164
167
  "Defaulting to 'auto' which will select the first provider available for the model, sorted by the user's order in https://hf.co/settings/inference-providers."
165
168
  );
166
169
  provider = "auto";
@@ -171,7 +174,7 @@ export async function resolveProvider(
171
174
  }
172
175
  const mappings = await fetchInferenceProviderMappingForModel(modelId);
173
176
  provider = mappings[0]?.provider as InferenceProvider | undefined;
174
- console.log("Auto selected provider:", provider);
177
+ logger.log("Auto selected provider:", provider);
175
178
  }
176
179
  if (!provider) {
177
180
  throw new InferenceClientInputError(`No Inference Provider available for model ${modelId}.`);
@@ -67,6 +67,7 @@ export const PROVIDERS: Record<InferenceProvider, Partial<Record<InferenceTask,
67
67
  "text-to-video": new FalAI.FalAITextToVideoTask(),
68
68
  "image-to-image": new FalAI.FalAIImageToImageTask(),
69
69
  "automatic-speech-recognition": new FalAI.FalAIAutomaticSpeechRecognitionTask(),
70
+ "image-segmentation": new FalAI.FalAIImageSegmentationTask(),
70
71
  },
71
72
  "featherless-ai": {
72
73
  conversational: new FeatherlessAI.FeatherlessAIConversationalTask(),
@@ -0,0 +1,11 @@
1
+ import type { Logger } from "../types.js";
2
+
3
+ let globalLogger: Logger = console;
4
+
5
+ export function setLogger(logger: Logger): void {
6
+ globalLogger = logger;
7
+ }
8
+
9
+ export function getLogger(): Logger {
10
+ return globalLogger;
11
+ }
package/src/package.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // Generated file from package.json. Issues importing JSON directly when publishing on commonjs/ESM - see https://github.com/microsoft/TypeScript/issues/51783
2
- export const PACKAGE_VERSION = "4.3.2";
2
+ export const PACKAGE_VERSION = "4.5.0";
3
3
  export const PACKAGE_NAME = "@huggingface/inference";
@@ -19,6 +19,7 @@ import {
19
19
  InferenceClientProviderApiError,
20
20
  InferenceClientProviderOutputError,
21
21
  } from "../errors.js";
22
+ import { getLogger } from "../lib/logger.js";
22
23
  import type { BodyParams, HeaderParams, UrlParams } from "../types.js";
23
24
  import { delay } from "../utils/delay.js";
24
25
  import { omit } from "../utils/omit.js";
@@ -67,10 +68,11 @@ export class BlackForestLabsTextToImageTask extends TaskProviderHelper implement
67
68
  headers?: HeadersInit,
68
69
  outputType?: "url" | "blob"
69
70
  ): Promise<string | Blob> {
71
+ const logger = getLogger();
70
72
  const urlObj = new URL(response.polling_url);
71
73
  for (let step = 0; step < 5; step++) {
72
74
  await delay(1000);
73
- console.debug(`Polling Black Forest Labs API for the result... ${step + 1}/5`);
75
+ logger.debug(`Polling Black Forest Labs API for the result... ${step + 1}/5`);
74
76
  urlObj.searchParams.set("attempt", step.toString(10));
75
77
  const resp = await fetch(urlObj, { headers: { "Content-Type": "application/json" } });
76
78
  if (!resp.ok) {
@@ -16,12 +16,12 @@
16
16
  */
17
17
  import { base64FromBytes } from "../utils/base64FromBytes.js";
18
18
 
19
- import type { AutomaticSpeechRecognitionOutput } from "@huggingface/tasks";
19
+ import type { AutomaticSpeechRecognitionOutput, ImageSegmentationOutput } from "@huggingface/tasks";
20
20
  import { isUrl } from "../lib/isUrl.js";
21
21
  import type { BodyParams, HeaderParams, InferenceTask, ModelId, RequestArgs, UrlParams } from "../types.js";
22
22
  import { delay } from "../utils/delay.js";
23
23
  import { omit } from "../utils/omit.js";
24
- import type { ImageToImageTaskHelper } from "./providerHelper.js";
24
+ import type { ImageSegmentationTaskHelper, ImageToImageTaskHelper } from "./providerHelper.js";
25
25
  import {
26
26
  type AutomaticSpeechRecognitionTaskHelper,
27
27
  TaskProviderHelper,
@@ -36,6 +36,7 @@ import {
36
36
  InferenceClientProviderOutputError,
37
37
  } from "../errors.js";
38
38
  import type { ImageToImageArgs } from "../tasks/index.js";
39
+ import type { ImageSegmentationArgs } from "../tasks/cv/imageSegmentation.js";
39
40
 
40
41
  export interface FalAiQueueOutput {
41
42
  request_id: string;
@@ -406,3 +407,87 @@ export class FalAITextToSpeechTask extends FalAITask {
406
407
  }
407
408
  }
408
409
  }
410
+ export class FalAIImageSegmentationTask extends FalAiQueueTask implements ImageSegmentationTaskHelper {
411
+ task: InferenceTask;
412
+ constructor() {
413
+ super("https://queue.fal.run");
414
+ this.task = "image-segmentation";
415
+ }
416
+
417
+ override makeRoute(params: UrlParams): string {
418
+ if (params.authMethod !== "provider-key") {
419
+ return `/${params.model}?_subdomain=queue`;
420
+ }
421
+ return `/${params.model}`;
422
+ }
423
+
424
+ override preparePayload(params: BodyParams): Record<string, unknown> {
425
+ return {
426
+ ...omit(params.args, ["inputs", "parameters"]),
427
+ ...(params.args.parameters as Record<string, unknown>),
428
+ sync_mode: true,
429
+ };
430
+ }
431
+
432
+ async preparePayloadAsync(args: ImageSegmentationArgs): Promise<RequestArgs> {
433
+ const blob = "data" in args && args.data instanceof Blob ? args.data : "inputs" in args ? args.inputs : undefined;
434
+ const mimeType = blob instanceof Blob ? blob.type : "image/png";
435
+ const base64Image = base64FromBytes(
436
+ new Uint8Array(blob instanceof ArrayBuffer ? blob : await (blob as Blob).arrayBuffer())
437
+ );
438
+ return {
439
+ ...omit(args, ["inputs", "parameters", "data"]),
440
+ ...args.parameters,
441
+ ...args,
442
+ image_url: `data:${mimeType};base64,${base64Image}`,
443
+ sync_mode: true,
444
+ };
445
+ }
446
+
447
+ override async getResponse(
448
+ response: FalAiQueueOutput,
449
+ url?: string,
450
+ headers?: Record<string, string>
451
+ ): Promise<ImageSegmentationOutput> {
452
+ const result = await this.getResponseFromQueueApi(response, url, headers);
453
+ if (
454
+ typeof result === "object" &&
455
+ result !== null &&
456
+ "image" in result &&
457
+ typeof result.image === "object" &&
458
+ result.image !== null &&
459
+ "url" in result.image &&
460
+ typeof result.image.url === "string"
461
+ ) {
462
+ const maskResponse = await fetch(result.image.url);
463
+ if (!maskResponse.ok) {
464
+ throw new InferenceClientProviderApiError(
465
+ `Failed to fetch segmentation mask from ${result.image.url}`,
466
+ { url: result.image.url, method: "GET" },
467
+ {
468
+ requestId: maskResponse.headers.get("x-request-id") ?? "",
469
+ status: maskResponse.status,
470
+ body: await maskResponse.text(),
471
+ }
472
+ );
473
+ }
474
+ const maskBlob = await maskResponse.blob();
475
+ const maskArrayBuffer = await maskBlob.arrayBuffer();
476
+ const maskBase64 = base64FromBytes(new Uint8Array(maskArrayBuffer));
477
+
478
+ return [
479
+ {
480
+ label: "mask", // placeholder label, as Fal does not provide labels in the response(?)
481
+ score: 1.0, // placeholder score, as Fal does not provide scores in the response(?)
482
+ mask: maskBase64,
483
+ },
484
+ ];
485
+ }
486
+
487
+ throw new InferenceClientProviderOutputError(
488
+ `Received malformed response from Fal.ai image-segmentation API: expected { image: { url: string } } format, got instead: ${JSON.stringify(
489
+ response
490
+ )}`
491
+ );
492
+ }
493
+ }
@@ -22,6 +22,7 @@ import type {
22
22
  ImageToTextOutput,
23
23
  ObjectDetectionOutput,
24
24
  QuestionAnsweringOutput,
25
+ QuestionAnsweringOutputElement,
25
26
  SentenceSimilarityOutput,
26
27
  SummarizationOutput,
27
28
  TableQuestionAnsweringOutput,
@@ -31,6 +32,7 @@ import type {
31
32
  TranslationOutput,
32
33
  VisualQuestionAnsweringOutput,
33
34
  ZeroShotClassificationOutput,
35
+ ZeroShotClassificationOutputElement,
34
36
  ZeroShotImageClassificationOutput,
35
37
  } from "@huggingface/tasks";
36
38
  import { HF_ROUTER_URL } from "../config.js";
@@ -74,6 +76,7 @@ import { base64FromBytes } from "../utils/base64FromBytes.js";
74
76
  import type { ImageToImageArgs } from "../tasks/cv/imageToImage.js";
75
77
  import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition.js";
76
78
  import { omit } from "../utils/omit.js";
79
+ import type { ImageSegmentationArgs } from "../tasks/cv/imageSegmentation.js";
77
80
  interface Base64ImageGeneration {
78
81
  data: Array<{
79
82
  b64_json: string;
@@ -343,6 +346,15 @@ export class HFInferenceImageSegmentationTask extends HFInferenceTask implements
343
346
  "Received malformed response from HF-Inference image-segmentation API: expected Array<{label: string, mask: string, score: number}>"
344
347
  );
345
348
  }
349
+
350
+ async preparePayloadAsync(args: ImageSegmentationArgs): Promise<RequestArgs> {
351
+ return {
352
+ ...args,
353
+ inputs: base64FromBytes(
354
+ new Uint8Array(args.inputs instanceof ArrayBuffer ? args.inputs : await (args.inputs as Blob).arrayBuffer())
355
+ ),
356
+ };
357
+ }
346
358
  }
347
359
 
348
360
  export class HFInferenceImageToTextTask extends HFInferenceTask implements ImageToTextTaskHelper {
@@ -435,7 +447,7 @@ export class HFInferenceTextClassificationTask extends HFInferenceTask implement
435
447
  export class HFInferenceQuestionAnsweringTask extends HFInferenceTask implements QuestionAnsweringTaskHelper {
436
448
  override async getResponse(
437
449
  response: QuestionAnsweringOutput | QuestionAnsweringOutput[number]
438
- ): Promise<QuestionAnsweringOutput[number]> {
450
+ ): Promise<QuestionAnsweringOutputElement> {
439
451
  if (
440
452
  Array.isArray(response)
441
453
  ? response.every(
@@ -483,22 +495,42 @@ export class HFInferenceFillMaskTask extends HFInferenceTask implements FillMask
483
495
  }
484
496
 
485
497
  export class HFInferenceZeroShotClassificationTask extends HFInferenceTask implements ZeroShotClassificationTaskHelper {
486
- override async getResponse(response: ZeroShotClassificationOutput): Promise<ZeroShotClassificationOutput> {
498
+ override async getResponse(response: unknown): Promise<ZeroShotClassificationOutput> {
499
+ /// Handle Legacy response format from Inference API
487
500
  if (
488
- Array.isArray(response) &&
489
- response.every(
490
- (x) =>
491
- Array.isArray(x.labels) &&
492
- x.labels.every((_label) => typeof _label === "string") &&
493
- Array.isArray(x.scores) &&
494
- x.scores.every((_score) => typeof _score === "number") &&
495
- typeof x.sequence === "string"
496
- )
501
+ typeof response === "object" &&
502
+ response !== null &&
503
+ "labels" in response &&
504
+ "scores" in response &&
505
+ Array.isArray(response.labels) &&
506
+ Array.isArray(response.scores) &&
507
+ response.labels.length === response.scores.length &&
508
+ response.labels.every((label: unknown): label is string => typeof label === "string") &&
509
+ response.scores.every((score: unknown): score is number => typeof score === "number")
497
510
  ) {
511
+ const scores = response.scores;
512
+ return response.labels.map((label: string, index: number) => ({
513
+ label,
514
+ score: scores[index],
515
+ }));
516
+ }
517
+
518
+ if (Array.isArray(response) && response.every(HFInferenceZeroShotClassificationTask.validateOutputElement)) {
498
519
  return response;
499
520
  }
500
521
  throw new InferenceClientProviderOutputError(
501
- "Received malformed response from HF-Inference zero-shot-classification API: expected Array<{labels: string[], scores: number[], sequence: string}>"
522
+ "Received malformed response from HF-Inference zero-shot-classification API: expected Array<{label: string, score: number}>"
523
+ );
524
+ }
525
+
526
+ private static validateOutputElement(elem: unknown): elem is ZeroShotClassificationOutputElement {
527
+ return (
528
+ typeof elem === "object" &&
529
+ !!elem &&
530
+ "label" in elem &&
531
+ "score" in elem &&
532
+ typeof elem.label === "string" &&
533
+ typeof elem.score === "number"
502
534
  );
503
535
  }
504
536
  }
@@ -54,6 +54,7 @@ import { toArray } from "../utils/toArray.js";
54
54
  import type { ImageToImageArgs } from "../tasks/cv/imageToImage.js";
55
55
  import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition.js";
56
56
  import type { ImageToVideoArgs } from "../tasks/cv/imageToVideo.js";
57
+ import type { ImageSegmentationArgs } from "../tasks/cv/imageSegmentation.js";
57
58
 
58
59
  /**
59
60
  * Base class for task-specific provider helpers
@@ -161,6 +162,7 @@ export interface ImageToVideoTaskHelper {
161
162
  export interface ImageSegmentationTaskHelper {
162
163
  getResponse(response: unknown, url?: string, headers?: HeadersInit): Promise<ImageSegmentationOutput>;
163
164
  preparePayload(params: BodyParams<ImageSegmentationInput & BaseArgs>): Record<string, unknown> | BodyInit;
165
+ preparePayloadAsync(args: ImageSegmentationArgs): Promise<RequestArgs>;
164
166
  }
165
167
 
166
168
  export interface ImageClassificationTaskHelper {
@@ -12,6 +12,7 @@ import { getProviderHelper } from "../lib/getProviderHelper.js";
12
12
  import { makeRequestOptionsFromResolvedModel } from "../lib/makeRequestOptions.js";
13
13
  import type { InferenceProviderMappingEntry, InferenceProviderOrPolicy, InferenceTask, RequestArgs } from "../types.js";
14
14
  import { templates } from "./templates.exported.js";
15
+ import { getLogger } from "../lib/logger.js";
15
16
 
16
17
  export type InferenceSnippetOptions = {
17
18
  streaming?: boolean;
@@ -121,7 +122,6 @@ const HF_JS_METHODS: Partial<Record<WidgetType, string>> = {
121
122
  "table-question-answering": "tableQuestionAnswering",
122
123
  "text-classification": "textClassification",
123
124
  "text-generation": "textGeneration",
124
- "text2text-generation": "textGeneration",
125
125
  "token-classification": "tokenClassification",
126
126
  "text-to-speech": "textToSpeech",
127
127
  translation: "translation",
@@ -140,6 +140,7 @@ const snippetGenerator = (templateName: string, inputPreparationFn?: InputPrepar
140
140
  inferenceProviderMapping?: InferenceProviderMappingEntry,
141
141
  opts?: InferenceSnippetOptions
142
142
  ): InferenceSnippet[] => {
143
+ const logger = getLogger();
143
144
  const providerModelId = inferenceProviderMapping?.providerId ?? model.id;
144
145
  /// Hacky: hard-code conversational templates here
145
146
  let task = model.pipeline_tag as InferenceTask;
@@ -156,7 +157,7 @@ const snippetGenerator = (templateName: string, inputPreparationFn?: InputPrepar
156
157
  try {
157
158
  providerHelper = getProviderHelper(provider, task);
158
159
  } catch (e) {
159
- console.error(`Failed to get provider helper for ${provider} (${task})`, e);
160
+ logger.error(`Failed to get provider helper for ${provider} (${task})`, e);
160
161
  return [];
161
162
  }
162
163
 
@@ -191,7 +192,7 @@ const snippetGenerator = (templateName: string, inputPreparationFn?: InputPrepar
191
192
  try {
192
193
  providerInputs = JSON.parse(bodyAsObj);
193
194
  } catch (e) {
194
- console.error("Failed to parse body as JSON", e);
195
+ logger.error("Failed to parse body as JSON", e);
195
196
  }
196
197
  }
197
198
 
@@ -359,7 +360,6 @@ const snippets: Partial<
359
360
  "text-to-image": snippetGenerator("textToImage"),
360
361
  "text-to-speech": snippetGenerator("textToSpeech"),
361
362
  "text-to-video": snippetGenerator("textToVideo"),
362
- "text2text-generation": snippetGenerator("basic"),
363
363
  "token-classification": snippetGenerator("basic"),
364
364
  translation: snippetGenerator("basic"),
365
365
  "zero-shot-classification": snippetGenerator("zeroShotClassification"),
@@ -2,6 +2,7 @@ import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
2
2
  import { getProviderHelper } from "../../lib/getProviderHelper.js";
3
3
  import type { InferenceTask, Options, RequestArgs } from "../../types.js";
4
4
  import { innerRequest } from "../../utils/request.js";
5
+ import { getLogger } from "../../lib/logger.js";
5
6
 
6
7
  /**
7
8
  * Primitive to make custom calls to the inference provider
@@ -14,7 +15,8 @@ export async function request<T>(
14
15
  task?: InferenceTask;
15
16
  }
16
17
  ): Promise<T> {
17
- console.warn(
18
+ const logger = getLogger();
19
+ logger.warn(
18
20
  "The request method is deprecated and will be removed in a future version of huggingface.js. Use specific task functions instead."
19
21
  );
20
22
  const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
@@ -2,6 +2,7 @@ import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
2
2
  import { getProviderHelper } from "../../lib/getProviderHelper.js";
3
3
  import type { InferenceTask, Options, RequestArgs } from "../../types.js";
4
4
  import { innerStreamingRequest } from "../../utils/request.js";
5
+ import { getLogger } from "../../lib/logger.js";
5
6
 
6
7
  /**
7
8
  * Primitive to make custom inference calls that expect server-sent events, and returns the response through a generator
@@ -14,7 +15,8 @@ export async function* streamingRequest<T>(
14
15
  task?: InferenceTask;
15
16
  }
16
17
  ): AsyncGenerator<T> {
17
- console.warn(
18
+ const logger = getLogger();
19
+ logger.warn(
18
20
  "The streamingRequest method is deprecated and will be removed in a future version of huggingface.js. Use specific task functions instead."
19
21
  );
20
22
  const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
@@ -3,9 +3,9 @@ import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
3
3
  import { getProviderHelper } from "../../lib/getProviderHelper.js";
4
4
  import type { BaseArgs, Options } from "../../types.js";
5
5
  import { innerRequest } from "../../utils/request.js";
6
- import { preparePayload, type LegacyImageInput } from "./utils.js";
6
+ import { makeRequestOptions } from "../../lib/makeRequestOptions.js";
7
7
 
8
- export type ImageSegmentationArgs = BaseArgs & (ImageSegmentationInput | LegacyImageInput);
8
+ export type ImageSegmentationArgs = BaseArgs & ImageSegmentationInput;
9
9
 
10
10
  /**
11
11
  * This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects.
@@ -17,10 +17,11 @@ export async function imageSegmentation(
17
17
  ): Promise<ImageSegmentationOutput> {
18
18
  const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
19
19
  const providerHelper = getProviderHelper(provider, "image-segmentation");
20
- const payload = preparePayload(args);
20
+ const payload = await providerHelper.preparePayloadAsync(args);
21
21
  const { data: res } = await innerRequest<ImageSegmentationOutput>(payload, providerHelper, {
22
22
  ...options,
23
23
  task: "image-segmentation",
24
24
  });
25
- return providerHelper.getResponse(res);
25
+ const { url, info } = await makeRequestOptions(args, providerHelper, { ...options, task: "image-segmentation" });
26
+ return providerHelper.getResponse(res, url, info.headers as Record<string, string>);
26
27
  }
package/src/types.ts CHANGED
@@ -5,6 +5,14 @@ import type { ChatCompletionInput, PipelineType, WidgetType } from "@huggingface
5
5
  */
6
6
  export type ModelId = string;
7
7
 
8
+ export interface Logger {
9
+ debug: (message: string, ...args: unknown[]) => void;
10
+ info: (message: string, ...args: unknown[]) => void;
11
+ warn: (message: string, ...args: unknown[]) => void;
12
+ error: (message: string, ...args: unknown[]) => void;
13
+ log: (message: string, ...args: unknown[]) => void;
14
+ }
15
+
8
16
  export interface Options {
9
17
  /**
10
18
  * (Default: true) Boolean. If a request 503s, the request will be retried with the same parameters.