@ai-sdk/fireworks 0.0.0-1c33ba03-20260114162300 → 0.0.0-4115c213-20260122152721
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 +65 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/26-fireworks.mdx +289 -0
- package/package.json +15 -6
- package/src/fireworks-chat-options.ts +20 -0
- package/src/fireworks-completion-options.ts +5 -0
- package/src/fireworks-embedding-options.ts +12 -0
- package/src/fireworks-image-model.ts +196 -0
- package/src/fireworks-image-options.ts +12 -0
- package/src/fireworks-provider.ts +172 -0
- package/src/index.ts +13 -0
- package/src/version.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,73 @@
|
|
|
1
1
|
# @ai-sdk/fireworks
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-4115c213-20260122152721
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
- @ai-sdk/openai-compatible@0.0.0-
|
|
7
|
+
- 4caafb2: chore: excluded tests from src folder in npm package
|
|
8
|
+
- Updated dependencies [4caafb2]
|
|
9
|
+
- @ai-sdk/openai-compatible@0.0.0-4115c213-20260122152721
|
|
10
|
+
- @ai-sdk/provider@0.0.0-4115c213-20260122152721
|
|
11
|
+
- @ai-sdk/provider-utils@0.0.0-4115c213-20260122152721
|
|
12
|
+
|
|
13
|
+
## 2.0.18
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 2b8369d: chore: add docs to package dist
|
|
18
|
+
|
|
19
|
+
## 2.0.17
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 8dc54db: chore: add src folders to package bundle
|
|
24
|
+
- Updated dependencies [8dc54db]
|
|
25
|
+
- @ai-sdk/openai-compatible@2.0.17
|
|
26
|
+
|
|
27
|
+
## 2.0.16
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [78555ad]
|
|
32
|
+
- @ai-sdk/openai-compatible@2.0.16
|
|
33
|
+
|
|
34
|
+
## 2.0.15
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [7116ef3]
|
|
39
|
+
- @ai-sdk/openai-compatible@2.0.15
|
|
40
|
+
|
|
41
|
+
## 2.0.14
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Updated dependencies [1612a57]
|
|
46
|
+
- @ai-sdk/openai-compatible@2.0.14
|
|
47
|
+
|
|
48
|
+
## 2.0.13
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [5c090e7]
|
|
53
|
+
- @ai-sdk/provider@3.0.4
|
|
54
|
+
- @ai-sdk/openai-compatible@2.0.13
|
|
55
|
+
- @ai-sdk/provider-utils@4.0.8
|
|
56
|
+
|
|
57
|
+
## 2.0.12
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [78a133a]
|
|
62
|
+
- @ai-sdk/openai-compatible@2.0.12
|
|
63
|
+
|
|
64
|
+
## 2.0.11
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Updated dependencies [46f46e4]
|
|
69
|
+
- @ai-sdk/provider-utils@4.0.7
|
|
70
|
+
- @ai-sdk/openai-compatible@2.0.11
|
|
10
71
|
|
|
11
72
|
## 2.0.10
|
|
12
73
|
|
package/dist/index.js
CHANGED
|
@@ -174,7 +174,7 @@ var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
|
174
174
|
var import_v4 = require("zod/v4");
|
|
175
175
|
|
|
176
176
|
// src/version.ts
|
|
177
|
-
var VERSION = true ? "0.0.0-
|
|
177
|
+
var VERSION = true ? "0.0.0-4115c213-20260122152721" : "0.0.0-test";
|
|
178
178
|
|
|
179
179
|
// src/fireworks-provider.ts
|
|
180
180
|
var fireworksErrorSchema = import_v4.z.object({
|
package/dist/index.mjs
CHANGED
|
@@ -159,7 +159,7 @@ import {
|
|
|
159
159
|
import { z } from "zod/v4";
|
|
160
160
|
|
|
161
161
|
// src/version.ts
|
|
162
|
-
var VERSION = true ? "0.0.0-
|
|
162
|
+
var VERSION = true ? "0.0.0-4115c213-20260122152721" : "0.0.0-test";
|
|
163
163
|
|
|
164
164
|
// src/fireworks-provider.ts
|
|
165
165
|
var fireworksErrorSchema = z.object({
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Fireworks
|
|
3
|
+
description: Learn how to use Fireworks models with the AI SDK.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fireworks Provider
|
|
7
|
+
|
|
8
|
+
[Fireworks](https://fireworks.ai/) is a platform for running and testing LLMs through their [API](https://readme.fireworks.ai/).
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
|
|
12
|
+
The Fireworks provider is available via the `@ai-sdk/fireworks` module. You can install it with
|
|
13
|
+
|
|
14
|
+
<Tabs items={['pnpm', 'npm', 'yarn', 'bun']}>
|
|
15
|
+
<Tab>
|
|
16
|
+
<Snippet text="pnpm add @ai-sdk/fireworks" dark />
|
|
17
|
+
</Tab>
|
|
18
|
+
<Tab>
|
|
19
|
+
<Snippet text="npm install @ai-sdk/fireworks" dark />
|
|
20
|
+
</Tab>
|
|
21
|
+
<Tab>
|
|
22
|
+
<Snippet text="yarn add @ai-sdk/fireworks" dark />
|
|
23
|
+
</Tab>
|
|
24
|
+
|
|
25
|
+
<Tab>
|
|
26
|
+
<Snippet text="bun add @ai-sdk/fireworks" dark />
|
|
27
|
+
</Tab>
|
|
28
|
+
</Tabs>
|
|
29
|
+
|
|
30
|
+
## Provider Instance
|
|
31
|
+
|
|
32
|
+
You can import the default provider instance `fireworks` from `@ai-sdk/fireworks`:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { fireworks } from '@ai-sdk/fireworks';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If you need a customized setup, you can import `createFireworks` from `@ai-sdk/fireworks`
|
|
39
|
+
and create a provider instance with your settings:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { createFireworks } from '@ai-sdk/fireworks';
|
|
43
|
+
|
|
44
|
+
const fireworks = createFireworks({
|
|
45
|
+
apiKey: process.env.FIREWORKS_API_KEY ?? '',
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
You can use the following optional settings to customize the Fireworks provider instance:
|
|
50
|
+
|
|
51
|
+
- **baseURL** _string_
|
|
52
|
+
|
|
53
|
+
Use a different URL prefix for API calls, e.g. to use proxy servers.
|
|
54
|
+
The default prefix is `https://api.fireworks.ai/inference/v1`.
|
|
55
|
+
|
|
56
|
+
- **apiKey** _string_
|
|
57
|
+
|
|
58
|
+
API key that is being sent using the `Authorization` header. It defaults to
|
|
59
|
+
the `FIREWORKS_API_KEY` environment variable.
|
|
60
|
+
|
|
61
|
+
- **headers** _Record<string,string>_
|
|
62
|
+
|
|
63
|
+
Custom headers to include in the requests.
|
|
64
|
+
|
|
65
|
+
- **fetch** _(input: RequestInfo, init?: RequestInit) => Promise<Response>_
|
|
66
|
+
|
|
67
|
+
Custom [fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch) implementation.
|
|
68
|
+
|
|
69
|
+
## Language Models
|
|
70
|
+
|
|
71
|
+
You can create [Fireworks models](https://fireworks.ai/models) using a provider instance.
|
|
72
|
+
The first argument is the model id, e.g. `accounts/fireworks/models/firefunction-v1`:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
const model = fireworks('accounts/fireworks/models/firefunction-v1');
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Reasoning Models
|
|
79
|
+
|
|
80
|
+
Fireworks exposes the thinking of `deepseek-r1` in the generated text using the `<think>` tag.
|
|
81
|
+
You can use the `extractReasoningMiddleware` to extract this reasoning and expose it as a `reasoning` property on the result:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { fireworks } from '@ai-sdk/fireworks';
|
|
85
|
+
import { wrapLanguageModel, extractReasoningMiddleware } from 'ai';
|
|
86
|
+
|
|
87
|
+
const enhancedModel = wrapLanguageModel({
|
|
88
|
+
model: fireworks('accounts/fireworks/models/deepseek-r1'),
|
|
89
|
+
middleware: extractReasoningMiddleware({ tagName: 'think' }),
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
You can then use that enhanced model in functions like `generateText` and `streamText`.
|
|
94
|
+
|
|
95
|
+
### Example
|
|
96
|
+
|
|
97
|
+
You can use Fireworks language models to generate text with the `generateText` function:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { fireworks } from '@ai-sdk/fireworks';
|
|
101
|
+
import { generateText } from 'ai';
|
|
102
|
+
|
|
103
|
+
const { text } = await generateText({
|
|
104
|
+
model: fireworks('accounts/fireworks/models/firefunction-v1'),
|
|
105
|
+
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Fireworks language models can also be used in the `streamText` function
|
|
110
|
+
(see [AI SDK Core](/docs/ai-sdk-core)).
|
|
111
|
+
|
|
112
|
+
### Completion Models
|
|
113
|
+
|
|
114
|
+
You can create models that call the Fireworks completions API using the `.completion()` factory method:
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
const model = fireworks.completion('accounts/fireworks/models/firefunction-v1');
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Model Capabilities
|
|
121
|
+
|
|
122
|
+
| Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
|
|
123
|
+
| ---------------------------------------------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
|
|
124
|
+
| `accounts/fireworks/models/firefunction-v1` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
125
|
+
| `accounts/fireworks/models/deepseek-r1` | <Cross size={18} /> | <Check size={18} /> | <Cross size={18} /> | <Cross size={18} /> |
|
|
126
|
+
| `accounts/fireworks/models/deepseek-v3` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
127
|
+
| `accounts/fireworks/models/llama-v3p1-405b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
128
|
+
| `accounts/fireworks/models/llama-v3p1-8b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
129
|
+
| `accounts/fireworks/models/llama-v3p2-3b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
130
|
+
| `accounts/fireworks/models/llama-v3p3-70b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
131
|
+
| `accounts/fireworks/models/mixtral-8x7b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
132
|
+
| `accounts/fireworks/models/mixtral-8x7b-instruct-hf` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
133
|
+
| `accounts/fireworks/models/mixtral-8x22b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
134
|
+
| `accounts/fireworks/models/qwen2p5-coder-32b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
135
|
+
| `accounts/fireworks/models/qwen2p5-72b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
136
|
+
| `accounts/fireworks/models/qwen-qwq-32b-preview` | <Cross size={18} /> | <Check size={18} /> | <Cross size={18} /> | <Cross size={18} /> |
|
|
137
|
+
| `accounts/fireworks/models/qwen2-vl-72b-instruct` | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> | <Cross size={18} /> |
|
|
138
|
+
| `accounts/fireworks/models/llama-v3p2-11b-vision-instruct` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
139
|
+
| `accounts/fireworks/models/qwq-32b` | <Cross size={18} /> | <Check size={18} /> | <Cross size={18} /> | <Cross size={18} /> |
|
|
140
|
+
| `accounts/fireworks/models/yi-large` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
141
|
+
| `accounts/fireworks/models/kimi-k2-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
142
|
+
|
|
143
|
+
<Note>
|
|
144
|
+
The table above lists popular models. Please see the [Fireworks models
|
|
145
|
+
page](https://fireworks.ai/models) for a full list of available models.
|
|
146
|
+
</Note>
|
|
147
|
+
|
|
148
|
+
## Embedding Models
|
|
149
|
+
|
|
150
|
+
You can create models that call the Fireworks embeddings API using the `.embedding()` factory method:
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
const model = fireworks.embedding('nomic-ai/nomic-embed-text-v1.5');
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
You can use Fireworks embedding models to generate embeddings with the `embed` function:
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
import { fireworks } from '@ai-sdk/fireworks';
|
|
160
|
+
import { embed } from 'ai';
|
|
161
|
+
|
|
162
|
+
const { embedding } = await embed({
|
|
163
|
+
model: fireworks.embedding('nomic-ai/nomic-embed-text-v1.5'),
|
|
164
|
+
value: 'sunny day at the beach',
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Model Capabilities
|
|
169
|
+
|
|
170
|
+
| Model | Dimensions | Max Tokens |
|
|
171
|
+
| -------------------------------- | ---------- | ---------- |
|
|
172
|
+
| `nomic-ai/nomic-embed-text-v1.5` | 768 | 8192 |
|
|
173
|
+
|
|
174
|
+
<Note>
|
|
175
|
+
For more embedding models, see the [Fireworks models
|
|
176
|
+
page](https://fireworks.ai/models) for a full list of available models.
|
|
177
|
+
</Note>
|
|
178
|
+
|
|
179
|
+
## Image Models
|
|
180
|
+
|
|
181
|
+
You can create Fireworks image models using the `.image()` factory method.
|
|
182
|
+
For more on image generation with the AI SDK see [generateImage()](/docs/reference/ai-sdk-core/generate-image).
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
import { fireworks } from '@ai-sdk/fireworks';
|
|
186
|
+
import { generateImage } from 'ai';
|
|
187
|
+
|
|
188
|
+
const { image } = await generateImage({
|
|
189
|
+
model: fireworks.image('accounts/fireworks/models/flux-1-dev-fp8'),
|
|
190
|
+
prompt: 'A futuristic cityscape at sunset',
|
|
191
|
+
aspectRatio: '16:9',
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
<Note>
|
|
196
|
+
Model support for `size` and `aspectRatio` parameters varies. See the [Model
|
|
197
|
+
Capabilities](#model-capabilities-1) section below for supported dimensions,
|
|
198
|
+
or check the model's documentation on [Fireworks models
|
|
199
|
+
page](https://fireworks.ai/models) for more details.
|
|
200
|
+
</Note>
|
|
201
|
+
|
|
202
|
+
### Image Editing
|
|
203
|
+
|
|
204
|
+
Fireworks supports image editing through FLUX Kontext models (`flux-kontext-pro` and `flux-kontext-max`). Pass input images via `prompt.images` to transform or edit existing images.
|
|
205
|
+
|
|
206
|
+
<Note>
|
|
207
|
+
Fireworks Kontext models do not support explicit masks. Editing is
|
|
208
|
+
prompt-driven — describe what you want to change in the text prompt.
|
|
209
|
+
</Note>
|
|
210
|
+
|
|
211
|
+
#### Basic Image Editing
|
|
212
|
+
|
|
213
|
+
Transform an existing image using text prompts:
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
const imageBuffer = readFileSync('./input-image.png');
|
|
217
|
+
|
|
218
|
+
const { images } = await generateImage({
|
|
219
|
+
model: fireworks.image('accounts/fireworks/models/flux-kontext-pro'),
|
|
220
|
+
prompt: {
|
|
221
|
+
text: 'Turn the cat into a golden retriever dog',
|
|
222
|
+
images: [imageBuffer],
|
|
223
|
+
},
|
|
224
|
+
providerOptions: {
|
|
225
|
+
fireworks: {
|
|
226
|
+
output_format: 'jpeg',
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
#### Style Transfer
|
|
233
|
+
|
|
234
|
+
Apply artistic styles to an image:
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
const imageBuffer = readFileSync('./input-image.png');
|
|
238
|
+
|
|
239
|
+
const { images } = await generateImage({
|
|
240
|
+
model: fireworks.image('accounts/fireworks/models/flux-kontext-pro'),
|
|
241
|
+
prompt: {
|
|
242
|
+
text: 'Transform this into a watercolor painting style',
|
|
243
|
+
images: [imageBuffer],
|
|
244
|
+
},
|
|
245
|
+
aspectRatio: '1:1',
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
<Note>
|
|
250
|
+
Input images can be provided as `Buffer`, `ArrayBuffer`, `Uint8Array`, or
|
|
251
|
+
base64-encoded strings. Fireworks only supports a single input image per
|
|
252
|
+
request.
|
|
253
|
+
</Note>
|
|
254
|
+
|
|
255
|
+
### Model Capabilities
|
|
256
|
+
|
|
257
|
+
For all models supporting aspect ratios, the following aspect ratios are supported:
|
|
258
|
+
|
|
259
|
+
`1:1 (default), 2:3, 3:2, 4:5, 5:4, 16:9, 9:16, 9:21, 21:9`
|
|
260
|
+
|
|
261
|
+
For all models supporting size, the following sizes are supported:
|
|
262
|
+
|
|
263
|
+
`640 x 1536, 768 x 1344, 832 x 1216, 896 x 1152, 1024x1024 (default), 1152 x 896, 1216 x 832, 1344 x 768, 1536 x 640`
|
|
264
|
+
|
|
265
|
+
| Model | Dimensions Specification | Image Editing |
|
|
266
|
+
| ------------------------------------------------------------ | ------------------------ | ------------------- |
|
|
267
|
+
| `accounts/fireworks/models/flux-kontext-pro` | Aspect Ratio | <Check size={18} /> |
|
|
268
|
+
| `accounts/fireworks/models/flux-kontext-max` | Aspect Ratio | <Check size={18} /> |
|
|
269
|
+
| `accounts/fireworks/models/flux-1-dev-fp8` | Aspect Ratio | <Cross size={18} /> |
|
|
270
|
+
| `accounts/fireworks/models/flux-1-schnell-fp8` | Aspect Ratio | <Cross size={18} /> |
|
|
271
|
+
| `accounts/fireworks/models/playground-v2-5-1024px-aesthetic` | Size | <Cross size={18} /> |
|
|
272
|
+
| `accounts/fireworks/models/japanese-stable-diffusion-xl` | Size | <Cross size={18} /> |
|
|
273
|
+
| `accounts/fireworks/models/playground-v2-1024px-aesthetic` | Size | <Cross size={18} /> |
|
|
274
|
+
| `accounts/fireworks/models/SSD-1B` | Size | <Cross size={18} /> |
|
|
275
|
+
| `accounts/fireworks/models/stable-diffusion-xl-1024-v1-0` | Size | <Cross size={18} /> |
|
|
276
|
+
|
|
277
|
+
For more details, see the [Fireworks models page](https://fireworks.ai/models).
|
|
278
|
+
|
|
279
|
+
#### Stability AI Models
|
|
280
|
+
|
|
281
|
+
Fireworks also presents several Stability AI models backed by Stability AI API
|
|
282
|
+
keys and endpoint. The AI SDK Fireworks provider does not currently include
|
|
283
|
+
support for these models:
|
|
284
|
+
|
|
285
|
+
| Model ID |
|
|
286
|
+
| -------------------------------------- |
|
|
287
|
+
| `accounts/stability/models/sd3-turbo` |
|
|
288
|
+
| `accounts/stability/models/sd3-medium` |
|
|
289
|
+
| `accounts/stability/models/sd3` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/fireworks",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4115c213-20260122152721",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -8,9 +8,18 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/**/*",
|
|
11
|
+
"docs/**/*",
|
|
12
|
+
"src",
|
|
13
|
+
"!src/**/*.test.ts",
|
|
14
|
+
"!src/**/*.test-d.ts",
|
|
15
|
+
"!src/**/__snapshots__",
|
|
16
|
+
"!src/**/__fixtures__",
|
|
11
17
|
"CHANGELOG.md",
|
|
12
18
|
"README.md"
|
|
13
19
|
],
|
|
20
|
+
"directories": {
|
|
21
|
+
"doc": "./docs"
|
|
22
|
+
},
|
|
14
23
|
"exports": {
|
|
15
24
|
"./package.json": "./package.json",
|
|
16
25
|
".": {
|
|
@@ -20,16 +29,16 @@
|
|
|
20
29
|
}
|
|
21
30
|
},
|
|
22
31
|
"dependencies": {
|
|
23
|
-
"@ai-sdk/openai-compatible": "0.0.0-
|
|
24
|
-
"@ai-sdk/provider": "
|
|
25
|
-
"@ai-sdk/provider-utils": "0.0.0-
|
|
32
|
+
"@ai-sdk/openai-compatible": "0.0.0-4115c213-20260122152721",
|
|
33
|
+
"@ai-sdk/provider": "0.0.0-4115c213-20260122152721",
|
|
34
|
+
"@ai-sdk/provider-utils": "0.0.0-4115c213-20260122152721"
|
|
26
35
|
},
|
|
27
36
|
"devDependencies": {
|
|
28
37
|
"@types/node": "20.17.24",
|
|
29
38
|
"tsup": "^8",
|
|
30
39
|
"typescript": "5.8.3",
|
|
31
40
|
"zod": "3.25.76",
|
|
32
|
-
"@ai-sdk/test-server": "
|
|
41
|
+
"@ai-sdk/test-server": "0.0.0-4115c213-20260122152721",
|
|
33
42
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
34
43
|
},
|
|
35
44
|
"peerDependencies": {
|
|
@@ -55,7 +64,7 @@
|
|
|
55
64
|
"scripts": {
|
|
56
65
|
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
57
66
|
"build:watch": "pnpm clean && tsup --watch",
|
|
58
|
-
"clean": "del-cli dist *.tsbuildinfo",
|
|
67
|
+
"clean": "del-cli dist docs *.tsbuildinfo",
|
|
59
68
|
"lint": "eslint \"./**/*.ts*\"",
|
|
60
69
|
"type-check": "tsc --build",
|
|
61
70
|
"prettier-check": "prettier --check \"./**/*.ts*\"",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// https://docs.fireworks.ai/docs/serverless-models#chat-models
|
|
2
|
+
// Below is just a subset of the available models.
|
|
3
|
+
export type FireworksChatModelId =
|
|
4
|
+
| 'accounts/fireworks/models/deepseek-v3'
|
|
5
|
+
| 'accounts/fireworks/models/llama-v3p3-70b-instruct'
|
|
6
|
+
| 'accounts/fireworks/models/llama-v3p2-3b-instruct'
|
|
7
|
+
| 'accounts/fireworks/models/llama-v3p1-405b-instruct'
|
|
8
|
+
| 'accounts/fireworks/models/llama-v3p1-8b-instruct'
|
|
9
|
+
| 'accounts/fireworks/models/mixtral-8x7b-instruct'
|
|
10
|
+
| 'accounts/fireworks/models/mixtral-8x22b-instruct'
|
|
11
|
+
| 'accounts/fireworks/models/mixtral-8x7b-instruct-hf'
|
|
12
|
+
| 'accounts/fireworks/models/qwen2p5-coder-32b-instruct'
|
|
13
|
+
| 'accounts/fireworks/models/qwen2p5-72b-instruct'
|
|
14
|
+
| 'accounts/fireworks/models/qwen-qwq-32b-preview'
|
|
15
|
+
| 'accounts/fireworks/models/qwen2-vl-72b-instruct'
|
|
16
|
+
| 'accounts/fireworks/models/llama-v3p2-11b-vision-instruct'
|
|
17
|
+
| 'accounts/fireworks/models/qwq-32b'
|
|
18
|
+
| 'accounts/fireworks/models/yi-large'
|
|
19
|
+
| 'accounts/fireworks/models/kimi-k2-instruct'
|
|
20
|
+
| (string & {});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
|
|
3
|
+
// Below is just a subset of the available models.
|
|
4
|
+
export type FireworksEmbeddingModelId =
|
|
5
|
+
| 'nomic-ai/nomic-embed-text-v1.5'
|
|
6
|
+
| (string & {});
|
|
7
|
+
|
|
8
|
+
export const fireworksEmbeddingProviderOptions = z.object({});
|
|
9
|
+
|
|
10
|
+
export type FireworksEmbeddingProviderOptions = z.infer<
|
|
11
|
+
typeof fireworksEmbeddingProviderOptions
|
|
12
|
+
>;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { ImageModelV3, SharedV3Warning } from '@ai-sdk/provider';
|
|
2
|
+
import {
|
|
3
|
+
combineHeaders,
|
|
4
|
+
convertImageModelFileToDataUri,
|
|
5
|
+
createBinaryResponseHandler,
|
|
6
|
+
createStatusCodeErrorResponseHandler,
|
|
7
|
+
FetchFunction,
|
|
8
|
+
postJsonToApi,
|
|
9
|
+
} from '@ai-sdk/provider-utils';
|
|
10
|
+
import { FireworksImageModelId } from './fireworks-image-options';
|
|
11
|
+
|
|
12
|
+
interface FireworksImageModelBackendConfig {
|
|
13
|
+
urlFormat: 'workflows' | 'workflows_edit' | 'image_generation';
|
|
14
|
+
supportsSize?: boolean;
|
|
15
|
+
supportsEditing?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const modelToBackendConfig: Partial<
|
|
19
|
+
Record<FireworksImageModelId, FireworksImageModelBackendConfig>
|
|
20
|
+
> = {
|
|
21
|
+
'accounts/fireworks/models/flux-1-dev-fp8': {
|
|
22
|
+
urlFormat: 'workflows',
|
|
23
|
+
},
|
|
24
|
+
'accounts/fireworks/models/flux-1-schnell-fp8': {
|
|
25
|
+
urlFormat: 'workflows',
|
|
26
|
+
},
|
|
27
|
+
'accounts/fireworks/models/flux-kontext-pro': {
|
|
28
|
+
urlFormat: 'workflows_edit',
|
|
29
|
+
supportsEditing: true,
|
|
30
|
+
},
|
|
31
|
+
'accounts/fireworks/models/flux-kontext-max': {
|
|
32
|
+
urlFormat: 'workflows_edit',
|
|
33
|
+
supportsEditing: true,
|
|
34
|
+
},
|
|
35
|
+
'accounts/fireworks/models/playground-v2-5-1024px-aesthetic': {
|
|
36
|
+
urlFormat: 'image_generation',
|
|
37
|
+
supportsSize: true,
|
|
38
|
+
},
|
|
39
|
+
'accounts/fireworks/models/japanese-stable-diffusion-xl': {
|
|
40
|
+
urlFormat: 'image_generation',
|
|
41
|
+
supportsSize: true,
|
|
42
|
+
},
|
|
43
|
+
'accounts/fireworks/models/playground-v2-1024px-aesthetic': {
|
|
44
|
+
urlFormat: 'image_generation',
|
|
45
|
+
supportsSize: true,
|
|
46
|
+
},
|
|
47
|
+
'accounts/fireworks/models/stable-diffusion-xl-1024-v1-0': {
|
|
48
|
+
urlFormat: 'image_generation',
|
|
49
|
+
supportsSize: true,
|
|
50
|
+
},
|
|
51
|
+
'accounts/fireworks/models/SSD-1B': {
|
|
52
|
+
urlFormat: 'image_generation',
|
|
53
|
+
supportsSize: true,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
function getUrlForModel(
|
|
58
|
+
baseUrl: string,
|
|
59
|
+
modelId: FireworksImageModelId,
|
|
60
|
+
hasInputImage: boolean,
|
|
61
|
+
): string {
|
|
62
|
+
const config = modelToBackendConfig[modelId];
|
|
63
|
+
|
|
64
|
+
switch (config?.urlFormat) {
|
|
65
|
+
case 'image_generation':
|
|
66
|
+
return `${baseUrl}/image_generation/${modelId}`;
|
|
67
|
+
case 'workflows_edit':
|
|
68
|
+
// Kontext models: use base URL for editing (no suffix)
|
|
69
|
+
return `${baseUrl}/workflows/${modelId}`;
|
|
70
|
+
case 'workflows':
|
|
71
|
+
default:
|
|
72
|
+
// Standard FLUX models: use text_to_image for generation,
|
|
73
|
+
// but if input_image provided, some models may support editing
|
|
74
|
+
if (hasInputImage && config?.supportsEditing) {
|
|
75
|
+
return `${baseUrl}/workflows/${modelId}`;
|
|
76
|
+
}
|
|
77
|
+
return `${baseUrl}/workflows/${modelId}/text_to_image`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface FireworksImageModelConfig {
|
|
82
|
+
provider: string;
|
|
83
|
+
baseURL: string;
|
|
84
|
+
headers: () => Record<string, string>;
|
|
85
|
+
fetch?: FetchFunction;
|
|
86
|
+
_internal?: {
|
|
87
|
+
currentDate?: () => Date;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export class FireworksImageModel implements ImageModelV3 {
|
|
92
|
+
readonly specificationVersion = 'v3';
|
|
93
|
+
readonly maxImagesPerCall = 1;
|
|
94
|
+
|
|
95
|
+
get provider(): string {
|
|
96
|
+
return this.config.provider;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
constructor(
|
|
100
|
+
readonly modelId: FireworksImageModelId,
|
|
101
|
+
private config: FireworksImageModelConfig,
|
|
102
|
+
) {}
|
|
103
|
+
|
|
104
|
+
async doGenerate({
|
|
105
|
+
prompt,
|
|
106
|
+
n,
|
|
107
|
+
size,
|
|
108
|
+
aspectRatio,
|
|
109
|
+
seed,
|
|
110
|
+
providerOptions,
|
|
111
|
+
headers,
|
|
112
|
+
abortSignal,
|
|
113
|
+
files,
|
|
114
|
+
mask,
|
|
115
|
+
}: Parameters<ImageModelV3['doGenerate']>[0]): Promise<
|
|
116
|
+
Awaited<ReturnType<ImageModelV3['doGenerate']>>
|
|
117
|
+
> {
|
|
118
|
+
const warnings: Array<SharedV3Warning> = [];
|
|
119
|
+
|
|
120
|
+
const backendConfig = modelToBackendConfig[this.modelId];
|
|
121
|
+
if (!backendConfig?.supportsSize && size != null) {
|
|
122
|
+
warnings.push({
|
|
123
|
+
type: 'unsupported',
|
|
124
|
+
feature: 'size',
|
|
125
|
+
details:
|
|
126
|
+
'This model does not support the `size` option. Use `aspectRatio` instead.',
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Use supportsSize as a proxy for whether the model does not support
|
|
131
|
+
// aspectRatio. This invariant holds for the current set of models.
|
|
132
|
+
if (backendConfig?.supportsSize && aspectRatio != null) {
|
|
133
|
+
warnings.push({
|
|
134
|
+
type: 'unsupported',
|
|
135
|
+
feature: 'aspectRatio',
|
|
136
|
+
details: 'This model does not support the `aspectRatio` option.',
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Handle files for image editing
|
|
141
|
+
const hasInputImage = files != null && files.length > 0;
|
|
142
|
+
let inputImage: string | undefined;
|
|
143
|
+
|
|
144
|
+
if (hasInputImage) {
|
|
145
|
+
inputImage = convertImageModelFileToDataUri(files[0]);
|
|
146
|
+
|
|
147
|
+
if (files.length > 1) {
|
|
148
|
+
warnings.push({
|
|
149
|
+
type: 'other',
|
|
150
|
+
message:
|
|
151
|
+
'Fireworks only supports a single input image. Additional images are ignored.',
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Warn about mask - Fireworks Kontext models don't support explicit masks
|
|
157
|
+
if (mask != null) {
|
|
158
|
+
warnings.push({
|
|
159
|
+
type: 'unsupported',
|
|
160
|
+
feature: 'mask',
|
|
161
|
+
details:
|
|
162
|
+
'Fireworks Kontext models do not support explicit masks. Use the prompt to describe the areas to edit.',
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const splitSize = size?.split('x');
|
|
167
|
+
const currentDate = this.config._internal?.currentDate?.() ?? new Date();
|
|
168
|
+
const { value: response, responseHeaders } = await postJsonToApi({
|
|
169
|
+
url: getUrlForModel(this.config.baseURL, this.modelId, hasInputImage),
|
|
170
|
+
headers: combineHeaders(this.config.headers(), headers),
|
|
171
|
+
body: {
|
|
172
|
+
prompt,
|
|
173
|
+
aspect_ratio: aspectRatio,
|
|
174
|
+
seed,
|
|
175
|
+
samples: n,
|
|
176
|
+
...(inputImage && { input_image: inputImage }),
|
|
177
|
+
...(splitSize && { width: splitSize[0], height: splitSize[1] }),
|
|
178
|
+
...(providerOptions.fireworks ?? {}),
|
|
179
|
+
},
|
|
180
|
+
failedResponseHandler: createStatusCodeErrorResponseHandler(),
|
|
181
|
+
successfulResponseHandler: createBinaryResponseHandler(),
|
|
182
|
+
abortSignal,
|
|
183
|
+
fetch: this.config.fetch,
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
images: [response],
|
|
188
|
+
warnings,
|
|
189
|
+
response: {
|
|
190
|
+
timestamp: currentDate,
|
|
191
|
+
modelId: this.modelId,
|
|
192
|
+
headers: responseHeaders,
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// https://fireworks.ai/models?type=image
|
|
2
|
+
export type FireworksImageModelId =
|
|
3
|
+
| 'accounts/fireworks/models/flux-1-dev-fp8'
|
|
4
|
+
| 'accounts/fireworks/models/flux-1-schnell-fp8'
|
|
5
|
+
| 'accounts/fireworks/models/flux-kontext-pro'
|
|
6
|
+
| 'accounts/fireworks/models/flux-kontext-max'
|
|
7
|
+
| 'accounts/fireworks/models/playground-v2-5-1024px-aesthetic'
|
|
8
|
+
| 'accounts/fireworks/models/japanese-stable-diffusion-xl'
|
|
9
|
+
| 'accounts/fireworks/models/playground-v2-1024px-aesthetic'
|
|
10
|
+
| 'accounts/fireworks/models/SSD-1B'
|
|
11
|
+
| 'accounts/fireworks/models/stable-diffusion-xl-1024-v1-0'
|
|
12
|
+
| (string & {});
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OpenAICompatibleChatLanguageModel,
|
|
3
|
+
OpenAICompatibleCompletionLanguageModel,
|
|
4
|
+
OpenAICompatibleEmbeddingModel,
|
|
5
|
+
ProviderErrorStructure,
|
|
6
|
+
} from '@ai-sdk/openai-compatible';
|
|
7
|
+
import {
|
|
8
|
+
EmbeddingModelV3,
|
|
9
|
+
ImageModelV3,
|
|
10
|
+
LanguageModelV3,
|
|
11
|
+
ProviderV3,
|
|
12
|
+
} from '@ai-sdk/provider';
|
|
13
|
+
import {
|
|
14
|
+
FetchFunction,
|
|
15
|
+
loadApiKey,
|
|
16
|
+
withoutTrailingSlash,
|
|
17
|
+
withUserAgentSuffix,
|
|
18
|
+
} from '@ai-sdk/provider-utils';
|
|
19
|
+
import { z } from 'zod/v4';
|
|
20
|
+
import { FireworksChatModelId } from './fireworks-chat-options';
|
|
21
|
+
import { FireworksCompletionModelId } from './fireworks-completion-options';
|
|
22
|
+
import { FireworksEmbeddingModelId } from './fireworks-embedding-options';
|
|
23
|
+
import { FireworksImageModel } from './fireworks-image-model';
|
|
24
|
+
import { FireworksImageModelId } from './fireworks-image-options';
|
|
25
|
+
import { VERSION } from './version';
|
|
26
|
+
|
|
27
|
+
export type FireworksErrorData = z.infer<typeof fireworksErrorSchema>;
|
|
28
|
+
|
|
29
|
+
const fireworksErrorSchema = z.object({
|
|
30
|
+
error: z.string(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const fireworksErrorStructure: ProviderErrorStructure<FireworksErrorData> = {
|
|
34
|
+
errorSchema: fireworksErrorSchema,
|
|
35
|
+
errorToMessage: data => data.error,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export interface FireworksProviderSettings {
|
|
39
|
+
/**
|
|
40
|
+
Fireworks API key. Default value is taken from the `FIREWORKS_API_KEY`
|
|
41
|
+
environment variable.
|
|
42
|
+
*/
|
|
43
|
+
apiKey?: string;
|
|
44
|
+
/**
|
|
45
|
+
Base URL for the API calls.
|
|
46
|
+
*/
|
|
47
|
+
baseURL?: string;
|
|
48
|
+
/**
|
|
49
|
+
Custom headers to include in the requests.
|
|
50
|
+
*/
|
|
51
|
+
headers?: Record<string, string>;
|
|
52
|
+
/**
|
|
53
|
+
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
54
|
+
or to provide a custom fetch implementation for e.g. testing.
|
|
55
|
+
*/
|
|
56
|
+
fetch?: FetchFunction;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface FireworksProvider extends ProviderV3 {
|
|
60
|
+
/**
|
|
61
|
+
Creates a model for text generation.
|
|
62
|
+
*/
|
|
63
|
+
(modelId: FireworksChatModelId): LanguageModelV3;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
Creates a chat model for text generation.
|
|
67
|
+
*/
|
|
68
|
+
chatModel(modelId: FireworksChatModelId): LanguageModelV3;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
Creates a completion model for text generation.
|
|
72
|
+
*/
|
|
73
|
+
completionModel(modelId: FireworksCompletionModelId): LanguageModelV3;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
Creates a chat model for text generation.
|
|
77
|
+
*/
|
|
78
|
+
languageModel(modelId: FireworksChatModelId): LanguageModelV3;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
Creates a text embedding model for text generation.
|
|
82
|
+
*/
|
|
83
|
+
embeddingModel(modelId: FireworksEmbeddingModelId): EmbeddingModelV3;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated Use `embeddingModel` instead.
|
|
87
|
+
*/
|
|
88
|
+
textEmbeddingModel(modelId: FireworksEmbeddingModelId): EmbeddingModelV3;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
Creates a model for image generation.
|
|
92
|
+
*/
|
|
93
|
+
image(modelId: FireworksImageModelId): ImageModelV3;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
Creates a model for image generation.
|
|
97
|
+
*/
|
|
98
|
+
imageModel(modelId: FireworksImageModelId): ImageModelV3;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const defaultBaseURL = 'https://api.fireworks.ai/inference/v1';
|
|
102
|
+
|
|
103
|
+
export function createFireworks(
|
|
104
|
+
options: FireworksProviderSettings = {},
|
|
105
|
+
): FireworksProvider {
|
|
106
|
+
const baseURL = withoutTrailingSlash(options.baseURL ?? defaultBaseURL);
|
|
107
|
+
const getHeaders = () =>
|
|
108
|
+
withUserAgentSuffix(
|
|
109
|
+
{
|
|
110
|
+
Authorization: `Bearer ${loadApiKey({
|
|
111
|
+
apiKey: options.apiKey,
|
|
112
|
+
environmentVariableName: 'FIREWORKS_API_KEY',
|
|
113
|
+
description: 'Fireworks API key',
|
|
114
|
+
})}`,
|
|
115
|
+
...options.headers,
|
|
116
|
+
},
|
|
117
|
+
`ai-sdk/fireworks/${VERSION}`,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
interface CommonModelConfig {
|
|
121
|
+
provider: string;
|
|
122
|
+
url: ({ path }: { path: string }) => string;
|
|
123
|
+
headers: () => Record<string, string>;
|
|
124
|
+
fetch?: FetchFunction;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const getCommonModelConfig = (modelType: string): CommonModelConfig => ({
|
|
128
|
+
provider: `fireworks.${modelType}`,
|
|
129
|
+
url: ({ path }) => `${baseURL}${path}`,
|
|
130
|
+
headers: getHeaders,
|
|
131
|
+
fetch: options.fetch,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const createChatModel = (modelId: FireworksChatModelId) => {
|
|
135
|
+
return new OpenAICompatibleChatLanguageModel(modelId, {
|
|
136
|
+
...getCommonModelConfig('chat'),
|
|
137
|
+
errorStructure: fireworksErrorStructure,
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const createCompletionModel = (modelId: FireworksCompletionModelId) =>
|
|
142
|
+
new OpenAICompatibleCompletionLanguageModel(modelId, {
|
|
143
|
+
...getCommonModelConfig('completion'),
|
|
144
|
+
errorStructure: fireworksErrorStructure,
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const createEmbeddingModel = (modelId: FireworksEmbeddingModelId) =>
|
|
148
|
+
new OpenAICompatibleEmbeddingModel(modelId, {
|
|
149
|
+
...getCommonModelConfig('embedding'),
|
|
150
|
+
errorStructure: fireworksErrorStructure,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const createImageModel = (modelId: FireworksImageModelId) =>
|
|
154
|
+
new FireworksImageModel(modelId, {
|
|
155
|
+
...getCommonModelConfig('image'),
|
|
156
|
+
baseURL: baseURL ?? defaultBaseURL,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const provider = (modelId: FireworksChatModelId) => createChatModel(modelId);
|
|
160
|
+
|
|
161
|
+
provider.specificationVersion = 'v3' as const;
|
|
162
|
+
provider.completionModel = createCompletionModel;
|
|
163
|
+
provider.chatModel = createChatModel;
|
|
164
|
+
provider.languageModel = createChatModel;
|
|
165
|
+
provider.embeddingModel = createEmbeddingModel;
|
|
166
|
+
provider.textEmbeddingModel = createEmbeddingModel;
|
|
167
|
+
provider.image = createImageModel;
|
|
168
|
+
provider.imageModel = createImageModel;
|
|
169
|
+
return provider;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const fireworks = createFireworks();
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
FireworksEmbeddingModelId,
|
|
3
|
+
FireworksEmbeddingProviderOptions,
|
|
4
|
+
} from './fireworks-embedding-options';
|
|
5
|
+
export { FireworksImageModel } from './fireworks-image-model';
|
|
6
|
+
export type { FireworksImageModelId } from './fireworks-image-options';
|
|
7
|
+
export { fireworks, createFireworks } from './fireworks-provider';
|
|
8
|
+
export type {
|
|
9
|
+
FireworksProvider,
|
|
10
|
+
FireworksProviderSettings,
|
|
11
|
+
FireworksErrorData,
|
|
12
|
+
} from './fireworks-provider';
|
|
13
|
+
export { VERSION } from './version';
|