Skip to content

Commit f1fe42c

Browse files
authored
[Inference] [Providers] Enforce task in mapping + expose them (#1109)
# TL;DR - Add task metadata to the HF id -> Provider id mappings, to forbid the usage of a chat model with the `textToImage` inference function for example - Expose the supported models mappings in `index.ts`
1 parent 044942d commit f1fe42c

File tree

8 files changed

+139
-114
lines changed

8 files changed

+139
-114
lines changed

packages/inference/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
export { HfInference, HfInferenceEndpoint } from "./HfInference";
22
export { InferenceOutputError } from "./lib/InferenceOutputError";
3+
export { FAL_AI_SUPPORTED_MODEL_IDS } from "./providers/fal-ai";
4+
export { REPLICATE_SUPPORTED_MODEL_IDS } from "./providers/replicate";
5+
export { SAMBANOVA_SUPPORTED_MODEL_IDS } from "./providers/sambanova";
6+
export { TOGETHER_SUPPORTED_MODEL_IDS } from "./providers/together";
37
export * from "./types";
48
export * from "./tasks";

packages/inference/src/lib/makeRequestOptions.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { HF_HUB_URL, HF_INFERENCE_API_URL } from "../config";
2-
import { FAL_AI_API_BASE_URL, FAL_AI_MODEL_IDS } from "../providers/fal-ai";
3-
import { REPLICATE_API_BASE_URL, REPLICATE_MODEL_IDS } from "../providers/replicate";
4-
import { SAMBANOVA_API_BASE_URL, SAMBANOVA_MODEL_IDS } from "../providers/sambanova";
5-
import { TOGETHER_API_BASE_URL, TOGETHER_MODEL_IDS } from "../providers/together";
2+
import { FAL_AI_API_BASE_URL, FAL_AI_SUPPORTED_MODEL_IDS } from "../providers/fal-ai";
3+
import { REPLICATE_API_BASE_URL, REPLICATE_SUPPORTED_MODEL_IDS } from "../providers/replicate";
4+
import { SAMBANOVA_API_BASE_URL, SAMBANOVA_SUPPORTED_MODEL_IDS } from "../providers/sambanova";
5+
import { TOGETHER_API_BASE_URL, TOGETHER_SUPPORTED_MODEL_IDS } from "../providers/together";
66
import type { InferenceProvider } from "../types";
77
import type { InferenceTask, Options, RequestArgs } from "../types";
88
import { isUrl } from "./isUrl";
@@ -50,13 +50,13 @@ export async function makeRequestOptions(
5050
let model: string;
5151
if (!maybeModel) {
5252
if (taskHint) {
53-
model = mapModel({ model: await loadDefaultModel(taskHint), provider });
53+
model = mapModel({ model: await loadDefaultModel(taskHint), provider, taskHint, chatCompletion });
5454
} else {
5555
throw new Error("No model provided, and no default model found for this task");
5656
/// TODO : change error message ^
5757
}
5858
} else {
59-
model = mapModel({ model: maybeModel, provider });
59+
model = mapModel({ model: maybeModel, provider, taskHint, chatCompletion });
6060
}
6161

6262
/// If accessToken is passed, it should take precedence over includeCredentials
@@ -143,24 +143,34 @@ export async function makeRequestOptions(
143143
return { url, info };
144144
}
145145

146-
function mapModel(params: { model: string; provider: InferenceProvider }): string {
146+
function mapModel(params: {
147+
model: string;
148+
provider: InferenceProvider;
149+
taskHint: InferenceTask | undefined;
150+
chatCompletion: boolean | undefined;
151+
}): string {
152+
if (params.provider === "hf-inference") {
153+
return params.model;
154+
}
155+
if (!params.taskHint) {
156+
throw new Error("taskHint must be specified when using a third-party provider");
157+
}
158+
const task = params.taskHint === "text-generation" && params.chatCompletion ? "conversational" : params.taskHint;
147159
const model = (() => {
148160
switch (params.provider) {
149161
case "fal-ai":
150-
return FAL_AI_MODEL_IDS[params.model];
162+
return FAL_AI_SUPPORTED_MODEL_IDS[task]?.[params.model];
151163
case "replicate":
152-
return REPLICATE_MODEL_IDS[params.model];
164+
return REPLICATE_SUPPORTED_MODEL_IDS[task]?.[params.model];
153165
case "sambanova":
154-
return SAMBANOVA_MODEL_IDS[params.model];
166+
return SAMBANOVA_SUPPORTED_MODEL_IDS[task]?.[params.model];
155167
case "together":
156-
return TOGETHER_MODEL_IDS[params.model]?.id;
157-
case "hf-inference":
158-
return params.model;
168+
return TOGETHER_SUPPORTED_MODEL_IDS[task]?.[params.model];
159169
}
160170
})();
161171

162172
if (!model) {
163-
throw new Error(`Model ${params.model} is not supported for provider ${params.provider}`);
173+
throw new Error(`Model ${params.model} is not supported for task ${task} and provider ${params.provider}`);
164174
}
165175
return model;
166176
}
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import type { ModelId } from "../types";
1+
import type { ProviderMapping } from "./types";
22

33
export const FAL_AI_API_BASE_URL = "https://fal.run";
44

55
type FalAiId = string;
66

7-
/**
8-
* Mapping from HF model ID -> fal.ai app id
9-
*/
10-
export const FAL_AI_MODEL_IDS: Partial<Record<ModelId, FalAiId>> = {
11-
/** text-to-image */
12-
"black-forest-labs/FLUX.1-schnell": "fal-ai/flux/schnell",
13-
"black-forest-labs/FLUX.1-dev": "fal-ai/flux/dev",
14-
15-
/** automatic-speech-recognition */
16-
"openai/whisper-large-v3": "fal-ai/whisper",
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+
},
1715
};
Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
import type { ModelId } from "../types";
1+
import type { ProviderMapping } from "./types";
22

33
export const REPLICATE_API_BASE_URL = "https://api.replicate.com";
44

55
type ReplicateId = string;
66

7-
/**
8-
* Mapping from HF model ID -> Replicate model ID
9-
*
10-
* Available models can be fetched with:
11-
* ```
12-
* curl -s \
13-
* -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
14-
* 'https://api.replicate.com/v1/models'
15-
* ```
16-
*/
17-
export const REPLICATE_MODEL_IDS: Partial<Record<ModelId, ReplicateId>> = {
18-
/** text-to-image */
19-
"black-forest-labs/FLUX.1-schnell": "black-forest-labs/flux-schnell",
20-
"ByteDance/SDXL-Lightning":
21-
"bytedance/sdxl-lightning-4step:5599ed30703defd1d160a25a63321b4dec97101d98b4674bcc56e41f62f35637",
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+
// },
2216
};
Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
1-
import type { ModelId } from "../types";
1+
import type { ProviderMapping } from "./types";
22

33
export const SAMBANOVA_API_BASE_URL = "https://api.sambanova.ai";
44

5-
/**
6-
* Note for reviewers: our goal would be to ask Sambanova to support
7-
* our model ids too, so we don't have to define a mapping
8-
* or keep it up-to-date.
9-
*
10-
* As a fallback, if the above is not possible, ask Sambanova to
11-
* provide the mapping as an fetchable API.
12-
*/
135
type SambanovaId = string;
146

15-
/**
16-
* https://community.sambanova.ai/t/supported-models/193
17-
*/
18-
export const SAMBANOVA_MODEL_IDS: Partial<Record<ModelId, SambanovaId>> = {
7+
export const SAMBANOVA_SUPPORTED_MODEL_IDS: ProviderMapping<SambanovaId> = {
198
/** Chat completion / conversational */
20-
"Qwen/Qwen2.5-Coder-32B-Instruct": "Qwen2.5-Coder-32B-Instruct",
21-
"Qwen/Qwen2.5-72B-Instruct": "Qwen2.5-72B-Instruct",
22-
"Qwen/QwQ-32B-Preview": "QwQ-32B-Preview",
23-
"meta-llama/Llama-3.3-70B-Instruct": "Meta-Llama-3.3-70B-Instruct",
24-
"meta-llama/Llama-3.2-1B": "Meta-Llama-3.2-1B-Instruct",
25-
"meta-llama/Llama-3.2-3B": "Meta-Llama-3.2-3B-Instruct",
26-
"meta-llama/Llama-3.2-11B-Vision-Instruct": "Llama-3.2-11B-Vision-Instruct",
27-
"meta-llama/Llama-3.2-90B-Vision-Instruct": "Llama-3.2-90B-Vision-Instruct",
28-
"meta-llama/Llama-3.1-8B-Instruct": "Meta-Llama-3.1-8B-Instruct",
29-
"meta-llama/Llama-3.1-70B-Instruct": "Meta-Llama-3.1-70B-Instruct",
30-
"meta-llama/Llama-3.1-405B-Instruct": "Meta-Llama-3.1-405B-Instruct",
31-
"meta-llama/Llama-Guard-3-8B": "Meta-Llama-Guard-3-8B",
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+
},
3223
};
Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ModelId } from "../types";
1+
import type { ProviderMapping } from "./types";
22

33
export const TOGETHER_API_BASE_URL = "https://api.together.xyz";
44

@@ -10,50 +10,49 @@ type TogetherId = string;
1010
/**
1111
* https://docs.together.ai/reference/models-1
1212
*/
13-
export const TOGETHER_MODEL_IDS: Partial<
14-
Record<ModelId, { id: TogetherId; type: "chat" | "embedding" | "image" | "language" | "moderation" }>
15-
> = {
16-
/** text-to-image */
17-
"black-forest-labs/FLUX.1-Canny-dev": { id: "black-forest-labs/FLUX.1-canny", type: "image" },
18-
"black-forest-labs/FLUX.1-Depth-dev": { id: "black-forest-labs/FLUX.1-depth", type: "image" },
19-
"black-forest-labs/FLUX.1-dev": { id: "black-forest-labs/FLUX.1-dev", type: "image" },
20-
"black-forest-labs/FLUX.1-Redux-dev": { id: "black-forest-labs/FLUX.1-redux", type: "image" },
21-
"black-forest-labs/FLUX.1-schnell": { id: "black-forest-labs/FLUX.1-pro", type: "image" },
22-
"stabilityai/stable-diffusion-xl-base-1.0": { id: "stabilityai/stable-diffusion-xl-base-1.0", type: "image" },
23-
24-
/** chat completion */
25-
"databricks/dbrx-instruct": { id: "databricks/dbrx-instruct", type: "chat" },
26-
"deepseek-ai/deepseek-llm-67b-chat": { id: "deepseek-ai/deepseek-llm-67b-chat", type: "chat" },
27-
"google/gemma-2-9b-it": { id: "google/gemma-2-9b-it", type: "chat" },
28-
"google/gemma-2b-it": { id: "google/gemma-2-27b-it", type: "chat" },
29-
"llava-hf/llava-v1.6-mistral-7b-hf": { id: "llava-hf/llava-v1.6-mistral-7b-hf", type: "chat" },
30-
"meta-llama/Llama-2-13b-chat-hf": { id: "meta-llama/Llama-2-13b-chat-hf", type: "chat" },
31-
"meta-llama/Llama-2-70b-hf": { id: "meta-llama/Llama-2-70b-hf", type: "language" },
32-
"meta-llama/Llama-2-7b-chat-hf": { id: "meta-llama/Llama-2-7b-chat-hf", type: "chat" },
33-
"meta-llama/Llama-3.2-11B-Vision-Instruct": { id: "meta-llama/Llama-Vision-Free", type: "chat" },
34-
"meta-llama/Llama-3.2-3B-Instruct": { id: "meta-llama/Llama-3.2-3B-Instruct-Turbo", type: "chat" },
35-
"meta-llama/Llama-3.2-90B-Vision-Instruct": { id: "meta-llama/Llama-3.2-90B-Vision-Instruct-Turbo", type: "chat" },
36-
"meta-llama/Llama-3.3-70B-Instruct": { id: "meta-llama/Llama-3.3-70B-Instruct-Turbo", type: "chat" },
37-
"meta-llama/Meta-Llama-3-70B-Instruct": { id: "meta-llama/Llama-3-70b-chat-hf", type: "chat" },
38-
"meta-llama/Meta-Llama-3-8B-Instruct": { id: "togethercomputer/Llama-3-8b-chat-hf-int4", type: "chat" },
39-
"meta-llama/Meta-Llama-3.1-405B-Instruct": { id: "meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo", type: "chat" },
40-
"meta-llama/Meta-Llama-3.1-70B-Instruct": { id: "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", type: "chat" },
41-
"meta-llama/Meta-Llama-3.1-8B-Instruct": { id: "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo-128K", type: "chat" },
42-
"microsoft/WizardLM-2-8x22B": { id: "microsoft/WizardLM-2-8x22B", type: "chat" },
43-
"mistralai/Mistral-7B-Instruct-v0.3": { id: "mistralai/Mistral-7B-Instruct-v0.3", type: "chat" },
44-
"mistralai/Mixtral-8x22B-Instruct-v0.1": { id: "mistralai/Mixtral-8x22B-Instruct-v0.1", type: "chat" },
45-
"mistralai/Mixtral-8x7B-Instruct-v0.1": { id: "mistralai/Mixtral-8x7B-Instruct-v0.1", type: "chat" },
46-
"NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO": { id: "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO", type: "chat" },
47-
"nvidia/Llama-3.1-Nemotron-70B-Instruct-HF": { id: "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF", type: "chat" },
48-
"Qwen/Qwen2-72B-Instruct": { id: "Qwen/Qwen2-72B-Instruct", type: "chat" },
49-
"Qwen/Qwen2.5-72B-Instruct": { id: "Qwen/Qwen2.5-72B-Instruct-Turbo", type: "chat" },
50-
"Qwen/Qwen2.5-7B-Instruct": { id: "Qwen/Qwen2.5-7B-Instruct-Turbo", type: "chat" },
51-
"Qwen/Qwen2.5-Coder-32B-Instruct": { id: "Qwen/Qwen2.5-Coder-32B-Instruct", type: "chat" },
52-
"Qwen/QwQ-32B-Preview": { id: "Qwen/QwQ-32B-Preview", type: "chat" },
53-
"scb10x/llama-3-typhoon-v1.5-8b-instruct": { id: "scb10x/scb10x-llama3-typhoon-v1-5-8b-instruct", type: "chat" },
54-
"scb10x/llama-3-typhoon-v1.5x-70b-instruct-awq": { id: "scb10x/scb10x-llama3-typhoon-v1-5x-4f316", type: "chat" },
55-
56-
/** text-generation */
57-
"meta-llama/Meta-Llama-3-8B": { id: "meta-llama/Meta-Llama-3-8B", type: "language" },
58-
"mistralai/Mixtral-8x7B-v0.1": { id: "mistralai/Mixtral-8x7B-v0.1", type: "language" },
13+
export const TOGETHER_SUPPORTED_MODEL_IDS: ProviderMapping<TogetherId> = {
14+
"text-to-image": {
15+
"black-forest-labs/FLUX.1-Canny-dev": "black-forest-labs/FLUX.1-canny",
16+
"black-forest-labs/FLUX.1-Depth-dev": "black-forest-labs/FLUX.1-depth",
17+
"black-forest-labs/FLUX.1-dev": "black-forest-labs/FLUX.1-dev",
18+
"black-forest-labs/FLUX.1-Redux-dev": "black-forest-labs/FLUX.1-redux",
19+
"black-forest-labs/FLUX.1-schnell": "black-forest-labs/FLUX.1-pro",
20+
"stabilityai/stable-diffusion-xl-base-1.0": "stabilityai/stable-diffusion-xl-base-1.0",
21+
},
22+
conversational: {
23+
"databricks/dbrx-instruct": "databricks/dbrx-instruct",
24+
"deepseek-ai/deepseek-llm-67b-chat": "deepseek-ai/deepseek-llm-67b-chat",
25+
"google/gemma-2-9b-it": "google/gemma-2-9b-it",
26+
"google/gemma-2b-it": "google/gemma-2-27b-it",
27+
"llava-hf/llava-v1.6-mistral-7b-hf": "llava-hf/llava-v1.6-mistral-7b-hf",
28+
"meta-llama/Llama-2-13b-chat-hf": "meta-llama/Llama-2-13b-chat-hf",
29+
"meta-llama/Llama-2-70b-hf": "meta-llama/Llama-2-70b-hf",
30+
"meta-llama/Llama-2-7b-chat-hf": "meta-llama/Llama-2-7b-chat-hf",
31+
"meta-llama/Llama-3.2-11B-Vision-Instruct": "meta-llama/Llama-Vision-Free",
32+
"meta-llama/Llama-3.2-3B-Instruct": "meta-llama/Llama-3.2-3B-Instruct-Turbo",
33+
"meta-llama/Llama-3.2-90B-Vision-Instruct": "meta-llama/Llama-3.2-90B-Vision-Instruct-Turbo",
34+
"meta-llama/Llama-3.3-70B-Instruct": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
35+
"meta-llama/Meta-Llama-3-70B-Instruct": "meta-llama/Llama-3-70b-chat-hf",
36+
"meta-llama/Meta-Llama-3-8B-Instruct": "togethercomputer/Llama-3-8b-chat-hf-int4",
37+
"meta-llama/Meta-Llama-3.1-405B-Instruct": "meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo",
38+
"meta-llama/Meta-Llama-3.1-70B-Instruct": "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
39+
"meta-llama/Meta-Llama-3.1-8B-Instruct": "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo-128K",
40+
"microsoft/WizardLM-2-8x22B": "microsoft/WizardLM-2-8x22B",
41+
"mistralai/Mistral-7B-Instruct-v0.3": "mistralai/Mistral-7B-Instruct-v0.3",
42+
"mistralai/Mixtral-8x22B-Instruct-v0.1": "mistralai/Mixtral-8x22B-Instruct-v0.1",
43+
"mistralai/Mixtral-8x7B-Instruct-v0.1": "mistralai/Mixtral-8x7B-Instruct-v0.1",
44+
"NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
45+
"nvidia/Llama-3.1-Nemotron-70B-Instruct-HF": "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
46+
"Qwen/Qwen2-72B-Instruct": "Qwen/Qwen2-72B-Instruct",
47+
"Qwen/Qwen2.5-72B-Instruct": "Qwen/Qwen2.5-72B-Instruct-Turbo",
48+
"Qwen/Qwen2.5-7B-Instruct": "Qwen/Qwen2.5-7B-Instruct-Turbo",
49+
"Qwen/Qwen2.5-Coder-32B-Instruct": "Qwen/Qwen2.5-Coder-32B-Instruct",
50+
"Qwen/QwQ-32B-Preview": "Qwen/QwQ-32B-Preview",
51+
"scb10x/llama-3-typhoon-v1.5-8b-instruct": "scb10x/scb10x-llama3-typhoon-v1-5-8b-instruct",
52+
"scb10x/llama-3-typhoon-v1.5x-70b-instruct-awq": "scb10x/scb10x-llama3-typhoon-v1-5x-4f316",
53+
},
54+
"text-generation": {
55+
"meta-llama/Meta-Llama-3-8B": "meta-llama/Meta-Llama-3-8B",
56+
"mistralai/Mixtral-8x7B-v0.1": "mistralai/Mixtral-8x7B-v0.1",
57+
},
5958
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { InferenceTask, ModelId } from "../types";
2+
3+
export type ProviderMapping<ProviderId extends string> = Partial<
4+
Record<InferenceTask | "conversational", Partial<Record<ModelId, ProviderId>>>
5+
>;

packages/inference/test/HfInference.spec.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, it, describe, assert } from "vitest";
22

33
import type { ChatCompletionStreamOutput } from "@huggingface/tasks";
44

5-
import { HfInference } from "../src";
5+
import { chatCompletion, HfInference } from "../src";
66
import "./vcr";
77
import { readTestFile } from "./test-files";
88

@@ -820,6 +820,15 @@ describe.concurrent("HfInference", () => {
820820
});
821821
expect(res).toBeInstanceOf(Blob);
822822
});
823+
824+
it.skip("textToSpeech versioned", async () => {
825+
const res = await client.textToSpeech({
826+
model: "SWivid/F5-TTS",
827+
provider: "replicate",
828+
inputs: "Hello, how are you?",
829+
});
830+
expect(res).toBeInstanceOf(Blob);
831+
});
823832
},
824833
TIMEOUT
825834
);
@@ -911,4 +920,19 @@ describe.concurrent("HfInference", () => {
911920
},
912921
TIMEOUT
913922
);
923+
924+
describe.concurrent("3rd party providers", () => {
925+
it("chatCompletion - fails with unsupported model", async () => {
926+
expect(
927+
chatCompletion({
928+
model: "black-forest-labs/Flux.1-dev",
929+
provider: "together",
930+
messages: [{ role: "user", content: "Complete this sentence with words, one plus one is equal " }],
931+
accessToken: env.HF_TOGETHER_KEY,
932+
})
933+
).rejects.toThrowError(
934+
"Model black-forest-labs/Flux.1-dev is not supported for task conversational and provider together"
935+
);
936+
});
937+
});
914938
});

0 commit comments

Comments
 (0)