@ai-sdk/xai 1.2.16 → 2.0.0-alpha.10
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 +310 -40
- package/dist/index.d.mts +38 -24
- package/dist/index.d.ts +38 -24
- package/dist/index.js +666 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +675 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,84 +1,354 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 2.0.0-alpha.10
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [
|
|
8
|
-
- @ai-sdk/provider
|
|
9
|
-
- @ai-sdk/openai-compatible@0.
|
|
7
|
+
- Updated dependencies [c4df419]
|
|
8
|
+
- @ai-sdk/provider@2.0.0-alpha.10
|
|
9
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.10
|
|
10
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.10
|
|
10
11
|
|
|
11
|
-
##
|
|
12
|
+
## 2.0.0-alpha.9
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- b94b4ed: add live search
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 107cd62: Add native XAI chat language model implementation
|
|
21
|
+
- Updated dependencies [811dff3]
|
|
22
|
+
- @ai-sdk/provider@2.0.0-alpha.9
|
|
23
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.9
|
|
24
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.9
|
|
25
|
+
|
|
26
|
+
## 2.0.0-alpha.8
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [4fef487]
|
|
31
|
+
- Updated dependencies [9222aeb]
|
|
32
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.8
|
|
33
|
+
- @ai-sdk/provider@2.0.0-alpha.8
|
|
34
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.8
|
|
35
|
+
|
|
36
|
+
## 2.0.0-alpha.7
|
|
12
37
|
|
|
13
38
|
### Patch Changes
|
|
14
39
|
|
|
15
|
-
- Updated dependencies [
|
|
16
|
-
- @ai-sdk/
|
|
40
|
+
- Updated dependencies [5c56081]
|
|
41
|
+
- @ai-sdk/provider@2.0.0-alpha.7
|
|
42
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.7
|
|
43
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.7
|
|
17
44
|
|
|
18
|
-
##
|
|
45
|
+
## 2.0.0-alpha.6
|
|
19
46
|
|
|
20
47
|
### Patch Changes
|
|
21
48
|
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- @ai-sdk/openai-compatible@0.
|
|
49
|
+
- Updated dependencies [0d2c085]
|
|
50
|
+
- @ai-sdk/provider@2.0.0-alpha.6
|
|
51
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.6
|
|
52
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.6
|
|
25
53
|
|
|
26
|
-
##
|
|
54
|
+
## 2.0.0-alpha.4
|
|
27
55
|
|
|
28
56
|
### Patch Changes
|
|
29
57
|
|
|
30
|
-
- Updated dependencies [
|
|
31
|
-
- @ai-sdk/
|
|
58
|
+
- Updated dependencies [dc714f3]
|
|
59
|
+
- @ai-sdk/provider@2.0.0-alpha.4
|
|
60
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.4
|
|
61
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.4
|
|
32
62
|
|
|
33
|
-
##
|
|
63
|
+
## 2.0.0-alpha.3
|
|
34
64
|
|
|
35
65
|
### Patch Changes
|
|
36
66
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
- @ai-sdk/provider@
|
|
41
|
-
- @ai-sdk/openai-compatible@0.2.10
|
|
42
|
-
- @ai-sdk/provider-utils@2.2.7
|
|
67
|
+
- Updated dependencies [6b98118]
|
|
68
|
+
- @ai-sdk/provider@2.0.0-alpha.3
|
|
69
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.3
|
|
70
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.3
|
|
43
71
|
|
|
44
|
-
##
|
|
72
|
+
## 2.0.0-alpha.2
|
|
45
73
|
|
|
46
74
|
### Patch Changes
|
|
47
75
|
|
|
48
|
-
- Updated dependencies [
|
|
49
|
-
- @ai-sdk/
|
|
76
|
+
- Updated dependencies [26535e0]
|
|
77
|
+
- @ai-sdk/provider@2.0.0-alpha.2
|
|
78
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.2
|
|
79
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.2
|
|
50
80
|
|
|
51
|
-
##
|
|
81
|
+
## 2.0.0-alpha.1
|
|
52
82
|
|
|
53
83
|
### Patch Changes
|
|
54
84
|
|
|
55
|
-
-
|
|
85
|
+
- Updated dependencies [3f2f00c]
|
|
86
|
+
- @ai-sdk/provider@2.0.0-alpha.1
|
|
87
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.1
|
|
88
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.1
|
|
56
89
|
|
|
57
|
-
##
|
|
90
|
+
## 2.0.0-canary.19
|
|
58
91
|
|
|
59
92
|
### Patch Changes
|
|
60
93
|
|
|
61
|
-
- Updated dependencies [
|
|
62
|
-
- @ai-sdk/provider@
|
|
63
|
-
- @ai-sdk/openai-compatible@0.
|
|
64
|
-
|
|
94
|
+
- Updated dependencies [faf8446]
|
|
95
|
+
- @ai-sdk/provider-utils@3.0.0-canary.19
|
|
96
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.19
|
|
97
|
+
|
|
98
|
+
## 2.0.0-canary.18
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Updated dependencies [40acf9b]
|
|
103
|
+
- @ai-sdk/provider-utils@3.0.0-canary.18
|
|
104
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.18
|
|
105
|
+
|
|
106
|
+
## 2.0.0-canary.17
|
|
107
|
+
|
|
108
|
+
### Major Changes
|
|
109
|
+
|
|
110
|
+
- 516be5b: ### Move Image Model Settings into generate options
|
|
111
|
+
|
|
112
|
+
Image Models no longer have settings. Instead, `maxImagesPerCall` can be passed directly to `generateImage()`. All other image settings can be passed to `providerOptions[provider]`.
|
|
113
|
+
|
|
114
|
+
Before
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
await generateImage({
|
|
118
|
+
model: luma.image('photon-flash-1', {
|
|
119
|
+
maxImagesPerCall: 5,
|
|
120
|
+
pollIntervalMillis: 500,
|
|
121
|
+
}),
|
|
122
|
+
prompt,
|
|
123
|
+
n: 10,
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
After
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
await generateImage({
|
|
131
|
+
model: luma.image('photon-flash-1'),
|
|
132
|
+
prompt,
|
|
133
|
+
n: 10,
|
|
134
|
+
maxImagesPerCall: 5,
|
|
135
|
+
providerOptions: {
|
|
136
|
+
luma: { pollIntervalMillis: 5 },
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
```
|
|
65
140
|
|
|
66
|
-
|
|
141
|
+
Pull Request: https://github.com/vercel/ai/pull/6180
|
|
67
142
|
|
|
68
143
|
### Patch Changes
|
|
69
144
|
|
|
70
|
-
- Updated dependencies [
|
|
71
|
-
|
|
72
|
-
- @ai-sdk/
|
|
73
|
-
- @ai-sdk/
|
|
145
|
+
- Updated dependencies [516be5b]
|
|
146
|
+
- Updated dependencies [ea7a7c9]
|
|
147
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.17
|
|
148
|
+
- @ai-sdk/provider-utils@3.0.0-canary.17
|
|
149
|
+
|
|
150
|
+
## 2.0.0-canary.16
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- Updated dependencies [87b828f]
|
|
155
|
+
- @ai-sdk/provider-utils@3.0.0-canary.16
|
|
156
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.16
|
|
157
|
+
|
|
158
|
+
## 2.0.0-canary.15
|
|
159
|
+
|
|
160
|
+
### Patch Changes
|
|
161
|
+
|
|
162
|
+
- Updated dependencies [a571d6e]
|
|
163
|
+
- Updated dependencies [a8c8bd5]
|
|
164
|
+
- Updated dependencies [7979f7f]
|
|
165
|
+
- Updated dependencies [41fa418]
|
|
166
|
+
- @ai-sdk/provider-utils@3.0.0-canary.15
|
|
167
|
+
- @ai-sdk/provider@2.0.0-canary.14
|
|
168
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.15
|
|
169
|
+
|
|
170
|
+
## 2.0.0-canary.14
|
|
171
|
+
|
|
172
|
+
### Patch Changes
|
|
173
|
+
|
|
174
|
+
- Updated dependencies [957b739]
|
|
175
|
+
- Updated dependencies [9bd5ab5]
|
|
176
|
+
- @ai-sdk/provider-utils@3.0.0-canary.14
|
|
177
|
+
- @ai-sdk/provider@2.0.0-canary.13
|
|
178
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.14
|
|
179
|
+
|
|
180
|
+
## 2.0.0-canary.13
|
|
181
|
+
|
|
182
|
+
### Patch Changes
|
|
183
|
+
|
|
184
|
+
- Updated dependencies [7b3ae3f]
|
|
185
|
+
- Updated dependencies [d9209ca]
|
|
186
|
+
- Updated dependencies [0ff02bb]
|
|
187
|
+
- @ai-sdk/provider@2.0.0-canary.12
|
|
188
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.13
|
|
189
|
+
- @ai-sdk/provider-utils@3.0.0-canary.13
|
|
190
|
+
|
|
191
|
+
## 2.0.0-canary.12
|
|
192
|
+
|
|
193
|
+
### Patch Changes
|
|
194
|
+
|
|
195
|
+
- Updated dependencies [9bf7291]
|
|
196
|
+
- Updated dependencies [4617fab]
|
|
197
|
+
- Updated dependencies [e030615]
|
|
198
|
+
- @ai-sdk/provider@2.0.0-canary.11
|
|
199
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.12
|
|
200
|
+
- @ai-sdk/provider-utils@3.0.0-canary.12
|
|
201
|
+
|
|
202
|
+
## 2.0.0-canary.11
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- 9301f86: refactor (image-model): rename `ImageModelV1` to `ImageModelV2`
|
|
207
|
+
- Updated dependencies [db72adc]
|
|
208
|
+
- Updated dependencies [42e32b0]
|
|
209
|
+
- Updated dependencies [66962ed]
|
|
210
|
+
- Updated dependencies [9301f86]
|
|
211
|
+
- Updated dependencies [a3f768e]
|
|
212
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.11
|
|
213
|
+
- @ai-sdk/provider-utils@3.0.0-canary.11
|
|
214
|
+
- @ai-sdk/provider@2.0.0-canary.10
|
|
215
|
+
|
|
216
|
+
## 2.0.0-canary.10
|
|
217
|
+
|
|
218
|
+
### Patch Changes
|
|
219
|
+
|
|
220
|
+
- cf8280e: fix(providers/xai): return actual usage when streaming instead of NaN
|
|
221
|
+
- Updated dependencies [cf8280e]
|
|
222
|
+
- Updated dependencies [e86be6f]
|
|
223
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.10
|
|
224
|
+
- @ai-sdk/provider@2.0.0-canary.9
|
|
225
|
+
- @ai-sdk/provider-utils@3.0.0-canary.10
|
|
226
|
+
|
|
227
|
+
## 2.0.0-canary.9
|
|
228
|
+
|
|
229
|
+
### Patch Changes
|
|
230
|
+
|
|
231
|
+
- Updated dependencies [95857aa]
|
|
232
|
+
- Updated dependencies [7ea4132]
|
|
233
|
+
- @ai-sdk/provider@2.0.0-canary.8
|
|
234
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.9
|
|
235
|
+
- @ai-sdk/provider-utils@3.0.0-canary.9
|
|
236
|
+
|
|
237
|
+
## 2.0.0-canary.8
|
|
238
|
+
|
|
239
|
+
### Patch Changes
|
|
240
|
+
|
|
241
|
+
- Updated dependencies [5d142ab]
|
|
242
|
+
- Updated dependencies [b6b43c7]
|
|
243
|
+
- Updated dependencies [b9a6121]
|
|
244
|
+
- Updated dependencies [8aa9e20]
|
|
245
|
+
- Updated dependencies [3795467]
|
|
246
|
+
- @ai-sdk/provider-utils@3.0.0-canary.8
|
|
247
|
+
- @ai-sdk/provider@2.0.0-canary.7
|
|
248
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.8
|
|
249
|
+
|
|
250
|
+
## 2.0.0-canary.7
|
|
251
|
+
|
|
252
|
+
### Patch Changes
|
|
253
|
+
|
|
254
|
+
- 41cab5c: fix(providers/xai): edit supported models for structured output
|
|
255
|
+
- fa49207: feat(providers/openai-compatible): convert to providerOptions
|
|
256
|
+
- d9b26f2: chore (providers/xai): update grok-3 model aliases
|
|
257
|
+
- Updated dependencies [fa49207]
|
|
258
|
+
- Updated dependencies [26735b5]
|
|
259
|
+
- Updated dependencies [443d8ec]
|
|
260
|
+
- Updated dependencies [14c9410]
|
|
261
|
+
- Updated dependencies [d9c98f4]
|
|
262
|
+
- Updated dependencies [c4a2fec]
|
|
263
|
+
- Updated dependencies [0054544]
|
|
264
|
+
- Updated dependencies [9e9c809]
|
|
265
|
+
- Updated dependencies [32831c6]
|
|
266
|
+
- Updated dependencies [d0f9495]
|
|
267
|
+
- Updated dependencies [fd65bc6]
|
|
268
|
+
- Updated dependencies [393138b]
|
|
269
|
+
- Updated dependencies [7182d14]
|
|
270
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.7
|
|
271
|
+
- @ai-sdk/provider@2.0.0-canary.6
|
|
272
|
+
- @ai-sdk/provider-utils@3.0.0-canary.7
|
|
273
|
+
|
|
274
|
+
## 2.0.0-canary.6
|
|
275
|
+
|
|
276
|
+
### Patch Changes
|
|
277
|
+
|
|
278
|
+
- Updated dependencies [6db02c9]
|
|
279
|
+
- Updated dependencies [411e483]
|
|
280
|
+
- Updated dependencies [79457bd]
|
|
281
|
+
- Updated dependencies [ad80501]
|
|
282
|
+
- Updated dependencies [1766ede]
|
|
283
|
+
- Updated dependencies [f10304b]
|
|
284
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.6
|
|
285
|
+
- @ai-sdk/provider@2.0.0-canary.5
|
|
286
|
+
- @ai-sdk/provider-utils@3.0.0-canary.6
|
|
287
|
+
|
|
288
|
+
## 2.0.0-canary.5
|
|
289
|
+
|
|
290
|
+
### Patch Changes
|
|
291
|
+
|
|
292
|
+
- a7d3fbd: feat (providers/xai): add grok-3 models
|
|
293
|
+
- Updated dependencies [6f6bb89]
|
|
294
|
+
- @ai-sdk/provider@2.0.0-canary.4
|
|
295
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.5
|
|
296
|
+
- @ai-sdk/provider-utils@3.0.0-canary.5
|
|
297
|
+
|
|
298
|
+
## 2.0.0-canary.4
|
|
299
|
+
|
|
300
|
+
### Patch Changes
|
|
301
|
+
|
|
302
|
+
- Updated dependencies [d1a1aa1]
|
|
303
|
+
- @ai-sdk/provider@2.0.0-canary.3
|
|
304
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.4
|
|
305
|
+
- @ai-sdk/provider-utils@3.0.0-canary.4
|
|
306
|
+
|
|
307
|
+
## 2.0.0-canary.3
|
|
308
|
+
|
|
309
|
+
### Patch Changes
|
|
310
|
+
|
|
311
|
+
- Updated dependencies [a166433]
|
|
312
|
+
- Updated dependencies [abf9a79]
|
|
313
|
+
- Updated dependencies [9f95b35]
|
|
314
|
+
- Updated dependencies [0a87932]
|
|
315
|
+
- Updated dependencies [6dc848c]
|
|
316
|
+
- @ai-sdk/provider-utils@3.0.0-canary.3
|
|
317
|
+
- @ai-sdk/provider@2.0.0-canary.2
|
|
318
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.3
|
|
319
|
+
|
|
320
|
+
## 2.0.0-canary.2
|
|
321
|
+
|
|
322
|
+
### Patch Changes
|
|
323
|
+
|
|
324
|
+
- Updated dependencies [c57e248]
|
|
325
|
+
- Updated dependencies [33f4a6a]
|
|
326
|
+
- @ai-sdk/provider@2.0.0-canary.1
|
|
327
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.2
|
|
328
|
+
- @ai-sdk/provider-utils@3.0.0-canary.2
|
|
329
|
+
|
|
330
|
+
## 2.0.0-canary.1
|
|
331
|
+
|
|
332
|
+
### Patch Changes
|
|
333
|
+
|
|
334
|
+
- Updated dependencies [060370c]
|
|
335
|
+
- Updated dependencies [0c0c0b3]
|
|
336
|
+
- Updated dependencies [63d791d]
|
|
337
|
+
- @ai-sdk/provider-utils@3.0.0-canary.1
|
|
338
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.1
|
|
339
|
+
|
|
340
|
+
## 2.0.0-canary.0
|
|
341
|
+
|
|
342
|
+
### Major Changes
|
|
74
343
|
|
|
75
|
-
|
|
344
|
+
- d5f588f: AI SDK 5
|
|
76
345
|
|
|
77
346
|
### Patch Changes
|
|
78
347
|
|
|
79
|
-
- Updated dependencies [
|
|
80
|
-
- @ai-sdk/provider-utils@
|
|
81
|
-
- @ai-sdk/openai-compatible@0.
|
|
348
|
+
- Updated dependencies [d5f588f]
|
|
349
|
+
- @ai-sdk/provider-utils@3.0.0-canary.0
|
|
350
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.0
|
|
351
|
+
- @ai-sdk/provider@2.0.0-canary.0
|
|
82
352
|
|
|
83
353
|
## 1.2.6
|
|
84
354
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProviderV2, LanguageModelV2, ImageModelV2 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { OpenAICompatibleChatSettings } from '@ai-sdk/openai-compatible';
|
|
4
3
|
import { z } from 'zod';
|
|
5
4
|
|
|
6
5
|
type XaiChatModelId = 'grok-3' | 'grok-3-latest' | 'grok-3-fast' | 'grok-3-fast-latest' | 'grok-3-mini' | 'grok-3-mini-latest' | 'grok-3-mini-fast' | 'grok-3-mini-fast-latest' | 'grok-2-vision-1212' | 'grok-2-vision' | 'grok-2-vision-latest' | 'grok-2-image-1212' | 'grok-2-image' | 'grok-2-image-latest' | 'grok-2-1212' | 'grok-2' | 'grok-2-latest' | 'grok-vision-beta' | 'grok-beta' | (string & {});
|
|
7
|
-
interface XaiChatSettings extends OpenAICompatibleChatSettings {
|
|
8
|
-
}
|
|
9
6
|
|
|
10
7
|
type XaiImageModelId = 'grok-2-image' | (string & {});
|
|
11
|
-
interface XaiImageSettings {
|
|
12
|
-
/**
|
|
13
|
-
Override the maximum number of images per call. Default is 10.
|
|
14
|
-
*/
|
|
15
|
-
maxImagesPerCall?: number;
|
|
16
|
-
}
|
|
17
8
|
|
|
18
|
-
interface XaiProvider extends
|
|
9
|
+
interface XaiProvider extends ProviderV2 {
|
|
19
10
|
/**
|
|
20
11
|
Creates an Xai chat model for text generation.
|
|
21
12
|
*/
|
|
22
|
-
(modelId: XaiChatModelId
|
|
13
|
+
(modelId: XaiChatModelId): LanguageModelV2;
|
|
23
14
|
/**
|
|
24
15
|
Creates an Xai language model for text generation.
|
|
25
16
|
*/
|
|
26
|
-
languageModel(modelId: XaiChatModelId
|
|
17
|
+
languageModel(modelId: XaiChatModelId): LanguageModelV2;
|
|
27
18
|
/**
|
|
28
19
|
Creates an Xai chat model for text generation.
|
|
29
20
|
*/
|
|
30
|
-
chat: (modelId: XaiChatModelId
|
|
21
|
+
chat: (modelId: XaiChatModelId) => LanguageModelV2;
|
|
31
22
|
/**
|
|
32
23
|
Creates an Xai image model for image generation.
|
|
24
|
+
@deprecated Use `imageModel` instead.
|
|
33
25
|
*/
|
|
34
|
-
image(modelId: XaiImageModelId
|
|
26
|
+
image(modelId: XaiImageModelId): ImageModelV2;
|
|
35
27
|
/**
|
|
36
28
|
Creates an Xai image model for image generation.
|
|
37
29
|
*/
|
|
38
|
-
imageModel(modelId: XaiImageModelId
|
|
30
|
+
imageModel(modelId: XaiImageModelId): ImageModelV2;
|
|
39
31
|
}
|
|
40
32
|
interface XaiProviderSettings {
|
|
41
33
|
/**
|
|
@@ -59,16 +51,38 @@ interface XaiProviderSettings {
|
|
|
59
51
|
declare function createXai(options?: XaiProviderSettings): XaiProvider;
|
|
60
52
|
declare const xai: XaiProvider;
|
|
61
53
|
|
|
62
|
-
declare const
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
declare const xaiErrorDataSchema: z.ZodObject<{
|
|
55
|
+
error: z.ZodObject<{
|
|
56
|
+
message: z.ZodString;
|
|
57
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
param: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
59
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
message: string;
|
|
62
|
+
type?: string | null | undefined;
|
|
63
|
+
code?: string | number | null | undefined;
|
|
64
|
+
param?: any;
|
|
65
|
+
}, {
|
|
66
|
+
message: string;
|
|
67
|
+
type?: string | null | undefined;
|
|
68
|
+
code?: string | number | null | undefined;
|
|
69
|
+
param?: any;
|
|
70
|
+
}>;
|
|
65
71
|
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
error: {
|
|
73
|
+
message: string;
|
|
74
|
+
type?: string | null | undefined;
|
|
75
|
+
code?: string | number | null | undefined;
|
|
76
|
+
param?: any;
|
|
77
|
+
};
|
|
68
78
|
}, {
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
error: {
|
|
80
|
+
message: string;
|
|
81
|
+
type?: string | null | undefined;
|
|
82
|
+
code?: string | number | null | undefined;
|
|
83
|
+
param?: any;
|
|
84
|
+
};
|
|
71
85
|
}>;
|
|
72
|
-
type XaiErrorData = z.infer<typeof
|
|
86
|
+
type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
|
|
73
87
|
|
|
74
88
|
export { type XaiErrorData, type XaiProvider, type XaiProviderSettings, createXai, xai };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProviderV2, LanguageModelV2, ImageModelV2 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { OpenAICompatibleChatSettings } from '@ai-sdk/openai-compatible';
|
|
4
3
|
import { z } from 'zod';
|
|
5
4
|
|
|
6
5
|
type XaiChatModelId = 'grok-3' | 'grok-3-latest' | 'grok-3-fast' | 'grok-3-fast-latest' | 'grok-3-mini' | 'grok-3-mini-latest' | 'grok-3-mini-fast' | 'grok-3-mini-fast-latest' | 'grok-2-vision-1212' | 'grok-2-vision' | 'grok-2-vision-latest' | 'grok-2-image-1212' | 'grok-2-image' | 'grok-2-image-latest' | 'grok-2-1212' | 'grok-2' | 'grok-2-latest' | 'grok-vision-beta' | 'grok-beta' | (string & {});
|
|
7
|
-
interface XaiChatSettings extends OpenAICompatibleChatSettings {
|
|
8
|
-
}
|
|
9
6
|
|
|
10
7
|
type XaiImageModelId = 'grok-2-image' | (string & {});
|
|
11
|
-
interface XaiImageSettings {
|
|
12
|
-
/**
|
|
13
|
-
Override the maximum number of images per call. Default is 10.
|
|
14
|
-
*/
|
|
15
|
-
maxImagesPerCall?: number;
|
|
16
|
-
}
|
|
17
8
|
|
|
18
|
-
interface XaiProvider extends
|
|
9
|
+
interface XaiProvider extends ProviderV2 {
|
|
19
10
|
/**
|
|
20
11
|
Creates an Xai chat model for text generation.
|
|
21
12
|
*/
|
|
22
|
-
(modelId: XaiChatModelId
|
|
13
|
+
(modelId: XaiChatModelId): LanguageModelV2;
|
|
23
14
|
/**
|
|
24
15
|
Creates an Xai language model for text generation.
|
|
25
16
|
*/
|
|
26
|
-
languageModel(modelId: XaiChatModelId
|
|
17
|
+
languageModel(modelId: XaiChatModelId): LanguageModelV2;
|
|
27
18
|
/**
|
|
28
19
|
Creates an Xai chat model for text generation.
|
|
29
20
|
*/
|
|
30
|
-
chat: (modelId: XaiChatModelId
|
|
21
|
+
chat: (modelId: XaiChatModelId) => LanguageModelV2;
|
|
31
22
|
/**
|
|
32
23
|
Creates an Xai image model for image generation.
|
|
24
|
+
@deprecated Use `imageModel` instead.
|
|
33
25
|
*/
|
|
34
|
-
image(modelId: XaiImageModelId
|
|
26
|
+
image(modelId: XaiImageModelId): ImageModelV2;
|
|
35
27
|
/**
|
|
36
28
|
Creates an Xai image model for image generation.
|
|
37
29
|
*/
|
|
38
|
-
imageModel(modelId: XaiImageModelId
|
|
30
|
+
imageModel(modelId: XaiImageModelId): ImageModelV2;
|
|
39
31
|
}
|
|
40
32
|
interface XaiProviderSettings {
|
|
41
33
|
/**
|
|
@@ -59,16 +51,38 @@ interface XaiProviderSettings {
|
|
|
59
51
|
declare function createXai(options?: XaiProviderSettings): XaiProvider;
|
|
60
52
|
declare const xai: XaiProvider;
|
|
61
53
|
|
|
62
|
-
declare const
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
declare const xaiErrorDataSchema: z.ZodObject<{
|
|
55
|
+
error: z.ZodObject<{
|
|
56
|
+
message: z.ZodString;
|
|
57
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
param: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
59
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
message: string;
|
|
62
|
+
type?: string | null | undefined;
|
|
63
|
+
code?: string | number | null | undefined;
|
|
64
|
+
param?: any;
|
|
65
|
+
}, {
|
|
66
|
+
message: string;
|
|
67
|
+
type?: string | null | undefined;
|
|
68
|
+
code?: string | number | null | undefined;
|
|
69
|
+
param?: any;
|
|
70
|
+
}>;
|
|
65
71
|
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
error: {
|
|
73
|
+
message: string;
|
|
74
|
+
type?: string | null | undefined;
|
|
75
|
+
code?: string | number | null | undefined;
|
|
76
|
+
param?: any;
|
|
77
|
+
};
|
|
68
78
|
}, {
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
error: {
|
|
80
|
+
message: string;
|
|
81
|
+
type?: string | null | undefined;
|
|
82
|
+
code?: string | number | null | undefined;
|
|
83
|
+
param?: any;
|
|
84
|
+
};
|
|
71
85
|
}>;
|
|
72
|
-
type XaiErrorData = z.infer<typeof
|
|
86
|
+
type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
|
|
73
87
|
|
|
74
88
|
export { type XaiErrorData, type XaiProvider, type XaiProviderSettings, createXai, xai };
|