@huggingface/inference 2.8.0 → 3.0.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 (48) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +39 -16
  3. package/dist/index.cjs +364 -134
  4. package/dist/index.js +359 -134
  5. package/dist/src/config.d.ts +3 -0
  6. package/dist/src/config.d.ts.map +1 -0
  7. package/dist/src/index.d.ts +5 -0
  8. package/dist/src/index.d.ts.map +1 -1
  9. package/dist/src/lib/getDefaultTask.d.ts +0 -1
  10. package/dist/src/lib/getDefaultTask.d.ts.map +1 -1
  11. package/dist/src/lib/makeRequestOptions.d.ts.map +1 -1
  12. package/dist/src/providers/fal-ai.d.ts +6 -0
  13. package/dist/src/providers/fal-ai.d.ts.map +1 -0
  14. package/dist/src/providers/replicate.d.ts +6 -0
  15. package/dist/src/providers/replicate.d.ts.map +1 -0
  16. package/dist/src/providers/sambanova.d.ts +6 -0
  17. package/dist/src/providers/sambanova.d.ts.map +1 -0
  18. package/dist/src/providers/together.d.ts +12 -0
  19. package/dist/src/providers/together.d.ts.map +1 -0
  20. package/dist/src/providers/types.d.ts +4 -0
  21. package/dist/src/providers/types.d.ts.map +1 -0
  22. package/dist/src/tasks/audio/automaticSpeechRecognition.d.ts.map +1 -1
  23. package/dist/src/tasks/custom/request.d.ts +1 -1
  24. package/dist/src/tasks/custom/request.d.ts.map +1 -1
  25. package/dist/src/tasks/custom/streamingRequest.d.ts.map +1 -1
  26. package/dist/src/tasks/cv/textToImage.d.ts +8 -0
  27. package/dist/src/tasks/cv/textToImage.d.ts.map +1 -1
  28. package/dist/src/tasks/nlp/chatCompletion.d.ts.map +1 -1
  29. package/dist/src/tasks/nlp/textGeneration.d.ts.map +1 -1
  30. package/dist/src/types.d.ts +16 -2
  31. package/dist/src/types.d.ts.map +1 -1
  32. package/package.json +2 -2
  33. package/src/config.ts +2 -0
  34. package/src/index.ts +5 -0
  35. package/src/lib/getDefaultTask.ts +1 -1
  36. package/src/lib/makeRequestOptions.ts +199 -59
  37. package/src/providers/fal-ai.ts +15 -0
  38. package/src/providers/replicate.ts +16 -0
  39. package/src/providers/sambanova.ts +23 -0
  40. package/src/providers/together.ts +58 -0
  41. package/src/providers/types.ts +6 -0
  42. package/src/tasks/audio/automaticSpeechRecognition.ts +10 -1
  43. package/src/tasks/custom/request.ts +12 -6
  44. package/src/tasks/custom/streamingRequest.ts +18 -3
  45. package/src/tasks/cv/textToImage.ts +44 -1
  46. package/src/tasks/nlp/chatCompletion.ts +2 -2
  47. package/src/tasks/nlp/textGeneration.ts +43 -9
  48. package/src/types.ts +20 -2
