@ai-sdk/fireworks 3.0.87 → 3.0.89
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/CHANGELOG.md +28 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +562 -69
- package/dist/index.js.map +1 -1
- package/docs/26-fireworks.mdx +57 -8
- package/package.json +4 -4
- package/src/fireworks-image-model.ts +13 -69
- package/src/fireworks-model-catalog.ts +497 -0
- package/src/fireworks-provider.ts +7 -30
package/dist/index.js
CHANGED
|
@@ -1,6 +1,555 @@
|
|
|
1
1
|
import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, convertImageModelFileToDataUri, createBinaryResponseHandler, createJsonResponseHandler, createStatusCodeErrorResponseHandler, delay, getFromApi, lazySchema, loadApiKey, mapReasoningToProviderEffort, parseProviderOptions, postJsonToApi, resolve, resolveWith, serializeModelOptions, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
3
|
import { OpenAICompatibleChatLanguageModel, OpenAICompatibleCompletionLanguageModel, OpenAICompatibleEmbeddingModel } from "@ai-sdk/openai-compatible";
|
|
4
|
+
//#region src/fireworks-model-catalog.ts
|
|
5
|
+
const compatiblelanguageProviderOptions = {
|
|
6
|
+
user: { description: "A unique identifier representing your end-user, which can help providers to\nmonitor and detect abuse." },
|
|
7
|
+
reasoningEffort: { description: "Reasoning effort for reasoning models. Defaults to `medium`.\n\nSet to `null` to send `\"reasoning_effort\": null`, for providers that treat\nan explicit `null` differently from an omitted field." },
|
|
8
|
+
textVerbosity: { description: "Controls the verbosity of the generated text. Defaults to `medium`." },
|
|
9
|
+
strictJsonSchema: { description: "Whether to use strict JSON schema validation.\nWhen true, the model uses constrained decoding to guarantee schema compliance.\nOnly used when the provider supports structured outputs and a schema is provided." },
|
|
10
|
+
echo: { description: "Echo back the prompt in addition to the completion." },
|
|
11
|
+
logitBias: { description: "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in\nthe GPT tokenizer) to an associated bias value from -100 to 100." },
|
|
12
|
+
suffix: { description: "The suffix that comes after a completion of inserted text." }
|
|
13
|
+
};
|
|
14
|
+
const compatibleembeddingProviderOptions = {
|
|
15
|
+
dimensions: { description: "The number of dimensions the resulting output embeddings should have.\nOnly supported in text-embedding-3 and later models." },
|
|
16
|
+
user: { description: "A unique identifier representing your end-user, which can help providers to\nmonitor and detect abuse." }
|
|
17
|
+
};
|
|
18
|
+
/** Known options accepted under providerOptions; open-ended extension keys remain undeclared. */
|
|
19
|
+
const fireworksProviderOptions = {
|
|
20
|
+
language: {
|
|
21
|
+
...compatiblelanguageProviderOptions,
|
|
22
|
+
promptCacheKey: { description: "A stable key for routing requests with shared prompt prefixes to the same prompt cache." },
|
|
23
|
+
serviceTier: { description: "Use Fireworks Priority serving path for higher reliability during peak traffic." },
|
|
24
|
+
thinking: { description: "thinking" },
|
|
25
|
+
reasoningHistory: { description: "reasoningHistory" }
|
|
26
|
+
},
|
|
27
|
+
embedding: { ...compatibleembeddingProviderOptions },
|
|
28
|
+
image: {
|
|
29
|
+
guidance_scale: { description: "Classifier-free guidance scale for the image diffusion process." },
|
|
30
|
+
num_inference_steps: { description: "Number of denoising steps for the image generation process." },
|
|
31
|
+
output_format: { description: "Desired output image format." },
|
|
32
|
+
webhook_url: { description: "URL to receive webhook notifications for async Kontext requests." },
|
|
33
|
+
webhook_secret: { description: "Secret for webhook signature verification." },
|
|
34
|
+
prompt_upsampling: { description: "Whether Fireworks should automatically modify the prompt for more creative generation." },
|
|
35
|
+
safety_tolerance: { description: "Moderation tolerance level for inputs and outputs." },
|
|
36
|
+
cfg_scale: { description: "Guidance scale for legacy image_generation models." },
|
|
37
|
+
steps: { description: "Number of generation steps for legacy image_generation models." }
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const languageModelIds = [
|
|
41
|
+
"accounts/fireworks/models/deepseek-v3",
|
|
42
|
+
"accounts/fireworks/models/llama-v3p3-70b-instruct",
|
|
43
|
+
"accounts/fireworks/models/llama-v3p2-3b-instruct",
|
|
44
|
+
"accounts/fireworks/models/llama-v3p1-405b-instruct",
|
|
45
|
+
"accounts/fireworks/models/llama-v3p1-8b-instruct",
|
|
46
|
+
"accounts/fireworks/models/mixtral-8x7b-instruct",
|
|
47
|
+
"accounts/fireworks/models/mixtral-8x22b-instruct",
|
|
48
|
+
"accounts/fireworks/models/mixtral-8x7b-instruct-hf",
|
|
49
|
+
"accounts/fireworks/models/qwen2p5-coder-32b-instruct",
|
|
50
|
+
"accounts/fireworks/models/qwen2p5-72b-instruct",
|
|
51
|
+
"accounts/fireworks/models/qwen-qwq-32b-preview",
|
|
52
|
+
"accounts/fireworks/models/qwen2-vl-72b-instruct",
|
|
53
|
+
"accounts/fireworks/models/llama-v3p2-11b-vision-instruct",
|
|
54
|
+
"accounts/fireworks/models/qwq-32b",
|
|
55
|
+
"accounts/fireworks/models/yi-large",
|
|
56
|
+
"accounts/fireworks/models/kimi-k2-instruct",
|
|
57
|
+
"accounts/fireworks/models/kimi-k2-thinking",
|
|
58
|
+
"accounts/fireworks/models/kimi-k2p6",
|
|
59
|
+
"accounts/fireworks/models/minimax-m2",
|
|
60
|
+
"accounts/fireworks/models/llama-v3-8b-instruct",
|
|
61
|
+
"accounts/fireworks/models/llama-v2-34b-code"
|
|
62
|
+
];
|
|
63
|
+
const embeddingModelIds = ["nomic-ai/nomic-embed-text-v1.5"];
|
|
64
|
+
const imageModelIds = [
|
|
65
|
+
"accounts/fireworks/models/flux-1-dev-fp8",
|
|
66
|
+
"accounts/fireworks/models/flux-1-schnell-fp8",
|
|
67
|
+
"accounts/fireworks/models/flux-kontext-pro",
|
|
68
|
+
"accounts/fireworks/models/flux-kontext-max",
|
|
69
|
+
"accounts/fireworks/models/playground-v2-5-1024px-aesthetic",
|
|
70
|
+
"accounts/fireworks/models/japanese-stable-diffusion-xl",
|
|
71
|
+
"accounts/fireworks/models/playground-v2-1024px-aesthetic",
|
|
72
|
+
"accounts/fireworks/models/SSD-1B",
|
|
73
|
+
"accounts/fireworks/models/stable-diffusion-xl-1024-v1-0"
|
|
74
|
+
];
|
|
75
|
+
const documentedLanguageCapabilities = {
|
|
76
|
+
"accounts/fireworks/models/firefunction-v1": {
|
|
77
|
+
inputs: {
|
|
78
|
+
image: false,
|
|
79
|
+
audio: "unknown"
|
|
80
|
+
},
|
|
81
|
+
objectGeneration: true,
|
|
82
|
+
tools: {
|
|
83
|
+
usage: true,
|
|
84
|
+
streaming: true
|
|
85
|
+
},
|
|
86
|
+
reasoning: { support: "unknown" },
|
|
87
|
+
sampling: {
|
|
88
|
+
temperature: "unknown",
|
|
89
|
+
topP: "unknown",
|
|
90
|
+
logprobs: "unknown"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"accounts/fireworks/models/deepseek-r1": {
|
|
94
|
+
inputs: {
|
|
95
|
+
image: false,
|
|
96
|
+
audio: "unknown"
|
|
97
|
+
},
|
|
98
|
+
objectGeneration: true,
|
|
99
|
+
tools: {
|
|
100
|
+
usage: false,
|
|
101
|
+
streaming: false
|
|
102
|
+
},
|
|
103
|
+
reasoning: { support: "unknown" },
|
|
104
|
+
sampling: {
|
|
105
|
+
temperature: "unknown",
|
|
106
|
+
topP: "unknown",
|
|
107
|
+
logprobs: "unknown"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"accounts/fireworks/models/deepseek-v3": {
|
|
111
|
+
inputs: {
|
|
112
|
+
image: false,
|
|
113
|
+
audio: "unknown"
|
|
114
|
+
},
|
|
115
|
+
objectGeneration: true,
|
|
116
|
+
tools: {
|
|
117
|
+
usage: true,
|
|
118
|
+
streaming: false
|
|
119
|
+
},
|
|
120
|
+
reasoning: { support: "unknown" },
|
|
121
|
+
sampling: {
|
|
122
|
+
temperature: "unknown",
|
|
123
|
+
topP: "unknown",
|
|
124
|
+
logprobs: "unknown"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"accounts/fireworks/models/llama-v3p1-405b-instruct": {
|
|
128
|
+
inputs: {
|
|
129
|
+
image: false,
|
|
130
|
+
audio: "unknown"
|
|
131
|
+
},
|
|
132
|
+
objectGeneration: true,
|
|
133
|
+
tools: {
|
|
134
|
+
usage: true,
|
|
135
|
+
streaming: true
|
|
136
|
+
},
|
|
137
|
+
reasoning: { support: "unknown" },
|
|
138
|
+
sampling: {
|
|
139
|
+
temperature: "unknown",
|
|
140
|
+
topP: "unknown",
|
|
141
|
+
logprobs: "unknown"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"accounts/fireworks/models/llama-v3p1-8b-instruct": {
|
|
145
|
+
inputs: {
|
|
146
|
+
image: false,
|
|
147
|
+
audio: "unknown"
|
|
148
|
+
},
|
|
149
|
+
objectGeneration: true,
|
|
150
|
+
tools: {
|
|
151
|
+
usage: true,
|
|
152
|
+
streaming: false
|
|
153
|
+
},
|
|
154
|
+
reasoning: { support: "unknown" },
|
|
155
|
+
sampling: {
|
|
156
|
+
temperature: "unknown",
|
|
157
|
+
topP: "unknown",
|
|
158
|
+
logprobs: "unknown"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"accounts/fireworks/models/llama-v3p2-3b-instruct": {
|
|
162
|
+
inputs: {
|
|
163
|
+
image: false,
|
|
164
|
+
audio: "unknown"
|
|
165
|
+
},
|
|
166
|
+
objectGeneration: true,
|
|
167
|
+
tools: {
|
|
168
|
+
usage: true,
|
|
169
|
+
streaming: false
|
|
170
|
+
},
|
|
171
|
+
reasoning: { support: "unknown" },
|
|
172
|
+
sampling: {
|
|
173
|
+
temperature: "unknown",
|
|
174
|
+
topP: "unknown",
|
|
175
|
+
logprobs: "unknown"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"accounts/fireworks/models/llama-v3p3-70b-instruct": {
|
|
179
|
+
inputs: {
|
|
180
|
+
image: false,
|
|
181
|
+
audio: "unknown"
|
|
182
|
+
},
|
|
183
|
+
objectGeneration: true,
|
|
184
|
+
tools: {
|
|
185
|
+
usage: true,
|
|
186
|
+
streaming: false
|
|
187
|
+
},
|
|
188
|
+
reasoning: { support: "unknown" },
|
|
189
|
+
sampling: {
|
|
190
|
+
temperature: "unknown",
|
|
191
|
+
topP: "unknown",
|
|
192
|
+
logprobs: "unknown"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"accounts/fireworks/models/mixtral-8x7b-instruct": {
|
|
196
|
+
inputs: {
|
|
197
|
+
image: false,
|
|
198
|
+
audio: "unknown"
|
|
199
|
+
},
|
|
200
|
+
objectGeneration: true,
|
|
201
|
+
tools: {
|
|
202
|
+
usage: true,
|
|
203
|
+
streaming: false
|
|
204
|
+
},
|
|
205
|
+
reasoning: { support: "unknown" },
|
|
206
|
+
sampling: {
|
|
207
|
+
temperature: "unknown",
|
|
208
|
+
topP: "unknown",
|
|
209
|
+
logprobs: "unknown"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"accounts/fireworks/models/mixtral-8x7b-instruct-hf": {
|
|
213
|
+
inputs: {
|
|
214
|
+
image: false,
|
|
215
|
+
audio: "unknown"
|
|
216
|
+
},
|
|
217
|
+
objectGeneration: true,
|
|
218
|
+
tools: {
|
|
219
|
+
usage: true,
|
|
220
|
+
streaming: false
|
|
221
|
+
},
|
|
222
|
+
reasoning: { support: "unknown" },
|
|
223
|
+
sampling: {
|
|
224
|
+
temperature: "unknown",
|
|
225
|
+
topP: "unknown",
|
|
226
|
+
logprobs: "unknown"
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"accounts/fireworks/models/mixtral-8x22b-instruct": {
|
|
230
|
+
inputs: {
|
|
231
|
+
image: false,
|
|
232
|
+
audio: "unknown"
|
|
233
|
+
},
|
|
234
|
+
objectGeneration: true,
|
|
235
|
+
tools: {
|
|
236
|
+
usage: true,
|
|
237
|
+
streaming: false
|
|
238
|
+
},
|
|
239
|
+
reasoning: { support: "unknown" },
|
|
240
|
+
sampling: {
|
|
241
|
+
temperature: "unknown",
|
|
242
|
+
topP: "unknown",
|
|
243
|
+
logprobs: "unknown"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"accounts/fireworks/models/qwen2p5-coder-32b-instruct": {
|
|
247
|
+
inputs: {
|
|
248
|
+
image: false,
|
|
249
|
+
audio: "unknown"
|
|
250
|
+
},
|
|
251
|
+
objectGeneration: true,
|
|
252
|
+
tools: {
|
|
253
|
+
usage: true,
|
|
254
|
+
streaming: false
|
|
255
|
+
},
|
|
256
|
+
reasoning: { support: "unknown" },
|
|
257
|
+
sampling: {
|
|
258
|
+
temperature: "unknown",
|
|
259
|
+
topP: "unknown",
|
|
260
|
+
logprobs: "unknown"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
"accounts/fireworks/models/qwen2p5-72b-instruct": {
|
|
264
|
+
inputs: {
|
|
265
|
+
image: false,
|
|
266
|
+
audio: "unknown"
|
|
267
|
+
},
|
|
268
|
+
objectGeneration: true,
|
|
269
|
+
tools: {
|
|
270
|
+
usage: true,
|
|
271
|
+
streaming: false
|
|
272
|
+
},
|
|
273
|
+
reasoning: { support: "unknown" },
|
|
274
|
+
sampling: {
|
|
275
|
+
temperature: "unknown",
|
|
276
|
+
topP: "unknown",
|
|
277
|
+
logprobs: "unknown"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"accounts/fireworks/models/qwen-qwq-32b-preview": {
|
|
281
|
+
inputs: {
|
|
282
|
+
image: false,
|
|
283
|
+
audio: "unknown"
|
|
284
|
+
},
|
|
285
|
+
objectGeneration: true,
|
|
286
|
+
tools: {
|
|
287
|
+
usage: false,
|
|
288
|
+
streaming: false
|
|
289
|
+
},
|
|
290
|
+
reasoning: { support: "unknown" },
|
|
291
|
+
sampling: {
|
|
292
|
+
temperature: "unknown",
|
|
293
|
+
topP: "unknown",
|
|
294
|
+
logprobs: "unknown"
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"accounts/fireworks/models/qwen2-vl-72b-instruct": {
|
|
298
|
+
inputs: {
|
|
299
|
+
image: true,
|
|
300
|
+
audio: "unknown"
|
|
301
|
+
},
|
|
302
|
+
objectGeneration: true,
|
|
303
|
+
tools: {
|
|
304
|
+
usage: false,
|
|
305
|
+
streaming: false
|
|
306
|
+
},
|
|
307
|
+
reasoning: { support: "unknown" },
|
|
308
|
+
sampling: {
|
|
309
|
+
temperature: "unknown",
|
|
310
|
+
topP: "unknown",
|
|
311
|
+
logprobs: "unknown"
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
"accounts/fireworks/models/llama-v3p2-11b-vision-instruct": {
|
|
315
|
+
inputs: {
|
|
316
|
+
image: true,
|
|
317
|
+
audio: "unknown"
|
|
318
|
+
},
|
|
319
|
+
objectGeneration: true,
|
|
320
|
+
tools: {
|
|
321
|
+
usage: true,
|
|
322
|
+
streaming: false
|
|
323
|
+
},
|
|
324
|
+
reasoning: { support: "unknown" },
|
|
325
|
+
sampling: {
|
|
326
|
+
temperature: "unknown",
|
|
327
|
+
topP: "unknown",
|
|
328
|
+
logprobs: "unknown"
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
"accounts/fireworks/models/qwq-32b": {
|
|
332
|
+
inputs: {
|
|
333
|
+
image: false,
|
|
334
|
+
audio: "unknown"
|
|
335
|
+
},
|
|
336
|
+
objectGeneration: true,
|
|
337
|
+
tools: {
|
|
338
|
+
usage: false,
|
|
339
|
+
streaming: false
|
|
340
|
+
},
|
|
341
|
+
reasoning: { support: "unknown" },
|
|
342
|
+
sampling: {
|
|
343
|
+
temperature: "unknown",
|
|
344
|
+
topP: "unknown",
|
|
345
|
+
logprobs: "unknown"
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"accounts/fireworks/models/yi-large": {
|
|
349
|
+
inputs: {
|
|
350
|
+
image: false,
|
|
351
|
+
audio: "unknown"
|
|
352
|
+
},
|
|
353
|
+
objectGeneration: true,
|
|
354
|
+
tools: {
|
|
355
|
+
usage: true,
|
|
356
|
+
streaming: false
|
|
357
|
+
},
|
|
358
|
+
reasoning: { support: "unknown" },
|
|
359
|
+
sampling: {
|
|
360
|
+
temperature: "unknown",
|
|
361
|
+
topP: "unknown",
|
|
362
|
+
logprobs: "unknown"
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
"accounts/fireworks/models/kimi-k2-instruct": {
|
|
366
|
+
inputs: {
|
|
367
|
+
image: false,
|
|
368
|
+
audio: "unknown"
|
|
369
|
+
},
|
|
370
|
+
objectGeneration: true,
|
|
371
|
+
tools: {
|
|
372
|
+
usage: true,
|
|
373
|
+
streaming: false
|
|
374
|
+
},
|
|
375
|
+
reasoning: { support: "unknown" },
|
|
376
|
+
sampling: {
|
|
377
|
+
temperature: "unknown",
|
|
378
|
+
topP: "unknown",
|
|
379
|
+
logprobs: "unknown"
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"accounts/fireworks/models/kimi-k2-thinking": {
|
|
383
|
+
inputs: {
|
|
384
|
+
image: false,
|
|
385
|
+
audio: "unknown"
|
|
386
|
+
},
|
|
387
|
+
objectGeneration: true,
|
|
388
|
+
tools: {
|
|
389
|
+
usage: true,
|
|
390
|
+
streaming: false
|
|
391
|
+
},
|
|
392
|
+
reasoning: { support: "unknown" },
|
|
393
|
+
sampling: {
|
|
394
|
+
temperature: "unknown",
|
|
395
|
+
topP: "unknown",
|
|
396
|
+
logprobs: "unknown"
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
"accounts/fireworks/models/kimi-k2p6": {
|
|
400
|
+
inputs: {
|
|
401
|
+
image: true,
|
|
402
|
+
audio: "unknown"
|
|
403
|
+
},
|
|
404
|
+
objectGeneration: true,
|
|
405
|
+
tools: {
|
|
406
|
+
usage: true,
|
|
407
|
+
streaming: false
|
|
408
|
+
},
|
|
409
|
+
reasoning: { support: "unknown" },
|
|
410
|
+
sampling: {
|
|
411
|
+
temperature: "unknown",
|
|
412
|
+
topP: "unknown",
|
|
413
|
+
logprobs: "unknown"
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
"accounts/fireworks/models/minimax-m2": {
|
|
417
|
+
inputs: {
|
|
418
|
+
image: false,
|
|
419
|
+
audio: "unknown"
|
|
420
|
+
},
|
|
421
|
+
objectGeneration: true,
|
|
422
|
+
tools: {
|
|
423
|
+
usage: true,
|
|
424
|
+
streaming: false
|
|
425
|
+
},
|
|
426
|
+
reasoning: { support: "unknown" },
|
|
427
|
+
sampling: {
|
|
428
|
+
temperature: "unknown",
|
|
429
|
+
topP: "unknown",
|
|
430
|
+
logprobs: "unknown"
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
const unknownLanguageCapabilities = {
|
|
435
|
+
inputs: {
|
|
436
|
+
image: "unknown",
|
|
437
|
+
audio: "unknown"
|
|
438
|
+
},
|
|
439
|
+
objectGeneration: "unknown",
|
|
440
|
+
tools: {
|
|
441
|
+
usage: "unknown",
|
|
442
|
+
streaming: "unknown"
|
|
443
|
+
},
|
|
444
|
+
reasoning: { support: "unknown" },
|
|
445
|
+
sampling: {
|
|
446
|
+
temperature: "unknown",
|
|
447
|
+
topP: "unknown",
|
|
448
|
+
logprobs: "unknown"
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
const modelsWithoutNoneReasoningEffort = /^(?:gpt-oss|glm-5p3|muse-spark)/;
|
|
452
|
+
const modelsWithoutMinimalReasoningEffort = /^(?:nemotron|inkling)/;
|
|
453
|
+
/**
|
|
454
|
+
* Fireworks accepts every reasoning effort for most models, so reasoning
|
|
455
|
+
* values are sent directly, except to model families known to reject them.
|
|
456
|
+
*/
|
|
457
|
+
function getFireworksReasoningEffortMap(modelId) {
|
|
458
|
+
const modelName = modelId.slice(modelId.lastIndexOf("/") + 1);
|
|
459
|
+
return {
|
|
460
|
+
...!modelsWithoutNoneReasoningEffort.test(modelName) && { none: "none" },
|
|
461
|
+
...!modelsWithoutMinimalReasoningEffort.test(modelName) && { minimal: "minimal" },
|
|
462
|
+
low: "low",
|
|
463
|
+
medium: "medium",
|
|
464
|
+
high: "high",
|
|
465
|
+
xhigh: "xhigh",
|
|
466
|
+
max: "max"
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
function getFireworksLanguageModelEntry(modelId) {
|
|
470
|
+
const effortMap = getFireworksReasoningEffortMap(modelId);
|
|
471
|
+
return {
|
|
472
|
+
capabilities: { language: {
|
|
473
|
+
...documentedLanguageCapabilities[modelId] ?? unknownLanguageCapabilities,
|
|
474
|
+
reasoning: {
|
|
475
|
+
support: "unknown",
|
|
476
|
+
efforts: Object.values(effortMap)
|
|
477
|
+
},
|
|
478
|
+
structuredOutput: { jsonSchema: true }
|
|
479
|
+
} },
|
|
480
|
+
providerOptions: { language: Object.fromEntries(Object.keys(fireworksProviderOptions.language).map((key) => [key, "unknown"])) },
|
|
481
|
+
requestConfig: { language: { reasoningEffortMap: effortMap } }
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
const modelToBackendConfig = {
|
|
485
|
+
"accounts/fireworks/models/flux-1-dev-fp8": { urlFormat: "workflows" },
|
|
486
|
+
"accounts/fireworks/models/flux-1-schnell-fp8": { urlFormat: "workflows" },
|
|
487
|
+
"accounts/fireworks/models/flux-kontext-pro": {
|
|
488
|
+
urlFormat: "workflows_async",
|
|
489
|
+
supportsEditing: true
|
|
490
|
+
},
|
|
491
|
+
"accounts/fireworks/models/flux-kontext-max": {
|
|
492
|
+
urlFormat: "workflows_async",
|
|
493
|
+
supportsEditing: true
|
|
494
|
+
},
|
|
495
|
+
"accounts/fireworks/models/playground-v2-5-1024px-aesthetic": {
|
|
496
|
+
urlFormat: "image_generation",
|
|
497
|
+
supportsSize: true
|
|
498
|
+
},
|
|
499
|
+
"accounts/fireworks/models/japanese-stable-diffusion-xl": {
|
|
500
|
+
urlFormat: "image_generation",
|
|
501
|
+
supportsSize: true
|
|
502
|
+
},
|
|
503
|
+
"accounts/fireworks/models/playground-v2-1024px-aesthetic": {
|
|
504
|
+
urlFormat: "image_generation",
|
|
505
|
+
supportsSize: true
|
|
506
|
+
},
|
|
507
|
+
"accounts/fireworks/models/stable-diffusion-xl-1024-v1-0": {
|
|
508
|
+
urlFormat: "image_generation",
|
|
509
|
+
supportsSize: true
|
|
510
|
+
},
|
|
511
|
+
"accounts/fireworks/models/SSD-1B": {
|
|
512
|
+
urlFormat: "image_generation",
|
|
513
|
+
supportsSize: true
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
function getFireworksImageModelEntry(modelId) {
|
|
517
|
+
const config = modelToBackendConfig[modelId];
|
|
518
|
+
const fileInput = config == null ? "unknown" : config.supportsEditing === true;
|
|
519
|
+
return {
|
|
520
|
+
capabilities: { image: {
|
|
521
|
+
sizes: { description: config?.supportsSize ? "Explicit width and height." : "Aspect ratio; explicit sizes are not supported." },
|
|
522
|
+
fileInput,
|
|
523
|
+
maskInput: config == null ? "unknown" : false,
|
|
524
|
+
maxImagesPerCall: 1,
|
|
525
|
+
size: config?.supportsSize === true
|
|
526
|
+
} },
|
|
527
|
+
providerOptions: { image: Object.fromEntries(Object.keys(fireworksProviderOptions.image).map((key) => [key, "unknown"])) },
|
|
528
|
+
requestConfig: { image: { urlFormat: config?.urlFormat ?? "workflows" } }
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function getFireworksEmbeddingModelEntry(modelId) {
|
|
532
|
+
return {
|
|
533
|
+
capabilities: { ...modelId === "nomic-ai/nomic-embed-text-v1.5" ? { embedding: {
|
|
534
|
+
defaultDimensions: 768,
|
|
535
|
+
maxTokens: 8192,
|
|
536
|
+
customDimensions: "unknown"
|
|
537
|
+
} } : {} },
|
|
538
|
+
providerOptions: { embedding: Object.fromEntries(Object.keys(fireworksProviderOptions.embedding).map((key) => [key, "unknown"])) }
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
const fireworksModelCatalog = Object.fromEntries([
|
|
542
|
+
...languageModelIds.map((id) => [id, getFireworksLanguageModelEntry(id)]),
|
|
543
|
+
...imageModelIds.map((id) => [id, getFireworksImageModelEntry(id)]),
|
|
544
|
+
...embeddingModelIds.map((id) => [id, getFireworksEmbeddingModelEntry(id)])
|
|
545
|
+
]);
|
|
546
|
+
Object.assign(fireworksModelCatalog, Object.fromEntries(Object.keys(documentedLanguageCapabilities).map((id) => [id, getFireworksLanguageModelEntry(id)])));
|
|
547
|
+
Object.fromEntries([
|
|
548
|
+
"accounts/stability/models/sd3-turbo",
|
|
549
|
+
"accounts/stability/models/sd3-medium",
|
|
550
|
+
"accounts/stability/models/sd3"
|
|
551
|
+
].map((id) => [id, getFireworksImageModelEntry(id)]));
|
|
552
|
+
//#endregion
|
|
4
553
|
//#region src/fireworks-image-api.ts
|
|
5
554
|
const asyncSubmitResponseSchema = lazySchema(() => zodSchema(z.object({ request_id: z.string() })));
|
|
6
555
|
const asyncPollResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
@@ -52,40 +601,8 @@ const fireworksImageModelOptionsSchema = lazySchema(() => zodSchema(z.looseObjec
|
|
|
52
601
|
//#region src/fireworks-image-model.ts
|
|
53
602
|
const DEFAULT_POLL_INTERVAL_MILLIS = 500;
|
|
54
603
|
const DEFAULT_POLL_TIMEOUT_MILLIS = 12e4;
|
|
55
|
-
const modelToBackendConfig = {
|
|
56
|
-
"accounts/fireworks/models/flux-1-dev-fp8": { urlFormat: "workflows" },
|
|
57
|
-
"accounts/fireworks/models/flux-1-schnell-fp8": { urlFormat: "workflows" },
|
|
58
|
-
"accounts/fireworks/models/flux-kontext-pro": {
|
|
59
|
-
urlFormat: "workflows_async",
|
|
60
|
-
supportsEditing: true
|
|
61
|
-
},
|
|
62
|
-
"accounts/fireworks/models/flux-kontext-max": {
|
|
63
|
-
urlFormat: "workflows_async",
|
|
64
|
-
supportsEditing: true
|
|
65
|
-
},
|
|
66
|
-
"accounts/fireworks/models/playground-v2-5-1024px-aesthetic": {
|
|
67
|
-
urlFormat: "image_generation",
|
|
68
|
-
supportsSize: true
|
|
69
|
-
},
|
|
70
|
-
"accounts/fireworks/models/japanese-stable-diffusion-xl": {
|
|
71
|
-
urlFormat: "image_generation",
|
|
72
|
-
supportsSize: true
|
|
73
|
-
},
|
|
74
|
-
"accounts/fireworks/models/playground-v2-1024px-aesthetic": {
|
|
75
|
-
urlFormat: "image_generation",
|
|
76
|
-
supportsSize: true
|
|
77
|
-
},
|
|
78
|
-
"accounts/fireworks/models/stable-diffusion-xl-1024-v1-0": {
|
|
79
|
-
urlFormat: "image_generation",
|
|
80
|
-
supportsSize: true
|
|
81
|
-
},
|
|
82
|
-
"accounts/fireworks/models/SSD-1B": {
|
|
83
|
-
urlFormat: "image_generation",
|
|
84
|
-
supportsSize: true
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
604
|
function getUrlForModel(baseUrl, modelId) {
|
|
88
|
-
switch (
|
|
605
|
+
switch (getFireworksImageModelEntry(modelId).requestConfig.image?.urlFormat) {
|
|
89
606
|
case "image_generation": return `${baseUrl}/image_generation/${modelId}`;
|
|
90
607
|
case "workflows_async": return `${baseUrl}/workflows/${modelId}`;
|
|
91
608
|
default: return `${baseUrl}/workflows/${modelId}/text_to_image`;
|
|
@@ -95,17 +612,12 @@ function getPollUrlForModel(baseUrl, modelId) {
|
|
|
95
612
|
return `${baseUrl}/workflows/${modelId}/get_result`;
|
|
96
613
|
}
|
|
97
614
|
var FireworksImageModel = class FireworksImageModel {
|
|
615
|
+
get maxImagesPerCall() {
|
|
616
|
+
return getFireworksImageModelEntry(this.modelId).capabilities.image.maxImagesPerCall;
|
|
617
|
+
}
|
|
98
618
|
get supportsFileInputs() {
|
|
99
|
-
|
|
100
|
-
return
|
|
101
|
-
"accounts/fireworks/models/flux-1-dev-fp8",
|
|
102
|
-
"accounts/fireworks/models/flux-1-schnell-fp8",
|
|
103
|
-
"accounts/fireworks/models/playground-v2-5-1024px-aesthetic",
|
|
104
|
-
"accounts/fireworks/models/japanese-stable-diffusion-xl",
|
|
105
|
-
"accounts/fireworks/models/playground-v2-1024px-aesthetic",
|
|
106
|
-
"accounts/fireworks/models/SSD-1B",
|
|
107
|
-
"accounts/fireworks/models/stable-diffusion-xl-1024-v1-0"
|
|
108
|
-
].includes(this.modelId) ? false : void 0;
|
|
619
|
+
const support = getFireworksImageModelEntry(this.modelId).capabilities.image.fileInput;
|
|
620
|
+
return support === "unknown" ? void 0 : support;
|
|
109
621
|
}
|
|
110
622
|
get supportsMaskInputs() {
|
|
111
623
|
return this.supportsFileInputs == null ? void 0 : false;
|
|
@@ -126,17 +638,16 @@ var FireworksImageModel = class FireworksImageModel {
|
|
|
126
638
|
this.modelId = modelId;
|
|
127
639
|
this.config = config;
|
|
128
640
|
this.specificationVersion = "v4";
|
|
129
|
-
this.maxImagesPerCall = 1;
|
|
130
641
|
}
|
|
131
642
|
async doGenerate({ prompt, n, size, aspectRatio, seed, providerOptions, headers, abortSignal, files, mask }) {
|
|
132
643
|
const warnings = [];
|
|
133
|
-
const
|
|
134
|
-
if (!
|
|
644
|
+
const imageEntry = getFireworksImageModelEntry(this.modelId);
|
|
645
|
+
if (!imageEntry.capabilities.image.size && size != null) warnings.push({
|
|
135
646
|
type: "unsupported",
|
|
136
647
|
feature: "size",
|
|
137
648
|
details: "This model does not support the `size` option. Use `aspectRatio` instead."
|
|
138
649
|
});
|
|
139
|
-
if (
|
|
650
|
+
if (imageEntry.capabilities.image.size && aspectRatio != null) warnings.push({
|
|
140
651
|
type: "unsupported",
|
|
141
652
|
feature: "aspectRatio",
|
|
142
653
|
details: "This model does not support the `aspectRatio` option."
|
|
@@ -174,7 +685,7 @@ var FireworksImageModel = class FireworksImageModel {
|
|
|
174
685
|
},
|
|
175
686
|
...fireworksOptions
|
|
176
687
|
};
|
|
177
|
-
if (
|
|
688
|
+
if (imageEntry.requestConfig.image.urlFormat === "workflows_async") return this.doGenerateAsync({
|
|
178
689
|
body,
|
|
179
690
|
headers,
|
|
180
691
|
abortSignal,
|
|
@@ -285,7 +796,7 @@ var FireworksImageModel = class FireworksImageModel {
|
|
|
285
796
|
};
|
|
286
797
|
//#endregion
|
|
287
798
|
//#region src/version.ts
|
|
288
|
-
const VERSION = "3.0.
|
|
799
|
+
const VERSION = "3.0.89";
|
|
289
800
|
//#endregion
|
|
290
801
|
//#region src/fireworks-provider.ts
|
|
291
802
|
const fireworksErrorStructure = {
|
|
@@ -320,10 +831,10 @@ function createFireworks(options = {}) {
|
|
|
320
831
|
...getCommonModelConfig("chat"),
|
|
321
832
|
includeUsage: true,
|
|
322
833
|
errorStructure: fireworksErrorStructure,
|
|
323
|
-
supportsStructuredOutputs:
|
|
834
|
+
supportsStructuredOutputs: getFireworksLanguageModelEntry(modelId).capabilities.language.structuredOutput.jsonSchema,
|
|
324
835
|
mapReasoning: ({ reasoning, warnings }) => mapReasoningToProviderEffort({
|
|
325
836
|
reasoning,
|
|
326
|
-
effortMap:
|
|
837
|
+
effortMap: getFireworksLanguageModelEntry(modelId).requestConfig.language.reasoningEffortMap,
|
|
327
838
|
warnings
|
|
328
839
|
}),
|
|
329
840
|
transformRequestBody: (args) => {
|
|
@@ -370,24 +881,6 @@ function createFireworks(options = {}) {
|
|
|
370
881
|
return provider;
|
|
371
882
|
}
|
|
372
883
|
const fireworks = createFireworks();
|
|
373
|
-
const modelsWithoutNoneReasoningEffort = /^(?:gpt-oss|glm-5p3|muse-spark)/;
|
|
374
|
-
const modelsWithoutMinimalReasoningEffort = /^(?:nemotron|inkling)/;
|
|
375
|
-
/**
|
|
376
|
-
* Fireworks accepts every reasoning effort for most models, so reasoning
|
|
377
|
-
* values are sent directly, except to model families known to reject them.
|
|
378
|
-
*/
|
|
379
|
-
function getFireworksReasoningEffortMap(modelId) {
|
|
380
|
-
const modelName = modelId.slice(modelId.lastIndexOf("/") + 1);
|
|
381
|
-
return {
|
|
382
|
-
...!modelsWithoutNoneReasoningEffort.test(modelName) && { none: "none" },
|
|
383
|
-
...!modelsWithoutMinimalReasoningEffort.test(modelName) && { minimal: "minimal" },
|
|
384
|
-
low: "low",
|
|
385
|
-
medium: "medium",
|
|
386
|
-
high: "high",
|
|
387
|
-
xhigh: "xhigh",
|
|
388
|
-
max: "max"
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
884
|
//#endregion
|
|
392
885
|
export { FireworksImageModel, VERSION, createFireworks, fireworks };
|
|
393
886
|
|