@huggingface/inference 4.6.0 → 4.7.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.
- package/README.md +2 -0
- package/dist/commonjs/lib/getProviderHelper.d.ts.map +1 -1
- package/dist/commonjs/lib/getProviderHelper.js +7 -0
- package/dist/commonjs/package.d.ts +1 -1
- package/dist/commonjs/package.js +1 -1
- package/dist/commonjs/providers/consts.d.ts.map +1 -1
- package/dist/commonjs/providers/consts.js +1 -0
- package/dist/commonjs/providers/fal-ai.d.ts +14 -2
- package/dist/commonjs/providers/fal-ai.d.ts.map +1 -1
- package/dist/commonjs/providers/fal-ai.js +49 -1
- package/dist/commonjs/providers/scaleway.d.ts +41 -0
- package/dist/commonjs/providers/scaleway.d.ts.map +1 -0
- package/dist/commonjs/providers/scaleway.js +62 -0
- package/dist/commonjs/types.d.ts +2 -2
- package/dist/commonjs/types.d.ts.map +1 -1
- package/dist/commonjs/types.js +1 -0
- package/dist/esm/lib/getProviderHelper.d.ts.map +1 -1
- package/dist/esm/lib/getProviderHelper.js +7 -0
- package/dist/esm/package.d.ts +1 -1
- package/dist/esm/package.js +1 -1
- package/dist/esm/providers/consts.d.ts.map +1 -1
- package/dist/esm/providers/consts.js +1 -0
- package/dist/esm/providers/fal-ai.d.ts +14 -2
- package/dist/esm/providers/fal-ai.d.ts.map +1 -1
- package/dist/esm/providers/fal-ai.js +47 -0
- package/dist/esm/providers/scaleway.d.ts +41 -0
- package/dist/esm/providers/scaleway.d.ts.map +1 -0
- package/dist/esm/providers/scaleway.js +56 -0
- package/dist/esm/types.d.ts +2 -2
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +1 -0
- package/package.json +2 -2
- package/src/lib/getProviderHelper.ts +7 -0
- package/src/package.ts +1 -1
- package/src/providers/consts.ts +1 -0
- package/src/providers/fal-ai.ts +69 -1
- package/src/providers/scaleway.ts +95 -0
- package/src/types.ts +1 -0
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ Currently, we support the following providers:
|
|
|
58
58
|
- [OVHcloud](https://endpoints.ai.cloud.ovh.net/)
|
|
59
59
|
- [Replicate](https://replicate.com)
|
|
60
60
|
- [Sambanova](https://sambanova.ai)
|
|
61
|
+
- [Scaleway](https://www.scaleway.com/en/generative-apis/)
|
|
61
62
|
- [Together](https://together.xyz)
|
|
62
63
|
- [Blackforestlabs](https://blackforestlabs.ai)
|
|
63
64
|
- [Cohere](https://cohere.com)
|
|
@@ -92,6 +93,7 @@ Only a subset of models are supported when requesting third-party providers. You
|
|
|
92
93
|
- [OVHcloud supported models](https://huggingface.co/api/partners/ovhcloud/models)
|
|
93
94
|
- [Replicate supported models](https://huggingface.co/api/partners/replicate/models)
|
|
94
95
|
- [Sambanova supported models](https://huggingface.co/api/partners/sambanova/models)
|
|
96
|
+
- [Scaleway supported models](https://huggingface.co/api/partners/scaleway/models)
|
|
95
97
|
- [Together supported models](https://huggingface.co/api/partners/together/models)
|
|
96
98
|
- [Cohere supported models](https://huggingface.co/api/partners/cohere/models)
|
|
97
99
|
- [Cerebras supported models](https://huggingface.co/api/partners/cerebras/models)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProviderHelper.d.ts","sourceRoot":"","sources":["../../../src/lib/getProviderHelper.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACX,6BAA6B,EAC7B,sBAAsB,EACtB,oCAAoC,EACpC,wBAAwB,EACxB,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,6BAA6B,EAC7B,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,uBAAuB,EACvB,gCAAgC,EAChC,+BAA+B,EAC/B,2BAA2B,EAC3B,kBAAkB,EAClB,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,qBAAqB,EACrB,iCAAiC,EACjC,gCAAgC,EAChC,qCAAqC,EACrC,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"getProviderHelper.d.ts","sourceRoot":"","sources":["../../../src/lib/getProviderHelper.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACX,6BAA6B,EAC7B,sBAAsB,EACtB,oCAAoC,EACpC,wBAAwB,EACxB,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,6BAA6B,EAC7B,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,uBAAuB,EACvB,gCAAgC,EAChC,+BAA+B,EAC/B,2BAA2B,EAC3B,kBAAkB,EAClB,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,qBAAqB,EACrB,iCAAiC,EACjC,gCAAgC,EAChC,qCAAqC,EACrC,MAAM,gCAAgC,CAAC;AAKxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG/F,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC,CA2GnG,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,eAAe,GACnB,qBAAqB,GAAG,kBAAkB,CAAC;AAC9C,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,gBAAgB,GACpB,wBAAwB,GAAG,kBAAkB,CAAC;AACjD,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,iBAAiB,GACrB,wBAAwB,GAAG,kB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AG,kBAAkB,CAAC;AACxD,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,oBAAoB,GACxB,2BAA2B,GAAG,kBAAkB,CAAC;AACpD,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,sBAAsB,GAC1B,6BAA6B,GAAG,kBAAkB,CAAC;AACtD,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,aAAa,GACjB,qBAAqB,GAAG,kBAAkB,CAAC;AAC9C,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,eAAe,GACnB,uBAAuB,GAAG,kBAAkB,CAAC;AAChD,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,2BAA2B,GAC/B,iCAAiC,GAAG,kBAAkB,CAAC;AAC1D,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,aAAa,GAAG,SAAS,GAC7B,kBAAkB,CAAC"}
|
|
@@ -51,6 +51,7 @@ const OpenAI = __importStar(require("../providers/openai.js"));
|
|
|
51
51
|
const OvhCloud = __importStar(require("../providers/ovhcloud.js"));
|
|
52
52
|
const Replicate = __importStar(require("../providers/replicate.js"));
|
|
53
53
|
const Sambanova = __importStar(require("../providers/sambanova.js"));
|
|
54
|
+
const Scaleway = __importStar(require("../providers/scaleway.js"));
|
|
54
55
|
const Together = __importStar(require("../providers/together.js"));
|
|
55
56
|
const errors_js_1 = require("../errors.js");
|
|
56
57
|
exports.PROVIDERS = {
|
|
@@ -70,6 +71,7 @@ exports.PROVIDERS = {
|
|
|
70
71
|
"image-to-image": new FalAI.FalAIImageToImageTask(),
|
|
71
72
|
"automatic-speech-recognition": new FalAI.FalAIAutomaticSpeechRecognitionTask(),
|
|
72
73
|
"image-segmentation": new FalAI.FalAIImageSegmentationTask(),
|
|
74
|
+
"image-to-video": new FalAI.FalAIImageToVideoTask(),
|
|
73
75
|
},
|
|
74
76
|
"featherless-ai": {
|
|
75
77
|
conversational: new FeatherlessAI.FeatherlessAIConversationalTask(),
|
|
@@ -149,6 +151,11 @@ exports.PROVIDERS = {
|
|
|
149
151
|
conversational: new Sambanova.SambanovaConversationalTask(),
|
|
150
152
|
"feature-extraction": new Sambanova.SambanovaFeatureExtractionTask(),
|
|
151
153
|
},
|
|
154
|
+
scaleway: {
|
|
155
|
+
conversational: new Scaleway.ScalewayConversationalTask(),
|
|
156
|
+
"text-generation": new Scaleway.ScalewayTextGenerationTask(),
|
|
157
|
+
"feature-extraction": new Scaleway.ScalewayFeatureExtractionTask(),
|
|
158
|
+
},
|
|
152
159
|
together: {
|
|
153
160
|
"text-to-image": new Together.TogetherTextToImageTask(),
|
|
154
161
|
conversational: new Together.TogetherConversationalTask(),
|
package/dist/commonjs/package.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PACKAGE_NAME = exports.PACKAGE_VERSION = void 0;
|
|
4
4
|
// Generated file from package.json. Issues importing JSON directly when publishing on commonjs/ESM - see https://github.com/microsoft/TypeScript/issues/51783
|
|
5
|
-
exports.PACKAGE_VERSION = "4.
|
|
5
|
+
exports.PACKAGE_VERSION = "4.7.0";
|
|
6
6
|
exports.PACKAGE_NAME = "@huggingface/inference";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/providers/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CACrD,iBAAiB,EACjB,MAAM,CAAC,OAAO,EAAE,6BAA6B,CAAC,
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/providers/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CACrD,iBAAiB,EACjB,MAAM,CAAC,OAAO,EAAE,6BAA6B,CAAC,CA0B9C,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AutomaticSpeechRecognitionOutput, ImageSegmentationOutput } from "@huggingface/tasks";
|
|
2
2
|
import type { BodyParams, HeaderParams, InferenceTask, RequestArgs, UrlParams } from "../types.js";
|
|
3
3
|
import type { ImageSegmentationTaskHelper, ImageToImageTaskHelper } from "./providerHelper.js";
|
|
4
|
-
import { type AutomaticSpeechRecognitionTaskHelper, TaskProviderHelper, type TextToImageTaskHelper, type TextToVideoTaskHelper } from "./providerHelper.js";
|
|
4
|
+
import { type AutomaticSpeechRecognitionTaskHelper, TaskProviderHelper, type TextToImageTaskHelper, type TextToVideoTaskHelper, type ImageToVideoTaskHelper } from "./providerHelper.js";
|
|
5
5
|
import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition.js";
|
|
6
|
-
import type { ImageToImageArgs } from "../tasks/index.js";
|
|
6
|
+
import type { ImageToImageArgs, ImageToVideoArgs } from "../tasks/index.js";
|
|
7
7
|
import type { ImageSegmentationArgs } from "../tasks/cv/imageSegmentation.js";
|
|
8
8
|
export interface FalAiQueueOutput {
|
|
9
9
|
request_id: string;
|
|
@@ -45,6 +45,18 @@ export declare class FalAITextToVideoTask extends FalAiQueueTask implements Text
|
|
|
45
45
|
preparePayload(params: BodyParams): Record<string, unknown>;
|
|
46
46
|
getResponse(response: FalAiQueueOutput, url?: string, headers?: Record<string, string>): Promise<Blob>;
|
|
47
47
|
}
|
|
48
|
+
export declare class FalAIImageToVideoTask extends FalAiQueueTask implements ImageToVideoTaskHelper {
|
|
49
|
+
task: InferenceTask;
|
|
50
|
+
constructor();
|
|
51
|
+
/** Same queue routing rule as the other Fal queue tasks */
|
|
52
|
+
makeRoute(params: UrlParams): string;
|
|
53
|
+
/** Synchronous case – caller already gave us base64 or a URL */
|
|
54
|
+
preparePayload(params: BodyParams): Record<string, unknown>;
|
|
55
|
+
/** Asynchronous helper – caller gave us a Blob */
|
|
56
|
+
preparePayloadAsync(args: ImageToVideoArgs): Promise<RequestArgs>;
|
|
57
|
+
/** Queue polling + final download – mirrors Text‑to‑Video */
|
|
58
|
+
getResponse(response: FalAiQueueOutput, url?: string, headers?: Record<string, string>): Promise<Blob>;
|
|
59
|
+
}
|
|
48
60
|
export declare class FalAIAutomaticSpeechRecognitionTask extends FalAITask implements AutomaticSpeechRecognitionTaskHelper {
|
|
49
61
|
prepareHeaders(params: HeaderParams, binary: boolean): Record<string, string>;
|
|
50
62
|
getResponse(response: unknown): Promise<AutomaticSpeechRecognitionOutput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fal-ai.d.ts","sourceRoot":"","sources":["../../../src/providers/fal-ai.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,gCAAgC,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAEpG,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAW,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG5G,OAAO,KAAK,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EACN,KAAK,oCAAoC,EACzC,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAMnG,OAAO,KAAK,EAAE,gB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AE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAmC5D;AACD,qBAAa,0BAA2B,SAAQ,cAAe,YAAW,2BAA2B;IACpG,IAAI,EAAE,aAAa,CAAC;;IAMX,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAOpC,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQ9D,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAe7D,WAAW,CACzB,QAAQ,EAAE,gBAAgB,EAC1B,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,uBAAuB,CAAC;CA0CnC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FalAIImageSegmentationTask = exports.FalAITextToSpeechTask = exports.FalAIAutomaticSpeechRecognitionTask = exports.FalAITextToVideoTask = exports.FalAIImageToImageTask = exports.FalAITextToImageTask = exports.FAL_AI_SUPPORTED_BLOB_TYPES = void 0;
|
|
3
|
+
exports.FalAIImageSegmentationTask = exports.FalAITextToSpeechTask = exports.FalAIAutomaticSpeechRecognitionTask = exports.FalAIImageToVideoTask = exports.FalAITextToVideoTask = exports.FalAIImageToImageTask = exports.FalAITextToImageTask = exports.FAL_AI_SUPPORTED_BLOB_TYPES = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* See the registered mapping of HF model ID => Fal model ID here:
|
|
6
6
|
*
|
|
@@ -227,6 +227,54 @@ class FalAITextToVideoTask extends FalAiQueueTask {
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
exports.FalAITextToVideoTask = FalAITextToVideoTask;
|
|
230
|
+
class FalAIImageToVideoTask extends FalAiQueueTask {
|
|
231
|
+
task;
|
|
232
|
+
constructor() {
|
|
233
|
+
super("https://queue.fal.run");
|
|
234
|
+
this.task = "image-to-video";
|
|
235
|
+
}
|
|
236
|
+
/** Same queue routing rule as the other Fal queue tasks */
|
|
237
|
+
makeRoute(params) {
|
|
238
|
+
return params.authMethod !== "provider-key" ? `/${params.model}?_subdomain=queue` : `/${params.model}`;
|
|
239
|
+
}
|
|
240
|
+
/** Synchronous case – caller already gave us base64 or a URL */
|
|
241
|
+
preparePayload(params) {
|
|
242
|
+
return {
|
|
243
|
+
...(0, omit_js_1.omit)(params.args, ["inputs", "parameters"]),
|
|
244
|
+
...params.args.parameters,
|
|
245
|
+
// args.inputs is expected to be a base64 data URI or an URL
|
|
246
|
+
image_url: params.args.image_url,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/** Asynchronous helper – caller gave us a Blob */
|
|
250
|
+
async preparePayloadAsync(args) {
|
|
251
|
+
const mimeType = args.inputs instanceof Blob ? args.inputs.type : "image/png";
|
|
252
|
+
return {
|
|
253
|
+
...(0, omit_js_1.omit)(args, ["inputs", "parameters"]),
|
|
254
|
+
image_url: `data:${mimeType};base64,${(0, base64FromBytes_js_1.base64FromBytes)(new Uint8Array(args.inputs instanceof ArrayBuffer ? args.inputs : await args.inputs.arrayBuffer()))}`,
|
|
255
|
+
...args.parameters,
|
|
256
|
+
...args,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
/** Queue polling + final download – mirrors Text‑to‑Video */
|
|
260
|
+
async getResponse(response, url, headers) {
|
|
261
|
+
const result = await this.getResponseFromQueueApi(response, url, headers);
|
|
262
|
+
if (typeof result === "object" &&
|
|
263
|
+
result !== null &&
|
|
264
|
+
"video" in result &&
|
|
265
|
+
typeof result.video === "object" &&
|
|
266
|
+
result.video !== null &&
|
|
267
|
+
"url" in result.video &&
|
|
268
|
+
typeof result.video.url === "string" &&
|
|
269
|
+
"url" in result.video &&
|
|
270
|
+
(0, isUrl_js_1.isUrl)(result.video.url)) {
|
|
271
|
+
const urlResponse = await fetch(result.video.url);
|
|
272
|
+
return await urlResponse.blob();
|
|
273
|
+
}
|
|
274
|
+
throw new errors_js_1.InferenceClientProviderOutputError(`Received malformed response from Fal.ai image‑to‑video API: expected { video: { url: string } }, got: ${JSON.stringify(result)}`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
exports.FalAIImageToVideoTask = FalAIImageToVideoTask;
|
|
230
278
|
class FalAIAutomaticSpeechRecognitionTask extends FalAITask {
|
|
231
279
|
prepareHeaders(params, binary) {
|
|
232
280
|
const headers = super.prepareHeaders(params, binary);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* See the registered mapping of HF model ID => Scaleway model ID here:
|
|
3
|
+
*
|
|
4
|
+
* https://huggingface.co/api/partners/scaleway/models
|
|
5
|
+
*
|
|
6
|
+
* This is a publicly available mapping.
|
|
7
|
+
*
|
|
8
|
+
* If you want to try to run inference for a new model locally before it's registered on huggingface.co,
|
|
9
|
+
* you can add it to the dictionary "HARDCODED_MODEL_ID_MAPPING" in consts.ts, for dev purposes.
|
|
10
|
+
*
|
|
11
|
+
* - If you work at Scaleway and want to update this mapping, please use the model mapping API we provide on huggingface.co
|
|
12
|
+
* - If you're a community member and want to add a new supported HF model to Scaleway, please open an issue on the present repo
|
|
13
|
+
* and we will tag Scaleway team members.
|
|
14
|
+
*
|
|
15
|
+
* Thanks!
|
|
16
|
+
*/
|
|
17
|
+
import type { FeatureExtractionOutput, TextGenerationOutput } from "@huggingface/tasks";
|
|
18
|
+
import type { BodyParams } from "../types.js";
|
|
19
|
+
import type { FeatureExtractionTaskHelper } from "./providerHelper.js";
|
|
20
|
+
import { BaseConversationalTask, TaskProviderHelper, BaseTextGenerationTask } from "./providerHelper.js";
|
|
21
|
+
interface ScalewayEmbeddingsResponse {
|
|
22
|
+
data: Array<{
|
|
23
|
+
embedding: number[];
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export declare class ScalewayConversationalTask extends BaseConversationalTask {
|
|
27
|
+
constructor();
|
|
28
|
+
}
|
|
29
|
+
export declare class ScalewayTextGenerationTask extends BaseTextGenerationTask {
|
|
30
|
+
constructor();
|
|
31
|
+
preparePayload(params: BodyParams): Record<string, unknown>;
|
|
32
|
+
getResponse(response: unknown): Promise<TextGenerationOutput>;
|
|
33
|
+
}
|
|
34
|
+
export declare class ScalewayFeatureExtractionTask extends TaskProviderHelper implements FeatureExtractionTaskHelper {
|
|
35
|
+
constructor();
|
|
36
|
+
preparePayload(params: BodyParams): Record<string, unknown>;
|
|
37
|
+
makeRoute(): string;
|
|
38
|
+
getResponse(response: ScalewayEmbeddingsResponse): Promise<FeatureExtractionOutput>;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=scaleway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaleway.d.ts","sourceRoot":"","sources":["../../../src/providers/scaleway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIzG,UAAU,0BAA0B;IACnC,IAAI,EAAE,KAAK,CAAC;QACX,SAAS,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC,CAAC;CACH;AAED,qBAAa,0BAA2B,SAAQ,sBAAsB;;CAIrE;AAED,qBAAa,0BAA2B,SAAQ,sBAAsB;;IAK5D,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQrD,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAuB5E;AAED,qBAAa,6BAA8B,SAAQ,kBAAmB,YAAW,2BAA2B;;IAK3G,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAO3D,SAAS,IAAI,MAAM;IAIb,WAAW,CAAC,QAAQ,EAAE,0BAA0B,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAGzF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScalewayFeatureExtractionTask = exports.ScalewayTextGenerationTask = exports.ScalewayConversationalTask = void 0;
|
|
4
|
+
const errors_js_1 = require("../errors.js");
|
|
5
|
+
const providerHelper_js_1 = require("./providerHelper.js");
|
|
6
|
+
const SCALEWAY_API_BASE_URL = "https://api.scaleway.ai";
|
|
7
|
+
class ScalewayConversationalTask extends providerHelper_js_1.BaseConversationalTask {
|
|
8
|
+
constructor() {
|
|
9
|
+
super("scaleway", SCALEWAY_API_BASE_URL);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.ScalewayConversationalTask = ScalewayConversationalTask;
|
|
13
|
+
class ScalewayTextGenerationTask extends providerHelper_js_1.BaseTextGenerationTask {
|
|
14
|
+
constructor() {
|
|
15
|
+
super("scaleway", SCALEWAY_API_BASE_URL);
|
|
16
|
+
}
|
|
17
|
+
preparePayload(params) {
|
|
18
|
+
return {
|
|
19
|
+
model: params.model,
|
|
20
|
+
...params.args,
|
|
21
|
+
prompt: params.args.inputs,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
async getResponse(response) {
|
|
25
|
+
if (typeof response === "object" &&
|
|
26
|
+
response !== null &&
|
|
27
|
+
"choices" in response &&
|
|
28
|
+
Array.isArray(response.choices) &&
|
|
29
|
+
response.choices.length > 0) {
|
|
30
|
+
const completion = response.choices[0];
|
|
31
|
+
if (typeof completion === "object" &&
|
|
32
|
+
!!completion &&
|
|
33
|
+
"text" in completion &&
|
|
34
|
+
completion.text &&
|
|
35
|
+
typeof completion.text === "string") {
|
|
36
|
+
return {
|
|
37
|
+
generated_text: completion.text,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
throw new errors_js_1.InferenceClientProviderOutputError("Received malformed response from Scaleway text generation API");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.ScalewayTextGenerationTask = ScalewayTextGenerationTask;
|
|
45
|
+
class ScalewayFeatureExtractionTask extends providerHelper_js_1.TaskProviderHelper {
|
|
46
|
+
constructor() {
|
|
47
|
+
super("scaleway", SCALEWAY_API_BASE_URL);
|
|
48
|
+
}
|
|
49
|
+
preparePayload(params) {
|
|
50
|
+
return {
|
|
51
|
+
input: params.args.inputs,
|
|
52
|
+
model: params.model,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
makeRoute() {
|
|
56
|
+
return "v1/embeddings";
|
|
57
|
+
}
|
|
58
|
+
async getResponse(response) {
|
|
59
|
+
return response.data.map((item) => item.embedding);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ScalewayFeatureExtractionTask = ScalewayFeatureExtractionTask;
|
package/dist/commonjs/types.d.ts
CHANGED
|
@@ -36,8 +36,8 @@ export interface Options {
|
|
|
36
36
|
billTo?: string;
|
|
37
37
|
}
|
|
38
38
|
export type InferenceTask = Exclude<PipelineType, "other"> | "conversational";
|
|
39
|
-
export declare const INFERENCE_PROVIDERS: readonly ["black-forest-labs", "cerebras", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "replicate", "sambanova", "together"];
|
|
40
|
-
export declare const PROVIDERS_OR_POLICIES: readonly ["black-forest-labs", "cerebras", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "replicate", "sambanova", "together", "auto"];
|
|
39
|
+
export declare const INFERENCE_PROVIDERS: readonly ["black-forest-labs", "cerebras", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "replicate", "sambanova", "scaleway", "together"];
|
|
40
|
+
export declare const PROVIDERS_OR_POLICIES: readonly ["black-forest-labs", "cerebras", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "replicate", "sambanova", "scaleway", "together", "auto"];
|
|
41
41
|
export type InferenceProvider = (typeof INFERENCE_PROVIDERS)[number];
|
|
42
42
|
export type InferenceProviderOrPolicy = (typeof PROVIDERS_OR_POLICIES)[number];
|
|
43
43
|
export interface InferenceProviderMappingEntry {
|
|
@@ -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,MAAM;IACtB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACrD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACrD,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,I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EAAE,OAAO,CAAA;CAAE,GACnB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACrB,mBAAmB,CACrB,GAAG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,qBAAqB,GAAG,cAAc,CAAC;AAEtF,MAAM,WAAW,YAAY;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtF,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,6BAA6B,GAAG,SAAS,CAAC;IACpD,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB"}
|
package/dist/commonjs/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProviderHelper.d.ts","sourceRoot":"","sources":["../../../src/lib/getProviderHelper.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACX,6BAA6B,EAC7B,sBAAsB,EACtB,oCAAoC,EACpC,wBAAwB,EACxB,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,6BAA6B,EAC7B,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,uBAAuB,EACvB,gCAAgC,EAChC,+BAA+B,EAC/B,2BAA2B,EAC3B,kBAAkB,EAClB,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,qBAAqB,EACrB,iCAAiC,EACjC,gCAAgC,EAChC,qCAAqC,EACrC,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"getProviderHelper.d.ts","sourceRoot":"","sources":["../../../src/lib/getProviderHelper.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACX,6BAA6B,EAC7B,sBAAsB,EACtB,oCAAoC,EACpC,wBAAwB,EACxB,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,6BAA6B,EAC7B,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,uBAAuB,EACvB,gCAAgC,EAChC,+BAA+B,EAC/B,2BAA2B,EAC3B,kBAAkB,EAClB,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,qBAAqB,EACrB,iCAAiC,EACjC,gCAAgC,EAChC,qCAAqC,EACrC,MAAM,gCAAgC,CAAC;AAKxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG/F,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC,CA2GnG,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,eAAe,GACnB,qBAAqB,GAAG,kBAAkB,CAAC;AAC9C,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI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AAI,EAAE,0BAA0B,GAC9B,gCAAgC,GAAG,kBAAkB,CAAC;AACzD,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,wBAAwB,GAC5B,+BAA+B,GAAG,kBAAkB,CAAC;AACxD,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,oBAAoB,GACxB,2BAA2B,GAAG,kBAAkB,CAAC;AACpD,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,sBAAsB,GAC1B,6BAA6B,GAAG,kBAAkB,CAAC;AACtD,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,aAAa,GACjB,qBAAqB,GAAG,kBAAkB,CAAC;AAC9C,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,eAAe,GACnB,uBAAuB,GAAG,kBAAkB,CAAC;AAChD,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,2BAA2B,GAC/B,iCAAiC,GAAG,kBAAkB,CAAC;AAC1D,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,aAAa,GAAG,SAAS,GAC7B,kBAAkB,CAAC"}
|
|
@@ -14,6 +14,7 @@ import * as OpenAI from "../providers/openai.js";
|
|
|
14
14
|
import * as OvhCloud from "../providers/ovhcloud.js";
|
|
15
15
|
import * as Replicate from "../providers/replicate.js";
|
|
16
16
|
import * as Sambanova from "../providers/sambanova.js";
|
|
17
|
+
import * as Scaleway from "../providers/scaleway.js";
|
|
17
18
|
import * as Together from "../providers/together.js";
|
|
18
19
|
import { InferenceClientInputError } from "../errors.js";
|
|
19
20
|
export const PROVIDERS = {
|
|
@@ -33,6 +34,7 @@ export const PROVIDERS = {
|
|
|
33
34
|
"image-to-image": new FalAI.FalAIImageToImageTask(),
|
|
34
35
|
"automatic-speech-recognition": new FalAI.FalAIAutomaticSpeechRecognitionTask(),
|
|
35
36
|
"image-segmentation": new FalAI.FalAIImageSegmentationTask(),
|
|
37
|
+
"image-to-video": new FalAI.FalAIImageToVideoTask(),
|
|
36
38
|
},
|
|
37
39
|
"featherless-ai": {
|
|
38
40
|
conversational: new FeatherlessAI.FeatherlessAIConversationalTask(),
|
|
@@ -112,6 +114,11 @@ export const PROVIDERS = {
|
|
|
112
114
|
conversational: new Sambanova.SambanovaConversationalTask(),
|
|
113
115
|
"feature-extraction": new Sambanova.SambanovaFeatureExtractionTask(),
|
|
114
116
|
},
|
|
117
|
+
scaleway: {
|
|
118
|
+
conversational: new Scaleway.ScalewayConversationalTask(),
|
|
119
|
+
"text-generation": new Scaleway.ScalewayTextGenerationTask(),
|
|
120
|
+
"feature-extraction": new Scaleway.ScalewayFeatureExtractionTask(),
|
|
121
|
+
},
|
|
115
122
|
together: {
|
|
116
123
|
"text-to-image": new Together.TogetherTextToImageTask(),
|
|
117
124
|
conversational: new Together.TogetherConversationalTask(),
|
package/dist/esm/package.d.ts
CHANGED
package/dist/esm/package.js
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.
|
|
2
|
+
export const PACKAGE_VERSION = "4.7.0";
|
|
3
3
|
export const PACKAGE_NAME = "@huggingface/inference";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/providers/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CACrD,iBAAiB,EACjB,MAAM,CAAC,OAAO,EAAE,6BAA6B,CAAC,
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/providers/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CACrD,iBAAiB,EACjB,MAAM,CAAC,OAAO,EAAE,6BAA6B,CAAC,CA0B9C,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AutomaticSpeechRecognitionOutput, ImageSegmentationOutput } from "@huggingface/tasks";
|
|
2
2
|
import type { BodyParams, HeaderParams, InferenceTask, RequestArgs, UrlParams } from "../types.js";
|
|
3
3
|
import type { ImageSegmentationTaskHelper, ImageToImageTaskHelper } from "./providerHelper.js";
|
|
4
|
-
import { type AutomaticSpeechRecognitionTaskHelper, TaskProviderHelper, type TextToImageTaskHelper, type TextToVideoTaskHelper } from "./providerHelper.js";
|
|
4
|
+
import { type AutomaticSpeechRecognitionTaskHelper, TaskProviderHelper, type TextToImageTaskHelper, type TextToVideoTaskHelper, type ImageToVideoTaskHelper } from "./providerHelper.js";
|
|
5
5
|
import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition.js";
|
|
6
|
-
import type { ImageToImageArgs } from "../tasks/index.js";
|
|
6
|
+
import type { ImageToImageArgs, ImageToVideoArgs } from "../tasks/index.js";
|
|
7
7
|
import type { ImageSegmentationArgs } from "../tasks/cv/imageSegmentation.js";
|
|
8
8
|
export interface FalAiQueueOutput {
|
|
9
9
|
request_id: string;
|
|
@@ -45,6 +45,18 @@ export declare class FalAITextToVideoTask extends FalAiQueueTask implements Text
|
|
|
45
45
|
preparePayload(params: BodyParams): Record<string, unknown>;
|
|
46
46
|
getResponse(response: FalAiQueueOutput, url?: string, headers?: Record<string, string>): Promise<Blob>;
|
|
47
47
|
}
|
|
48
|
+
export declare class FalAIImageToVideoTask extends FalAiQueueTask implements ImageToVideoTaskHelper {
|
|
49
|
+
task: InferenceTask;
|
|
50
|
+
constructor();
|
|
51
|
+
/** Same queue routing rule as the other Fal queue tasks */
|
|
52
|
+
makeRoute(params: UrlParams): string;
|
|
53
|
+
/** Synchronous case – caller already gave us base64 or a URL */
|
|
54
|
+
preparePayload(params: BodyParams): Record<string, unknown>;
|
|
55
|
+
/** Asynchronous helper – caller gave us a Blob */
|
|
56
|
+
preparePayloadAsync(args: ImageToVideoArgs): Promise<RequestArgs>;
|
|
57
|
+
/** Queue polling + final download – mirrors Text‑to‑Video */
|
|
58
|
+
getResponse(response: FalAiQueueOutput, url?: string, headers?: Record<string, string>): Promise<Blob>;
|
|
59
|
+
}
|
|
48
60
|
export declare class FalAIAutomaticSpeechRecognitionTask extends FalAITask implements AutomaticSpeechRecognitionTaskHelper {
|
|
49
61
|
prepareHeaders(params: HeaderParams, binary: boolean): Record<string, string>;
|
|
50
62
|
getResponse(response: unknown): Promise<AutomaticSpeechRecognitionOutput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fal-ai.d.ts","sourceRoot":"","sources":["../../../src/providers/fal-ai.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,gCAAgC,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAEpG,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAW,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG5G,OAAO,KAAK,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EACN,KAAK,oCAAoC,EACzC,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8C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AAO,CAAC;IAQrD,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAmC5D;AACD,qBAAa,0BAA2B,SAAQ,cAAe,YAAW,2BAA2B;IACpG,IAAI,EAAE,aAAa,CAAC;;IAMX,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAOpC,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQ9D,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAe7D,WAAW,CACzB,QAAQ,EAAE,gBAAgB,EAC1B,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,uBAAuB,CAAC;CA0CnC"}
|
|
@@ -221,6 +221,53 @@ export class FalAITextToVideoTask extends FalAiQueueTask {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
+
export class FalAIImageToVideoTask extends FalAiQueueTask {
|
|
225
|
+
task;
|
|
226
|
+
constructor() {
|
|
227
|
+
super("https://queue.fal.run");
|
|
228
|
+
this.task = "image-to-video";
|
|
229
|
+
}
|
|
230
|
+
/** Same queue routing rule as the other Fal queue tasks */
|
|
231
|
+
makeRoute(params) {
|
|
232
|
+
return params.authMethod !== "provider-key" ? `/${params.model}?_subdomain=queue` : `/${params.model}`;
|
|
233
|
+
}
|
|
234
|
+
/** Synchronous case – caller already gave us base64 or a URL */
|
|
235
|
+
preparePayload(params) {
|
|
236
|
+
return {
|
|
237
|
+
...omit(params.args, ["inputs", "parameters"]),
|
|
238
|
+
...params.args.parameters,
|
|
239
|
+
// args.inputs is expected to be a base64 data URI or an URL
|
|
240
|
+
image_url: params.args.image_url,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/** Asynchronous helper – caller gave us a Blob */
|
|
244
|
+
async preparePayloadAsync(args) {
|
|
245
|
+
const mimeType = args.inputs instanceof Blob ? args.inputs.type : "image/png";
|
|
246
|
+
return {
|
|
247
|
+
...omit(args, ["inputs", "parameters"]),
|
|
248
|
+
image_url: `data:${mimeType};base64,${base64FromBytes(new Uint8Array(args.inputs instanceof ArrayBuffer ? args.inputs : await args.inputs.arrayBuffer()))}`,
|
|
249
|
+
...args.parameters,
|
|
250
|
+
...args,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
/** Queue polling + final download – mirrors Text‑to‑Video */
|
|
254
|
+
async getResponse(response, url, headers) {
|
|
255
|
+
const result = await this.getResponseFromQueueApi(response, url, headers);
|
|
256
|
+
if (typeof result === "object" &&
|
|
257
|
+
result !== null &&
|
|
258
|
+
"video" in result &&
|
|
259
|
+
typeof result.video === "object" &&
|
|
260
|
+
result.video !== null &&
|
|
261
|
+
"url" in result.video &&
|
|
262
|
+
typeof result.video.url === "string" &&
|
|
263
|
+
"url" in result.video &&
|
|
264
|
+
isUrl(result.video.url)) {
|
|
265
|
+
const urlResponse = await fetch(result.video.url);
|
|
266
|
+
return await urlResponse.blob();
|
|
267
|
+
}
|
|
268
|
+
throw new InferenceClientProviderOutputError(`Received malformed response from Fal.ai image‑to‑video API: expected { video: { url: string } }, got: ${JSON.stringify(result)}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
224
271
|
export class FalAIAutomaticSpeechRecognitionTask extends FalAITask {
|
|
225
272
|
prepareHeaders(params, binary) {
|
|
226
273
|
const headers = super.prepareHeaders(params, binary);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* See the registered mapping of HF model ID => Scaleway model ID here:
|
|
3
|
+
*
|
|
4
|
+
* https://huggingface.co/api/partners/scaleway/models
|
|
5
|
+
*
|
|
6
|
+
* This is a publicly available mapping.
|
|
7
|
+
*
|
|
8
|
+
* If you want to try to run inference for a new model locally before it's registered on huggingface.co,
|
|
9
|
+
* you can add it to the dictionary "HARDCODED_MODEL_ID_MAPPING" in consts.ts, for dev purposes.
|
|
10
|
+
*
|
|
11
|
+
* - If you work at Scaleway and want to update this mapping, please use the model mapping API we provide on huggingface.co
|
|
12
|
+
* - If you're a community member and want to add a new supported HF model to Scaleway, please open an issue on the present repo
|
|
13
|
+
* and we will tag Scaleway team members.
|
|
14
|
+
*
|
|
15
|
+
* Thanks!
|
|
16
|
+
*/
|
|
17
|
+
import type { FeatureExtractionOutput, TextGenerationOutput } from "@huggingface/tasks";
|
|
18
|
+
import type { BodyParams } from "../types.js";
|
|
19
|
+
import type { FeatureExtractionTaskHelper } from "./providerHelper.js";
|
|
20
|
+
import { BaseConversationalTask, TaskProviderHelper, BaseTextGenerationTask } from "./providerHelper.js";
|
|
21
|
+
interface ScalewayEmbeddingsResponse {
|
|
22
|
+
data: Array<{
|
|
23
|
+
embedding: number[];
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export declare class ScalewayConversationalTask extends BaseConversationalTask {
|
|
27
|
+
constructor();
|
|
28
|
+
}
|
|
29
|
+
export declare class ScalewayTextGenerationTask extends BaseTextGenerationTask {
|
|
30
|
+
constructor();
|
|
31
|
+
preparePayload(params: BodyParams): Record<string, unknown>;
|
|
32
|
+
getResponse(response: unknown): Promise<TextGenerationOutput>;
|
|
33
|
+
}
|
|
34
|
+
export declare class ScalewayFeatureExtractionTask extends TaskProviderHelper implements FeatureExtractionTaskHelper {
|
|
35
|
+
constructor();
|
|
36
|
+
preparePayload(params: BodyParams): Record<string, unknown>;
|
|
37
|
+
makeRoute(): string;
|
|
38
|
+
getResponse(response: ScalewayEmbeddingsResponse): Promise<FeatureExtractionOutput>;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=scaleway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaleway.d.ts","sourceRoot":"","sources":["../../../src/providers/scaleway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIzG,UAAU,0BAA0B;IACnC,IAAI,EAAE,KAAK,CAAC;QACX,SAAS,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC,CAAC;CACH;AAED,qBAAa,0BAA2B,SAAQ,sBAAsB;;CAIrE;AAED,qBAAa,0BAA2B,SAAQ,sBAAsB;;IAK5D,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQrD,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAuB5E;AAED,qBAAa,6BAA8B,SAAQ,kBAAmB,YAAW,2BAA2B;;IAK3G,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAO3D,SAAS,IAAI,MAAM;IAIb,WAAW,CAAC,QAAQ,EAAE,0BAA0B,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAGzF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { InferenceClientProviderOutputError } from "../errors.js";
|
|
2
|
+
import { BaseConversationalTask, TaskProviderHelper, BaseTextGenerationTask } from "./providerHelper.js";
|
|
3
|
+
const SCALEWAY_API_BASE_URL = "https://api.scaleway.ai";
|
|
4
|
+
export class ScalewayConversationalTask extends BaseConversationalTask {
|
|
5
|
+
constructor() {
|
|
6
|
+
super("scaleway", SCALEWAY_API_BASE_URL);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class ScalewayTextGenerationTask extends BaseTextGenerationTask {
|
|
10
|
+
constructor() {
|
|
11
|
+
super("scaleway", SCALEWAY_API_BASE_URL);
|
|
12
|
+
}
|
|
13
|
+
preparePayload(params) {
|
|
14
|
+
return {
|
|
15
|
+
model: params.model,
|
|
16
|
+
...params.args,
|
|
17
|
+
prompt: params.args.inputs,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
async getResponse(response) {
|
|
21
|
+
if (typeof response === "object" &&
|
|
22
|
+
response !== null &&
|
|
23
|
+
"choices" in response &&
|
|
24
|
+
Array.isArray(response.choices) &&
|
|
25
|
+
response.choices.length > 0) {
|
|
26
|
+
const completion = response.choices[0];
|
|
27
|
+
if (typeof completion === "object" &&
|
|
28
|
+
!!completion &&
|
|
29
|
+
"text" in completion &&
|
|
30
|
+
completion.text &&
|
|
31
|
+
typeof completion.text === "string") {
|
|
32
|
+
return {
|
|
33
|
+
generated_text: completion.text,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
throw new InferenceClientProviderOutputError("Received malformed response from Scaleway text generation API");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export class ScalewayFeatureExtractionTask extends TaskProviderHelper {
|
|
41
|
+
constructor() {
|
|
42
|
+
super("scaleway", SCALEWAY_API_BASE_URL);
|
|
43
|
+
}
|
|
44
|
+
preparePayload(params) {
|
|
45
|
+
return {
|
|
46
|
+
input: params.args.inputs,
|
|
47
|
+
model: params.model,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
makeRoute() {
|
|
51
|
+
return "v1/embeddings";
|
|
52
|
+
}
|
|
53
|
+
async getResponse(response) {
|
|
54
|
+
return response.data.map((item) => item.embedding);
|
|
55
|
+
}
|
|
56
|
+
}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -36,8 +36,8 @@ export interface Options {
|
|
|
36
36
|
billTo?: string;
|
|
37
37
|
}
|
|
38
38
|
export type InferenceTask = Exclude<PipelineType, "other"> | "conversational";
|
|
39
|
-
export declare const INFERENCE_PROVIDERS: readonly ["black-forest-labs", "cerebras", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "replicate", "sambanova", "together"];
|
|
40
|
-
export declare const PROVIDERS_OR_POLICIES: readonly ["black-forest-labs", "cerebras", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "replicate", "sambanova", "together", "auto"];
|
|
39
|
+
export declare const INFERENCE_PROVIDERS: readonly ["black-forest-labs", "cerebras", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "replicate", "sambanova", "scaleway", "together"];
|
|
40
|
+
export declare const PROVIDERS_OR_POLICIES: readonly ["black-forest-labs", "cerebras", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "replicate", "sambanova", "scaleway", "together", "auto"];
|
|
41
41
|
export type InferenceProvider = (typeof INFERENCE_PROVIDERS)[number];
|
|
42
42
|
export type InferenceProviderOrPolicy = (typeof PROVIDERS_OR_POLICIES)[number];
|
|
43
43
|
export interface InferenceProviderMappingEntry {
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -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,MAAM;IACtB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACrD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,E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|
{
|
|
2
2
|
"name": "@huggingface/inference",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.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",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"type": "module",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@huggingface/jinja": "^0.5.1",
|
|
44
|
-
"@huggingface/tasks": "^0.19.
|
|
44
|
+
"@huggingface/tasks": "^0.19.35"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "18.13.0"
|
|
@@ -47,6 +47,7 @@ import type {
|
|
|
47
47
|
} from "../providers/providerHelper.js";
|
|
48
48
|
import * as Replicate from "../providers/replicate.js";
|
|
49
49
|
import * as Sambanova from "../providers/sambanova.js";
|
|
50
|
+
import * as Scaleway from "../providers/scaleway.js";
|
|
50
51
|
import * as Together from "../providers/together.js";
|
|
51
52
|
import type { InferenceProvider, InferenceProviderOrPolicy, InferenceTask } from "../types.js";
|
|
52
53
|
import { InferenceClientInputError } from "../errors.js";
|
|
@@ -68,6 +69,7 @@ export const PROVIDERS: Record<InferenceProvider, Partial<Record<InferenceTask,
|
|
|
68
69
|
"image-to-image": new FalAI.FalAIImageToImageTask(),
|
|
69
70
|
"automatic-speech-recognition": new FalAI.FalAIAutomaticSpeechRecognitionTask(),
|
|
70
71
|
"image-segmentation": new FalAI.FalAIImageSegmentationTask(),
|
|
72
|
+
"image-to-video": new FalAI.FalAIImageToVideoTask(),
|
|
71
73
|
},
|
|
72
74
|
"featherless-ai": {
|
|
73
75
|
conversational: new FeatherlessAI.FeatherlessAIConversationalTask(),
|
|
@@ -147,6 +149,11 @@ export const PROVIDERS: Record<InferenceProvider, Partial<Record<InferenceTask,
|
|
|
147
149
|
conversational: new Sambanova.SambanovaConversationalTask(),
|
|
148
150
|
"feature-extraction": new Sambanova.SambanovaFeatureExtractionTask(),
|
|
149
151
|
},
|
|
152
|
+
scaleway: {
|
|
153
|
+
conversational: new Scaleway.ScalewayConversationalTask(),
|
|
154
|
+
"text-generation": new Scaleway.ScalewayTextGenerationTask(),
|
|
155
|
+
"feature-extraction": new Scaleway.ScalewayFeatureExtractionTask(),
|
|
156
|
+
},
|
|
150
157
|
together: {
|
|
151
158
|
"text-to-image": new Together.TogetherTextToImageTask(),
|
|
152
159
|
conversational: new Together.TogetherConversationalTask(),
|
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.
|
|
2
|
+
export const PACKAGE_VERSION = "4.7.0";
|
|
3
3
|
export const PACKAGE_NAME = "@huggingface/inference";
|
package/src/providers/consts.ts
CHANGED
package/src/providers/fal-ai.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
TaskProviderHelper,
|
|
28
28
|
type TextToImageTaskHelper,
|
|
29
29
|
type TextToVideoTaskHelper,
|
|
30
|
+
type ImageToVideoTaskHelper,
|
|
30
31
|
} from "./providerHelper.js";
|
|
31
32
|
import { HF_HUB_URL } from "../config.js";
|
|
32
33
|
import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition.js";
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
InferenceClientProviderApiError,
|
|
36
37
|
InferenceClientProviderOutputError,
|
|
37
38
|
} from "../errors.js";
|
|
38
|
-
import type { ImageToImageArgs } from "../tasks/index.js";
|
|
39
|
+
import type { ImageToImageArgs, ImageToVideoArgs } from "../tasks/index.js";
|
|
39
40
|
import type { ImageSegmentationArgs } from "../tasks/cv/imageSegmentation.js";
|
|
40
41
|
|
|
41
42
|
export interface FalAiQueueOutput {
|
|
@@ -329,6 +330,73 @@ export class FalAITextToVideoTask extends FalAiQueueTask implements TextToVideoT
|
|
|
329
330
|
}
|
|
330
331
|
}
|
|
331
332
|
|
|
333
|
+
export class FalAIImageToVideoTask extends FalAiQueueTask implements ImageToVideoTaskHelper {
|
|
334
|
+
task: InferenceTask;
|
|
335
|
+
|
|
336
|
+
constructor() {
|
|
337
|
+
super("https://queue.fal.run");
|
|
338
|
+
this.task = "image-to-video";
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** Same queue routing rule as the other Fal queue tasks */
|
|
342
|
+
override makeRoute(params: UrlParams): string {
|
|
343
|
+
return params.authMethod !== "provider-key" ? `/${params.model}?_subdomain=queue` : `/${params.model}`;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** Synchronous case – caller already gave us base64 or a URL */
|
|
347
|
+
override preparePayload(params: BodyParams): Record<string, unknown> {
|
|
348
|
+
return {
|
|
349
|
+
...omit(params.args, ["inputs", "parameters"]),
|
|
350
|
+
...(params.args.parameters as Record<string, unknown>),
|
|
351
|
+
// args.inputs is expected to be a base64 data URI or an URL
|
|
352
|
+
image_url: params.args.image_url,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/** Asynchronous helper – caller gave us a Blob */
|
|
357
|
+
async preparePayloadAsync(args: ImageToVideoArgs): Promise<RequestArgs> {
|
|
358
|
+
const mimeType = args.inputs instanceof Blob ? args.inputs.type : "image/png";
|
|
359
|
+
return {
|
|
360
|
+
...omit(args, ["inputs", "parameters"]),
|
|
361
|
+
image_url: `data:${mimeType};base64,${base64FromBytes(
|
|
362
|
+
new Uint8Array(args.inputs instanceof ArrayBuffer ? args.inputs : await (args.inputs as Blob).arrayBuffer())
|
|
363
|
+
)}`,
|
|
364
|
+
...args.parameters,
|
|
365
|
+
...args,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** Queue polling + final download – mirrors Text‑to‑Video */
|
|
370
|
+
override async getResponse(
|
|
371
|
+
response: FalAiQueueOutput,
|
|
372
|
+
url?: string,
|
|
373
|
+
headers?: Record<string, string>
|
|
374
|
+
): Promise<Blob> {
|
|
375
|
+
const result = await this.getResponseFromQueueApi(response, url, headers);
|
|
376
|
+
|
|
377
|
+
if (
|
|
378
|
+
typeof result === "object" &&
|
|
379
|
+
result !== null &&
|
|
380
|
+
"video" in result &&
|
|
381
|
+
typeof result.video === "object" &&
|
|
382
|
+
result.video !== null &&
|
|
383
|
+
"url" in result.video &&
|
|
384
|
+
typeof result.video.url === "string" &&
|
|
385
|
+
"url" in result.video &&
|
|
386
|
+
isUrl(result.video.url)
|
|
387
|
+
) {
|
|
388
|
+
const urlResponse = await fetch(result.video.url);
|
|
389
|
+
return await urlResponse.blob();
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
throw new InferenceClientProviderOutputError(
|
|
393
|
+
`Received malformed response from Fal.ai image‑to‑video API: expected { video: { url: string } }, got: ${JSON.stringify(
|
|
394
|
+
result
|
|
395
|
+
)}`
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
332
400
|
export class FalAIAutomaticSpeechRecognitionTask extends FalAITask implements AutomaticSpeechRecognitionTaskHelper {
|
|
333
401
|
override prepareHeaders(params: HeaderParams, binary: boolean): Record<string, string> {
|
|
334
402
|
const headers = super.prepareHeaders(params, binary);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* See the registered mapping of HF model ID => Scaleway model ID here:
|
|
3
|
+
*
|
|
4
|
+
* https://huggingface.co/api/partners/scaleway/models
|
|
5
|
+
*
|
|
6
|
+
* This is a publicly available mapping.
|
|
7
|
+
*
|
|
8
|
+
* If you want to try to run inference for a new model locally before it's registered on huggingface.co,
|
|
9
|
+
* you can add it to the dictionary "HARDCODED_MODEL_ID_MAPPING" in consts.ts, for dev purposes.
|
|
10
|
+
*
|
|
11
|
+
* - If you work at Scaleway and want to update this mapping, please use the model mapping API we provide on huggingface.co
|
|
12
|
+
* - If you're a community member and want to add a new supported HF model to Scaleway, please open an issue on the present repo
|
|
13
|
+
* and we will tag Scaleway team members.
|
|
14
|
+
*
|
|
15
|
+
* Thanks!
|
|
16
|
+
*/
|
|
17
|
+
import type { FeatureExtractionOutput, TextGenerationOutput } from "@huggingface/tasks";
|
|
18
|
+
import type { BodyParams } from "../types.js";
|
|
19
|
+
import { InferenceClientProviderOutputError } from "../errors.js";
|
|
20
|
+
|
|
21
|
+
import type { FeatureExtractionTaskHelper } from "./providerHelper.js";
|
|
22
|
+
import { BaseConversationalTask, TaskProviderHelper, BaseTextGenerationTask } from "./providerHelper.js";
|
|
23
|
+
|
|
24
|
+
const SCALEWAY_API_BASE_URL = "https://api.scaleway.ai";
|
|
25
|
+
|
|
26
|
+
interface ScalewayEmbeddingsResponse {
|
|
27
|
+
data: Array<{
|
|
28
|
+
embedding: number[];
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class ScalewayConversationalTask extends BaseConversationalTask {
|
|
33
|
+
constructor() {
|
|
34
|
+
super("scaleway", SCALEWAY_API_BASE_URL);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class ScalewayTextGenerationTask extends BaseTextGenerationTask {
|
|
39
|
+
constructor() {
|
|
40
|
+
super("scaleway", SCALEWAY_API_BASE_URL);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override preparePayload(params: BodyParams): Record<string, unknown> {
|
|
44
|
+
return {
|
|
45
|
+
model: params.model,
|
|
46
|
+
...params.args,
|
|
47
|
+
prompt: params.args.inputs,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
override async getResponse(response: unknown): Promise<TextGenerationOutput> {
|
|
52
|
+
if (
|
|
53
|
+
typeof response === "object" &&
|
|
54
|
+
response !== null &&
|
|
55
|
+
"choices" in response &&
|
|
56
|
+
Array.isArray(response.choices) &&
|
|
57
|
+
response.choices.length > 0
|
|
58
|
+
) {
|
|
59
|
+
const completion: unknown = response.choices[0];
|
|
60
|
+
if (
|
|
61
|
+
typeof completion === "object" &&
|
|
62
|
+
!!completion &&
|
|
63
|
+
"text" in completion &&
|
|
64
|
+
completion.text &&
|
|
65
|
+
typeof completion.text === "string"
|
|
66
|
+
) {
|
|
67
|
+
return {
|
|
68
|
+
generated_text: completion.text,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
throw new InferenceClientProviderOutputError("Received malformed response from Scaleway text generation API");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export class ScalewayFeatureExtractionTask extends TaskProviderHelper implements FeatureExtractionTaskHelper {
|
|
77
|
+
constructor() {
|
|
78
|
+
super("scaleway", SCALEWAY_API_BASE_URL);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
preparePayload(params: BodyParams): Record<string, unknown> {
|
|
82
|
+
return {
|
|
83
|
+
input: params.args.inputs,
|
|
84
|
+
model: params.model,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
makeRoute(): string {
|
|
89
|
+
return "v1/embeddings";
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async getResponse(response: ScalewayEmbeddingsResponse): Promise<FeatureExtractionOutput> {
|
|
93
|
+
return response.data.map((item) => item.embedding);
|
|
94
|
+
}
|
|
95
|
+
}
|