@@ -1 +1 @@
1
- {"version":3,"file":"makeRequestOptions.d.ts","sourceRoot":"","sources":["../../../src/lib/makeRequestOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAYpE;;GAEG;AACH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,WAAW,GAAG;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,EACD,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IACnC,sCAAsC;IACtC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CAkG7C"}
1
+ {"version":3,"file":"makeRequestOptions.d.ts","sourceRoot":"","sources":["../../../src/lib/makeRequestOptions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAWpE;;GAEG;AACH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,WAAW,GAAG;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,EACD,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IACnC,sCAAsC;IACtC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CA+G7C"}
@@ -0,0 +1,6 @@
1
+ import type { ProviderMapping } from "./types";
2
+ export declare const FAL_AI_API_BASE_URL = "https://fal.run";
3
+ type FalAiId = string;
4
+ export declare const FAL_AI_SUPPORTED_MODEL_IDS: ProviderMapping<FalAiId>;
5
+ export {};
6
+ //# sourceMappingURL=fal-ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fal-ai.d.ts","sourceRoot":"","sources":["../../../src/providers/fal-ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,KAAK,OAAO,GAAG,MAAM,CAAC;AAEtB,eAAO,MAAM,0BAA0B,EAAE,eAAe,CAAC,OAAO,CAQ/D,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ProviderMapping } from "./types";
2
+ export declare const REPLICATE_API_BASE_URL = "https://api.replicate.com";
3
+ type ReplicateId = string;
4
+ export declare const REPLICATE_SUPPORTED_MODEL_IDS: ProviderMapping<ReplicateId>;
5
+ export {};
6
+ //# sourceMappingURL=replicate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replicate.d.ts","sourceRoot":"","sources":["../../../src/providers/replicate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAElE,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,eAAO,MAAM,6BAA6B,EAAE,eAAe,CAAC,WAAW,CAStE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ProviderMapping } from "./types";
2
+ export declare const SAMBANOVA_API_BASE_URL = "https://api.sambanova.ai";
3
+ type SambanovaId = string;
4
+ export declare const SAMBANOVA_SUPPORTED_MODEL_IDS: ProviderMapping<SambanovaId>;
5
+ export {};
6
+ //# sourceMappingURL=sambanova.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sambanova.d.ts","sourceRoot":"","sources":["../../../src/providers/sambanova.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,sBAAsB,6BAA6B,CAAC;AAEjE,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,eAAO,MAAM,6BAA6B,EAAE,eAAe,CAAC,WAAW,CAgBtE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ProviderMapping } from "./types";
2
+ export declare const TOGETHER_API_BASE_URL = "https://api.together.xyz";
3
+ /**
4
+ * Same comment as in sambanova.ts
5
+ */
6
+ type TogetherId = string;
7
+ /**
8
+ * https://docs.together.ai/reference/models-1
9
+ */
10
+ export declare const TOGETHER_SUPPORTED_MODEL_IDS: ProviderMapping<TogetherId>;
11
+ export {};
12
+ //# sourceMappingURL=together.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"together.d.ts","sourceRoot":"","sources":["../../../src/providers/together.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAEhE;;GAEG;AACH,KAAK,UAAU,GAAG,MAAM,CAAC;AAEzB;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,eAAe,CAAC,UAAU,CA6CpE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { WidgetType } from "@huggingface/tasks";
2
+ import type { ModelId } from "../types";
3
+ export type ProviderMapping<ProviderId extends string> = Partial<Record<WidgetType, Partial<Record<ModelId, ProviderId>>>>;
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,MAAM,eAAe,CAAC,UAAU,SAAS,MAAM,IAAI,OAAO,CAC/D,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CACxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"automaticSpeechRecognition.d.ts","sourceRoot":"","sources":["../../../../src/tasks/audio/automaticSpeechRecognition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,8BAA8B,GAAG,QAAQ,GAAG;IACvD;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC/C,IAAI,EAAE,8BAA8B,EACpC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,gCAAgC,CAAC,CAU3C"}
1
+ {"version":3,"file":"automaticSpeechRecognition.d.ts","sourceRoot":"","sources":["../../../../src/tasks/audio/automaticSpeechRecognition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AAIlE,MAAM,MAAM,8BAA8B,GAAG,QAAQ,GAAG;IACvD;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC/C,IAAI,EAAE,8BAA8B,EACpC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,gCAAgC,CAAC,CAkB3C"}
@@ -1,6 +1,6 @@
1
1
  import type { InferenceTask, Options, RequestArgs } from "../../types";
2
2
  /**
3
- * Primitive to make custom calls to Inference Endpoints
3
+ * Primitive to make custom calls to the inference provider
4
4
  */
5
5
  export declare function request<T>(args: RequestArgs, options?: Options & {
6
6
  /** When a model can be used for multiple tasks, and we want to run a non-default task */
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/tasks/custom/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGvE;;GAEG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC9B,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAC9B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,oCAAoC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,OAAO,CAAC,CAAC,CAAC,CA6BZ"}
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/tasks/custom/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGvE;;GAEG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC9B,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAC9B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,oCAAoC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,OAAO,CAAC,CAAC,CAAC,CAmCZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"streamingRequest.d.ts","sourceRoot":"","sources":["../../../../src/tasks/custom/streamingRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAKvE;;GAEG;AACH,wBAAuB,gBAAgB,CAAC,CAAC,EACxC,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAC9B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,oCAAoC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,cAAc,CAAC,CAAC,CAAC,CAuEnB"}
1
+ {"version":3,"file":"streamingRequest.d.ts","sourceRoot":"","sources":["../../../../src/tasks/custom/streamingRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAKvE;;GAEG;AACH,wBAAuB,gBAAgB,CAAC,CAAC,EACxC,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAC9B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,oCAAoC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,cAAc,CAAC,CAAC,CAAC,CAsFnB"}
@@ -4,6 +4,14 @@ export type TextToImageArgs = BaseArgs & {
4
4
  * The text to generate an image from
5
5
  */
6
6
  inputs: string;
7
+ /**
8
+ * Same param but for external providers like Together, Replicate
9
+ */
10
+ prompt?: string;
11
+ response_format?: "base64";
12
+ input?: {
13
+ prompt: string;
14
+ };
7
15
  parameters?: {
8
16
  /**
9
17
  * An optional negative prompt for the image generation
@@ -1 +1 @@
1
- {"version":3,"file":"textToImage.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/textToImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG;IACxC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,CAAC,EAAE;QACZ;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;WAEG;QACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAErC;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAUtG"}
1
+ {"version":3,"file":"textToImage.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/textToImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG;IACxC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,KAAK,CAAC,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;IAEF,UAAU,CAAC,EAAE;QACZ;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;WAEG;QACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAWrC;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAmCtG"}
@@ -1 +1 @@
1
- {"version":3,"file":"chatCompletion.d.ts","sourceRoot":"","sources":["../../../../src/tasks/nlp/chatCompletion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEpF;;GAEG;AAEH,wBAAsB,cAAc,CACnC,IAAI,EAAE,QAAQ,GAAG,mBAAmB,EACpC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,oBAAoB,CAAC,CAmB/B"}
1
+ {"version":3,"file":"chatCompletion.d.ts","sourceRoot":"","sources":["../../../../src/tasks/nlp/chatCompletion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEpF;;GAEG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,QAAQ,GAAG,mBAAmB,EACpC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,oBAAoB,CAAC,CAoB/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"textGeneration.d.ts","sourceRoot":"","sources":["../../../../src/tasks/nlp/textGeneration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEpF,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAIrD,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC;AAE1D;;GAEG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,QAAQ,GAAG,mBAAmB,EACpC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,oBAAoB,CAAC,CAY/B"}
1
+ {"version":3,"file":"textGeneration.d.ts","sourceRoot":"","sources":["../../../../src/tasks/nlp/textGeneration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,mBAAmB,EACnB,oBAAoB,EAEpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAIrD,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC;AAY1D;;GAEG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,QAAQ,GAAG,mBAAmB,EACpC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,oBAAoB,CAAC,CA+B/B"}
@@ -1,5 +1,9 @@
1
1
  import type { PipelineType } from "@huggingface/tasks";
2
2
  import type { ChatCompletionInput } from "@huggingface/tasks";
3
+ /**
4
+ * HF model id, like "meta-llama/Llama-3.3-70B-Instruct"
5
+ */
6
+ export type ModelId = string;
3
7
  export interface Options {
4
8
  /**
5
9
  * (Default: true) Boolean. If a request 503s and wait_for_model is set to false, the request will be retried with the same parameters but with wait_for_model set to true.
@@ -35,28 +39,38 @@ export interface Options {
35
39
  includeCredentials?: string | boolean;
36
40
  }
37
41
  export type InferenceTask = Exclude<PipelineType, "other">;
42
+ export declare const INFERENCE_PROVIDERS: readonly ["fal-ai", "replicate", "sambanova", "together", "hf-inference"];
43
+ export type InferenceProvider = (typeof INFERENCE_PROVIDERS)[number];
38
44
  export interface BaseArgs {
39
45
  /**
40
46
  * The access token to use. Without it, you'll get rate-limited quickly.
41
47
  *
42
48
  * Can be created for free in hf.co/settings/token
49
+ *
50
+ * You can also pass an external Inference provider's key if you intend to call a compatible provider like Sambanova, Together, Replicate...
43
51
  */
44
52
  accessToken?: string;
45
53
  /**
46
- * The model to use.
54
+ * The HF model to use.
47
55
  *
48
56
  * If not specified, will call huggingface.co/api/tasks to get the default model for the task.
49
57
  *
50
58
  * /!\ Legacy behavior allows this to be an URL, but this is deprecated and will be removed in the future.
51
59
  * Use the `endpointUrl` parameter instead.
52
60
  */
53
- model?: string;
61
+ model?: ModelId;
54
62
  /**
55
63
  * The URL of the endpoint to use. If not specified, will call huggingface.co/api/tasks to get the default endpoint for the task.
56
64
  *
57
65
  * If specified, will use this URL instead of the default one.
58
66
  */
59
67
  endpointUrl?: string;
68
+ /**
69
+ * Set an Inference provider to run this model on.
70
+ *
71
+ * Defaults to the first provider in your user settings that is compatible with this model.
72
+ */
73
+ provider?: InferenceProvider;
60
74
  }
61
75
  export type RequestArgs = BaseArgs & ({
62
76
  data: Blob | ArrayBuffer;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAE3D,MAAM,WAAW,QAAQ;IACxB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GACjC,CAAC;IAAE,IAAI,EAAE,IAAI,GAAG,WAAW,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,mBAAmB,CAAC,GAAG;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAE3D,eAAO,MAAM,mBAAmB,2EAA4E,CAAC;AAC7G,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,MAAM,WAAW,QAAQ;IACxB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GACjC,CAAC;IAAE,IAAI,EAAE,IAAI,GAAG,WAAW,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,mBAAmB,CAAC,GAAG;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huggingface/inference",
3
- "version": "2.8.0",
3
+ "version": "3.0.0",
4
4
  "packageManager": "pnpm@8.10.5",
5
5
  "license": "MIT",
6
6
  "author": "Tim Mikeladze <tim.mikeladze@gmail.com>",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "type": "module",
41
41
  "dependencies": {
42
- "@huggingface/tasks": "^0.11.2"
42
+ "@huggingface/tasks": "^0.13.16"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "18.13.0"
package/src/config.ts ADDED
@@ -0,0 +1,2 @@
1
+ export const HF_HUB_URL = "https://huggingface.co";
2
+ export const HF_INFERENCE_API_URL = "https://api-inference.huggingface.co";
package/src/index.ts CHANGED
@@ -1,4 +1,9 @@
1
+ export type { ProviderMapping } from "./providers/types";
1
2
  export { HfInference, HfInferenceEndpoint } from "./HfInference";
2
3
  export { InferenceOutputError } from "./lib/InferenceOutputError";
4
+ export { FAL_AI_SUPPORTED_MODEL_IDS } from "./providers/fal-ai";
5
+ export { REPLICATE_SUPPORTED_MODEL_IDS } from "./providers/replicate";
6
+ export { SAMBANOVA_SUPPORTED_MODEL_IDS } from "./providers/sambanova";
7
+ export { TOGETHER_SUPPORTED_MODEL_IDS } from "./providers/together";
3
8
  export * from "./types";
4
9
  export * from "./tasks";
@@ -1,3 +1,4 @@
1
+ import { HF_HUB_URL } from "../config";
1
2
  import { isUrl } from "./isUrl";
2
3
 
3
4
  /**
@@ -8,7 +9,6 @@ import { isUrl } from "./isUrl";
8
9
  const taskCache = new Map<string, { task: string; date: Date }>();
9
10
  const CACHE_DURATION = 10 * 60 * 1000;
10
11
  const MAX_CACHE_ITEMS = 1000;
11
- export const HF_HUB_URL = "https://huggingface.co";
12
12
 
13
13
  export interface DefaultTaskOptions {
14
14
  fetch?: typeof fetch;
@@ -1,12 +1,18 @@
1
+ import type { WidgetType } from "@huggingface/tasks";
2
+ import { HF_HUB_URL, HF_INFERENCE_API_URL } from "../config";
3
+ import { FAL_AI_API_BASE_URL, FAL_AI_SUPPORTED_MODEL_IDS } from "../providers/fal-ai";
4
+ import { REPLICATE_API_BASE_URL, REPLICATE_SUPPORTED_MODEL_IDS } from "../providers/replicate";
5
+ import { SAMBANOVA_API_BASE_URL, SAMBANOVA_SUPPORTED_MODEL_IDS } from "../providers/sambanova";
6
+ import { TOGETHER_API_BASE_URL, TOGETHER_SUPPORTED_MODEL_IDS } from "../providers/together";
7
+ import type { InferenceProvider } from "../types";
1
8
  import type { InferenceTask, Options, RequestArgs } from "../types";
2
- import { omit } from "../utils/omit";
3
- import { HF_HUB_URL } from "./getDefaultTask";
4
9
  import { isUrl } from "./isUrl";
5
10
 
6
- const HF_INFERENCE_API_BASE_URL = "https://api-inference.huggingface.co";
11
+ const HF_HUB_INFERENCE_PROXY_TEMPLATE = `${HF_HUB_URL}/api/inference-proxy/{{PROVIDER}}`;
7
12
 
8
13
  /**
9
- * Loaded from huggingface.co/api/tasks if needed
14
+ * Lazy-loaded from huggingface.co/api/tasks when needed
15
+ * Used to determine the default model to use when it's not user defined
10
16
  */
11
17
  let tasks: Record<string, { models: { id: string }[] }> | null = null;
12
18
 
@@ -26,40 +32,60 @@ export async function makeRequestOptions(
26
32
  chatCompletion?: boolean;
27
33
  }
28
34
  ): Promise<{ url: string; info: RequestInit }> {
29
- const { accessToken, endpointUrl, ...otherArgs } = args;
30
- let { model } = args;
31
- const {
32
- forceTask: task,
33
- includeCredentials,
34
- taskHint,
35
- wait_for_model,
36
- use_cache,
37
- dont_load_model,
38
- chatCompletion,
39
- } = options ?? {};
35
+ const { accessToken, endpointUrl, provider: maybeProvider, model: maybeModel, ...otherArgs } = args;
36
+ const provider = maybeProvider ?? "hf-inference";
40
37
 
41
- const headers: Record<string, string> = {};
42
- if (accessToken) {
43
- headers["Authorization"] = `Bearer ${accessToken}`;
44
- }
45
-
46
- if (!model && !tasks && taskHint) {
47
- const res = await fetch(`${HF_HUB_URL}/api/tasks`);
38
+ const { forceTask, includeCredentials, taskHint, wait_for_model, use_cache, dont_load_model, chatCompletion } =
39
+ options ?? {};
48
40
 
49
- if (res.ok) {
50
- tasks = await res.json();
51
- }
41
+ if (endpointUrl && provider !== "hf-inference") {
42
+ throw new Error(`Cannot use endpointUrl with a third-party provider.`);
43
+ }
44
+ if (forceTask && provider !== "hf-inference") {
45
+ throw new Error(`Cannot use forceTask with a third-party provider.`);
46
+ }
47
+ if (maybeModel && isUrl(maybeModel)) {
48
+ throw new Error(`Model URLs are no longer supported. Use endpointUrl instead.`);
52
49
  }
53
50
 
54
- if (!model && tasks && taskHint) {
55
- const taskInfo = tasks[taskHint];
56
- if (taskInfo) {
57
- model = taskInfo.models[0].id;
51
+ let model: string;
52
+ if (!maybeModel) {
53
+ if (taskHint) {
54
+ model = mapModel({ model: await loadDefaultModel(taskHint), provider, taskHint, chatCompletion });
55
+ } else {
56
+ throw new Error("No model provided, and no default model found for this task");
57
+ /// TODO : change error message ^
58
58
  }
59
+ } else {
60
+ model = mapModel({ model: maybeModel, provider, taskHint, chatCompletion });
59
61
  }
60
62
 
61
- if (!model) {
62
- throw new Error("No model provided, and no default model found for this task");
63
+ /// If accessToken is passed, it should take precedence over includeCredentials
64
+ const authMethod = accessToken
65
+ ? accessToken.startsWith("hf_")
66
+ ? "hf-token"
67
+ : "provider-key"
68
+ : includeCredentials === "include"
69
+ ? "credentials-include"
70
+ : "none";
71
+
72
+ const url = endpointUrl
73
+ ? chatCompletion
74
+ ? endpointUrl + `/v1/chat/completions`
75
+ : endpointUrl
76
+ : makeUrl({
77
+ authMethod,
78
+ chatCompletion: chatCompletion ?? false,
79
+ forceTask,
80
+ model,
81
+ provider: provider ?? "hf-inference",
82
+ taskHint,
83
+ });
84
+
85
+ const headers: Record<string, string> = {};
86
+ if (accessToken) {
87
+ headers["Authorization"] =
88
+ provider === "fal-ai" && authMethod === "provider-key" ? `Key ${accessToken}` : `Bearer ${accessToken}`;
63
89
  }
64
90
 
65
91
  const binary = "data" in args && !!args.data;
@@ -68,36 +94,20 @@ export async function makeRequestOptions(
68
94
  headers["Content-Type"] = "application/json";
69
95
  }
70
96
 
71
- if (wait_for_model) {
72
- headers["X-Wait-For-Model"] = "true";
73
- }
74
- if (use_cache === false) {
75
- headers["X-Use-Cache"] = "false";
76
- }
77
- if (dont_load_model) {
78
- headers["X-Load-Model"] = "0";
79
- }
80
-
81
- let url = (() => {
82
- if (endpointUrl && isUrl(model)) {
83
- throw new TypeError("Both model and endpointUrl cannot be URLs");
97
+ if (provider === "hf-inference") {
98
+ if (wait_for_model) {
99
+ headers["X-Wait-For-Model"] = "true";
84
100
  }
85
- if (isUrl(model)) {
86
- console.warn("Using a model URL is deprecated, please use the `endpointUrl` parameter instead");
87
- return model;
101
+ if (use_cache === false) {
102
+ headers["X-Use-Cache"] = "false";
88
103
  }
89
- if (endpointUrl) {
90
- return endpointUrl;
104
+ if (dont_load_model) {
105
+ headers["X-Load-Model"] = "0";
91
106
  }
92
- if (task) {
93
- return `${HF_INFERENCE_API_BASE_URL}/pipeline/${task}/${model}`;
94
- }
95
-
96
- return `${HF_INFERENCE_API_BASE_URL}/models/${model}`;
97
- })();
107
+ }
98
108
 
99
- if (chatCompletion && !url.endsWith("/chat/completions")) {
100
- url += "/v1/chat/completions";
109
+ if (provider === "replicate") {
110
+ headers["Prefer"] = "wait";
101
111
  }
102
112
 
103
113
  /**
@@ -110,17 +120,147 @@ export async function makeRequestOptions(
110
120
  credentials = "include";
111
121
  }
112
122
 
123
+ /*
124
+ * Versioned Replicate models in the format `owner/model:version` expect the version in the body
125
+ */
126
+ if (provider === "replicate" && model.includes(":")) {
127
+ const version = model.split(":")[1];
128
+ (otherArgs as typeof otherArgs & { version: string }).version = version;
129
+ }
130
+
113
131
  const info: RequestInit = {
114
132
  headers,
115
133
  method: "POST",
116
134
  body: binary
117
135
  ? args.data
118
136
  : JSON.stringify({
119
- ...(otherArgs.model && isUrl(otherArgs.model) ? omit(otherArgs, "model") : otherArgs),
137
+ ...otherArgs,
138
+ ...(chatCompletion || provider === "together" ? { model } : undefined),
120
139
  }),
121
- ...(credentials && { credentials }),
140
+ ...(credentials ? { credentials } : undefined),
122
141
  signal: options?.signal,
123
142
  };
124
143
 
125
144
  return { url, info };
126
145
  }
146
+
147
+ function mapModel(params: {
148
+ model: string;
149
+ provider: InferenceProvider;
150
+ taskHint: InferenceTask | undefined;
151
+ chatCompletion: boolean | undefined;
152
+ }): string {
153
+ if (params.provider === "hf-inference") {
154
+ return params.model;
155
+ }
156
+ if (!params.taskHint) {
157
+ throw new Error("taskHint must be specified when using a third-party provider");
158
+ }
159
+ const task: WidgetType =
160
+ params.taskHint === "text-generation" && params.chatCompletion ? "conversational" : params.taskHint;
161
+ const model = (() => {
162
+ switch (params.provider) {
163
+ case "fal-ai":
164
+ return FAL_AI_SUPPORTED_MODEL_IDS[task]?.[params.model];
165
+ case "replicate":
166
+ return REPLICATE_SUPPORTED_MODEL_IDS[task]?.[params.model];
167
+ case "sambanova":
168
+ return SAMBANOVA_SUPPORTED_MODEL_IDS[task]?.[params.model];
169
+ case "together":
170
+ return TOGETHER_SUPPORTED_MODEL_IDS[task]?.[params.model];
171
+ }
172
+ })();
173
+
174
+ if (!model) {
175
+ throw new Error(`Model ${params.model} is not supported for task ${task} and provider ${params.provider}`);
176
+ }
177
+ return model;
178
+ }
179
+
180
+ function makeUrl(params: {
181
+ authMethod: "none" | "hf-token" | "credentials-include" | "provider-key";
182
+ chatCompletion: boolean;
183
+ model: string;
184
+ provider: InferenceProvider;
185
+ taskHint: InferenceTask | undefined;
186
+ forceTask?: string | InferenceTask;
187
+ }): string {
188
+ if (params.authMethod === "none" && params.provider !== "hf-inference") {
189
+ throw new Error("Authentication is required when requesting a third-party provider. Please provide accessToken");
190
+ }
191
+
192
+ const shouldProxy = params.provider !== "hf-inference" && params.authMethod !== "provider-key";
193
+ switch (params.provider) {
194
+ case "fal-ai": {
195
+ const baseUrl = shouldProxy
196
+ ? HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", params.provider)
197
+ : FAL_AI_API_BASE_URL;
198
+ return `${baseUrl}/${params.model}`;
199
+ }
200
+ case "replicate": {
201
+ const baseUrl = shouldProxy
202
+ ? HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", params.provider)
203
+ : REPLICATE_API_BASE_URL;
204
+ if (params.model.includes(":")) {
205
+ /// Versioned model
206
+ return `${baseUrl}/v1/predictions`;
207
+ }
208
+ /// Evergreen / Canonical model
209
+ return `${baseUrl}/v1/models/${params.model}/predictions`;
210
+ }
211
+ case "sambanova": {
212
+ const baseUrl = shouldProxy
213
+ ? HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", params.provider)
214
+ : SAMBANOVA_API_BASE_URL;
215
+ /// Sambanova API matches OpenAI-like APIs: model is defined in the request body
216
+ if (params.taskHint === "text-generation" && params.chatCompletion) {
217
+ return `${baseUrl}/v1/chat/completions`;
218
+ }
219
+ return baseUrl;
220
+ }
221
+ case "together": {
222
+ const baseUrl = shouldProxy
223
+ ? HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", params.provider)
224
+ : TOGETHER_API_BASE_URL;
225
+ /// Together API matches OpenAI-like APIs: model is defined in the request body
226
+ if (params.taskHint === "text-to-image") {
227
+ return `${baseUrl}/v1/images/generations`;
228
+ }
229
+ if (params.taskHint === "text-generation") {
230
+ if (params.chatCompletion) {
231
+ return `${baseUrl}/v1/chat/completions`;
232
+ }
233
+ return `${baseUrl}/v1/completions`;
234
+ }
235
+ return baseUrl;
236
+ }
237
+ default: {
238
+ const url = params.forceTask
239
+ ? `${HF_INFERENCE_API_URL}/pipeline/${params.forceTask}/${params.model}`
240
+ : `${HF_INFERENCE_API_URL}/models/${params.model}`;
241
+ if (params.taskHint === "text-generation" && params.chatCompletion) {
242
+ return url + `/v1/chat/completions`;
243
+ }
244
+ return url;
245
+ }
246
+ }
247
+ }
248
+ async function loadDefaultModel(task: InferenceTask): Promise<string> {
249
+ if (!tasks) {
250
+ tasks = await loadTaskInfo();
251
+ }
252
+ const taskInfo = tasks[task];
253
+ if ((taskInfo?.models.length ?? 0) <= 0) {
254
+ throw new Error(`No default model defined for task ${task}, please define the model explicitly.`);
255
+ }
256
+ return taskInfo.models[0].id;
257
+ }
258
+
259
+ async function loadTaskInfo(): Promise<Record<string, { models: { id: string }[] }>> {
260
+ const res = await fetch(`${HF_HUB_URL}/api/tasks`);
261
+
262
+ if (!res.ok) {
263
+ throw new Error("Failed to load tasks definitions from Hugging Face Hub.");
264
+ }
265
+ return await res.json();
266
+ }
@@ -0,0 +1,15 @@
1
+ import type { ProviderMapping } from "./types";
2
+
3
+ export const FAL_AI_API_BASE_URL = "https://fal.run";
4
+
5
+ type FalAiId = string;
6
+
7
+ export const FAL_AI_SUPPORTED_MODEL_IDS: ProviderMapping<FalAiId> = {
8
+ "text-to-image": {
9
+ "black-forest-labs/FLUX.1-schnell": "fal-ai/flux/schnell",
10
+ "black-forest-labs/FLUX.1-dev": "fal-ai/flux/dev",
11
+ },
12
+ "automatic-speech-recognition": {
13
+ "openai/whisper-large-v3": "fal-ai/whisper",
14
+ },
15
+ };
@@ -0,0 +1,16 @@
1
+ import type { ProviderMapping } from "./types";
2
+
3
+ export const REPLICATE_API_BASE_URL = "https://api.replicate.com";
4
+
5
+ type ReplicateId = string;
6
+
7
+ export const REPLICATE_SUPPORTED_MODEL_IDS: ProviderMapping<ReplicateId> = {
8
+ "text-to-image": {
9
+ "black-forest-labs/FLUX.1-schnell": "black-forest-labs/flux-schnell",
10
+ "ByteDance/SDXL-Lightning":
11
+ "bytedance/sdxl-lightning-4step:5599ed30703defd1d160a25a63321b4dec97101d98b4674bcc56e41f62f35637",
12
+ },
13
+ // "text-to-speech": {
14
+ // "SWivid/F5-TTS": "x-lance/f5-tts:87faf6dd7a692dd82043f662e76369cab126a2cf1937e25a9d41e0b834fd230e"
15
+ // },
16
+ };
@@ -0,0 +1,23 @@
1
+ import type { ProviderMapping } from "./types";
2
+
3
+ export const SAMBANOVA_API_BASE_URL = "https://api.sambanova.ai";
4
+
5
+ type SambanovaId = string;
6
+
7
+ export const SAMBANOVA_SUPPORTED_MODEL_IDS: ProviderMapping<SambanovaId> = {
8
+ /** Chat completion / conversational */
9
+ conversational: {
10
+ "Qwen/Qwen2.5-Coder-32B-Instruct": "Qwen2.5-Coder-32B-Instruct",
11
+ "Qwen/Qwen2.5-72B-Instruct": "Qwen2.5-72B-Instruct",
12
+ "Qwen/QwQ-32B-Preview": "QwQ-32B-Preview",
13
+ "meta-llama/Llama-3.3-70B-Instruct": "Meta-Llama-3.3-70B-Instruct",
14
+ "meta-llama/Llama-3.2-1B-Instruct": "Meta-Llama-3.2-1B-Instruct",
15
+ "meta-llama/Llama-3.2-3B-Instruct": "Meta-Llama-3.2-3B-Instruct",
16
+ "meta-llama/Llama-3.2-11B-Vision-Instruct": "Llama-3.2-11B-Vision-Instruct",
17
+ "meta-llama/Llama-3.2-90B-Vision-Instruct": "Llama-3.2-90B-Vision-Instruct",
18
+ "meta-llama/Llama-3.1-8B-Instruct": "Meta-Llama-3.1-8B-Instruct",
19
+ "meta-llama/Llama-3.1-70B-Instruct": "Meta-Llama-3.1-70B-Instruct",
20
+ "meta-llama/Llama-3.1-405B-Instruct": "Meta-Llama-3.1-405B-Instruct",
21
+ "meta-llama/Llama-Guard-3-8B": "Meta-Llama-Guard-3-8B",
22
+ },
23
+ };