@ai-sdk/xai 1.2.15 → 2.0.0-alpha.1
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 +236 -36
- package/README.md +2 -2
- package/dist/index.d.mts +8 -16
- package/dist/index.d.ts +8 -16
- package/dist/index.js +7 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,76 +1,276 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 2.0.0-alpha.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [
|
|
8
|
-
- @ai-sdk/
|
|
7
|
+
- Updated dependencies [3f2f00c]
|
|
8
|
+
- @ai-sdk/provider@2.0.0-alpha.1
|
|
9
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.1
|
|
10
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.1
|
|
9
11
|
|
|
10
|
-
##
|
|
12
|
+
## 2.0.0-canary.19
|
|
11
13
|
|
|
12
14
|
### Patch Changes
|
|
13
15
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- @ai-sdk/openai-compatible@0.
|
|
16
|
+
- Updated dependencies [faf8446]
|
|
17
|
+
- @ai-sdk/provider-utils@3.0.0-canary.19
|
|
18
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.19
|
|
17
19
|
|
|
18
|
-
##
|
|
20
|
+
## 2.0.0-canary.18
|
|
19
21
|
|
|
20
22
|
### Patch Changes
|
|
21
23
|
|
|
22
|
-
- Updated dependencies [
|
|
23
|
-
- @ai-sdk/
|
|
24
|
+
- Updated dependencies [40acf9b]
|
|
25
|
+
- @ai-sdk/provider-utils@3.0.0-canary.18
|
|
26
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.18
|
|
24
27
|
|
|
25
|
-
##
|
|
28
|
+
## 2.0.0-canary.17
|
|
29
|
+
|
|
30
|
+
### Major Changes
|
|
31
|
+
|
|
32
|
+
- 516be5b: ### Move Image Model Settings into generate options
|
|
33
|
+
|
|
34
|
+
Image Models no longer have settings. Instead, `maxImagesPerCall` can be passed directly to `generateImage()`. All other image settings can be passed to `providerOptions[provider]`.
|
|
35
|
+
|
|
36
|
+
Before
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
await generateImage({
|
|
40
|
+
model: luma.image('photon-flash-1', {
|
|
41
|
+
maxImagesPerCall: 5,
|
|
42
|
+
pollIntervalMillis: 500,
|
|
43
|
+
}),
|
|
44
|
+
prompt,
|
|
45
|
+
n: 10,
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
After
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
await generateImage({
|
|
53
|
+
model: luma.image('photon-flash-1'),
|
|
54
|
+
prompt,
|
|
55
|
+
n: 10,
|
|
56
|
+
maxImagesPerCall: 5,
|
|
57
|
+
providerOptions: {
|
|
58
|
+
luma: { pollIntervalMillis: 5 },
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Pull Request: https://github.com/vercel/ai/pull/6180
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- Updated dependencies [516be5b]
|
|
68
|
+
- Updated dependencies [ea7a7c9]
|
|
69
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.17
|
|
70
|
+
- @ai-sdk/provider-utils@3.0.0-canary.17
|
|
71
|
+
|
|
72
|
+
## 2.0.0-canary.16
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- Updated dependencies [87b828f]
|
|
77
|
+
- @ai-sdk/provider-utils@3.0.0-canary.16
|
|
78
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.16
|
|
79
|
+
|
|
80
|
+
## 2.0.0-canary.15
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [a571d6e]
|
|
85
|
+
- Updated dependencies [a8c8bd5]
|
|
86
|
+
- Updated dependencies [7979f7f]
|
|
87
|
+
- Updated dependencies [41fa418]
|
|
88
|
+
- @ai-sdk/provider-utils@3.0.0-canary.15
|
|
89
|
+
- @ai-sdk/provider@2.0.0-canary.14
|
|
90
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.15
|
|
91
|
+
|
|
92
|
+
## 2.0.0-canary.14
|
|
93
|
+
|
|
94
|
+
### Patch Changes
|
|
95
|
+
|
|
96
|
+
- Updated dependencies [957b739]
|
|
97
|
+
- Updated dependencies [9bd5ab5]
|
|
98
|
+
- @ai-sdk/provider-utils@3.0.0-canary.14
|
|
99
|
+
- @ai-sdk/provider@2.0.0-canary.13
|
|
100
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.14
|
|
101
|
+
|
|
102
|
+
## 2.0.0-canary.13
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- Updated dependencies [7b3ae3f]
|
|
107
|
+
- Updated dependencies [d9209ca]
|
|
108
|
+
- Updated dependencies [0ff02bb]
|
|
109
|
+
- @ai-sdk/provider@2.0.0-canary.12
|
|
110
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.13
|
|
111
|
+
- @ai-sdk/provider-utils@3.0.0-canary.13
|
|
112
|
+
|
|
113
|
+
## 2.0.0-canary.12
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- Updated dependencies [9bf7291]
|
|
118
|
+
- Updated dependencies [4617fab]
|
|
119
|
+
- Updated dependencies [e030615]
|
|
120
|
+
- @ai-sdk/provider@2.0.0-canary.11
|
|
121
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.12
|
|
122
|
+
- @ai-sdk/provider-utils@3.0.0-canary.12
|
|
123
|
+
|
|
124
|
+
## 2.0.0-canary.11
|
|
125
|
+
|
|
126
|
+
### Patch Changes
|
|
127
|
+
|
|
128
|
+
- 9301f86: refactor (image-model): rename `ImageModelV1` to `ImageModelV2`
|
|
129
|
+
- Updated dependencies [db72adc]
|
|
130
|
+
- Updated dependencies [42e32b0]
|
|
131
|
+
- Updated dependencies [66962ed]
|
|
132
|
+
- Updated dependencies [9301f86]
|
|
133
|
+
- Updated dependencies [a3f768e]
|
|
134
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.11
|
|
135
|
+
- @ai-sdk/provider-utils@3.0.0-canary.11
|
|
136
|
+
- @ai-sdk/provider@2.0.0-canary.10
|
|
137
|
+
|
|
138
|
+
## 2.0.0-canary.10
|
|
139
|
+
|
|
140
|
+
### Patch Changes
|
|
141
|
+
|
|
142
|
+
- cf8280e: fix(providers/xai): return actual usage when streaming instead of NaN
|
|
143
|
+
- Updated dependencies [cf8280e]
|
|
144
|
+
- Updated dependencies [e86be6f]
|
|
145
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.10
|
|
146
|
+
- @ai-sdk/provider@2.0.0-canary.9
|
|
147
|
+
- @ai-sdk/provider-utils@3.0.0-canary.10
|
|
148
|
+
|
|
149
|
+
## 2.0.0-canary.9
|
|
150
|
+
|
|
151
|
+
### Patch Changes
|
|
152
|
+
|
|
153
|
+
- Updated dependencies [95857aa]
|
|
154
|
+
- Updated dependencies [7ea4132]
|
|
155
|
+
- @ai-sdk/provider@2.0.0-canary.8
|
|
156
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.9
|
|
157
|
+
- @ai-sdk/provider-utils@3.0.0-canary.9
|
|
158
|
+
|
|
159
|
+
## 2.0.0-canary.8
|
|
26
160
|
|
|
27
161
|
### Patch Changes
|
|
28
162
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- Updated dependencies [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- @ai-sdk/provider-utils@
|
|
163
|
+
- Updated dependencies [5d142ab]
|
|
164
|
+
- Updated dependencies [b6b43c7]
|
|
165
|
+
- Updated dependencies [b9a6121]
|
|
166
|
+
- Updated dependencies [8aa9e20]
|
|
167
|
+
- Updated dependencies [3795467]
|
|
168
|
+
- @ai-sdk/provider-utils@3.0.0-canary.8
|
|
169
|
+
- @ai-sdk/provider@2.0.0-canary.7
|
|
170
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.8
|
|
35
171
|
|
|
36
|
-
##
|
|
172
|
+
## 2.0.0-canary.7
|
|
37
173
|
|
|
38
174
|
### Patch Changes
|
|
39
175
|
|
|
40
|
-
-
|
|
41
|
-
|
|
176
|
+
- 41cab5c: fix(providers/xai): edit supported models for structured output
|
|
177
|
+
- fa49207: feat(providers/openai-compatible): convert to providerOptions
|
|
178
|
+
- d9b26f2: chore (providers/xai): update grok-3 model aliases
|
|
179
|
+
- Updated dependencies [fa49207]
|
|
180
|
+
- Updated dependencies [26735b5]
|
|
181
|
+
- Updated dependencies [443d8ec]
|
|
182
|
+
- Updated dependencies [14c9410]
|
|
183
|
+
- Updated dependencies [d9c98f4]
|
|
184
|
+
- Updated dependencies [c4a2fec]
|
|
185
|
+
- Updated dependencies [0054544]
|
|
186
|
+
- Updated dependencies [9e9c809]
|
|
187
|
+
- Updated dependencies [32831c6]
|
|
188
|
+
- Updated dependencies [d0f9495]
|
|
189
|
+
- Updated dependencies [fd65bc6]
|
|
190
|
+
- Updated dependencies [393138b]
|
|
191
|
+
- Updated dependencies [7182d14]
|
|
192
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.7
|
|
193
|
+
- @ai-sdk/provider@2.0.0-canary.6
|
|
194
|
+
- @ai-sdk/provider-utils@3.0.0-canary.7
|
|
42
195
|
|
|
43
|
-
##
|
|
196
|
+
## 2.0.0-canary.6
|
|
44
197
|
|
|
45
198
|
### Patch Changes
|
|
46
199
|
|
|
47
|
-
-
|
|
200
|
+
- Updated dependencies [6db02c9]
|
|
201
|
+
- Updated dependencies [411e483]
|
|
202
|
+
- Updated dependencies [79457bd]
|
|
203
|
+
- Updated dependencies [ad80501]
|
|
204
|
+
- Updated dependencies [1766ede]
|
|
205
|
+
- Updated dependencies [f10304b]
|
|
206
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.6
|
|
207
|
+
- @ai-sdk/provider@2.0.0-canary.5
|
|
208
|
+
- @ai-sdk/provider-utils@3.0.0-canary.6
|
|
48
209
|
|
|
49
|
-
##
|
|
210
|
+
## 2.0.0-canary.5
|
|
50
211
|
|
|
51
212
|
### Patch Changes
|
|
52
213
|
|
|
53
|
-
-
|
|
54
|
-
|
|
55
|
-
- @ai-sdk/
|
|
56
|
-
- @ai-sdk/
|
|
214
|
+
- a7d3fbd: feat (providers/xai): add grok-3 models
|
|
215
|
+
- Updated dependencies [6f6bb89]
|
|
216
|
+
- @ai-sdk/provider@2.0.0-canary.4
|
|
217
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.5
|
|
218
|
+
- @ai-sdk/provider-utils@3.0.0-canary.5
|
|
57
219
|
|
|
58
|
-
##
|
|
220
|
+
## 2.0.0-canary.4
|
|
59
221
|
|
|
60
222
|
### Patch Changes
|
|
61
223
|
|
|
62
|
-
- Updated dependencies [
|
|
63
|
-
- @ai-sdk/provider
|
|
64
|
-
- @ai-sdk/
|
|
65
|
-
- @ai-sdk/
|
|
224
|
+
- Updated dependencies [d1a1aa1]
|
|
225
|
+
- @ai-sdk/provider@2.0.0-canary.3
|
|
226
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.4
|
|
227
|
+
- @ai-sdk/provider-utils@3.0.0-canary.4
|
|
228
|
+
|
|
229
|
+
## 2.0.0-canary.3
|
|
230
|
+
|
|
231
|
+
### Patch Changes
|
|
232
|
+
|
|
233
|
+
- Updated dependencies [a166433]
|
|
234
|
+
- Updated dependencies [abf9a79]
|
|
235
|
+
- Updated dependencies [9f95b35]
|
|
236
|
+
- Updated dependencies [0a87932]
|
|
237
|
+
- Updated dependencies [6dc848c]
|
|
238
|
+
- @ai-sdk/provider-utils@3.0.0-canary.3
|
|
239
|
+
- @ai-sdk/provider@2.0.0-canary.2
|
|
240
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.3
|
|
241
|
+
|
|
242
|
+
## 2.0.0-canary.2
|
|
243
|
+
|
|
244
|
+
### Patch Changes
|
|
245
|
+
|
|
246
|
+
- Updated dependencies [c57e248]
|
|
247
|
+
- Updated dependencies [33f4a6a]
|
|
248
|
+
- @ai-sdk/provider@2.0.0-canary.1
|
|
249
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.2
|
|
250
|
+
- @ai-sdk/provider-utils@3.0.0-canary.2
|
|
251
|
+
|
|
252
|
+
## 2.0.0-canary.1
|
|
253
|
+
|
|
254
|
+
### Patch Changes
|
|
255
|
+
|
|
256
|
+
- Updated dependencies [060370c]
|
|
257
|
+
- Updated dependencies [0c0c0b3]
|
|
258
|
+
- Updated dependencies [63d791d]
|
|
259
|
+
- @ai-sdk/provider-utils@3.0.0-canary.1
|
|
260
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.1
|
|
261
|
+
|
|
262
|
+
## 2.0.0-canary.0
|
|
263
|
+
|
|
264
|
+
### Major Changes
|
|
66
265
|
|
|
67
|
-
|
|
266
|
+
- d5f588f: AI SDK 5
|
|
68
267
|
|
|
69
268
|
### Patch Changes
|
|
70
269
|
|
|
71
|
-
- Updated dependencies [
|
|
72
|
-
- @ai-sdk/provider-utils@
|
|
73
|
-
- @ai-sdk/openai-compatible@0.
|
|
270
|
+
- Updated dependencies [d5f588f]
|
|
271
|
+
- @ai-sdk/provider-utils@3.0.0-canary.0
|
|
272
|
+
- @ai-sdk/openai-compatible@1.0.0-canary.0
|
|
273
|
+
- @ai-sdk/provider@2.0.0-canary.0
|
|
74
274
|
|
|
75
275
|
## 1.2.6
|
|
76
276
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AI SDK - xAI Grok Provider
|
|
2
2
|
|
|
3
|
-
The **[xAI Grok provider](https://sdk.
|
|
3
|
+
The **[xAI Grok provider](https://ai-sdk.dev/providers/ai-sdk-providers/xai)** for the [AI SDK](https://ai-sdk.dev/docs)
|
|
4
4
|
contains language model support for the xAI chat and completion APIs.
|
|
5
5
|
|
|
6
6
|
## Setup
|
|
@@ -33,4 +33,4 @@ const { text } = await generateText({
|
|
|
33
33
|
|
|
34
34
|
## Documentation
|
|
35
35
|
|
|
36
|
-
Please check out the **[xAI Grok provider documentation](https://sdk.
|
|
36
|
+
Please check out the **[xAI Grok provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/xai)** for more information.
|
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
|
/**
|
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
|
/**
|
package/dist/index.js
CHANGED
|
@@ -26,11 +26,11 @@ __export(src_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(src_exports);
|
|
27
27
|
|
|
28
28
|
// src/xai-provider.ts
|
|
29
|
-
var import_provider = require("@ai-sdk/provider");
|
|
30
29
|
var import_openai_compatible = require("@ai-sdk/openai-compatible");
|
|
30
|
+
var import_provider = require("@ai-sdk/provider");
|
|
31
31
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
|
-
// src/xai-chat-
|
|
33
|
+
// src/xai-chat-options.ts
|
|
34
34
|
function supportsStructuredOutputs(modelId) {
|
|
35
35
|
return [
|
|
36
36
|
"grok-3",
|
|
@@ -75,21 +75,20 @@ function createXai(options = {}) {
|
|
|
75
75
|
})}`,
|
|
76
76
|
...options.headers
|
|
77
77
|
});
|
|
78
|
-
const createLanguageModel = (modelId
|
|
78
|
+
const createLanguageModel = (modelId) => {
|
|
79
79
|
const structuredOutputs = supportsStructuredOutputs(modelId);
|
|
80
|
-
return new import_openai_compatible.OpenAICompatibleChatLanguageModel(modelId,
|
|
80
|
+
return new import_openai_compatible.OpenAICompatibleChatLanguageModel(modelId, {
|
|
81
81
|
provider: "xai.chat",
|
|
82
82
|
url: ({ path }) => `${baseURL}${path}`,
|
|
83
83
|
headers: getHeaders,
|
|
84
84
|
fetch: options.fetch,
|
|
85
|
-
defaultObjectGenerationMode: structuredOutputs ? "json" : "tool",
|
|
86
85
|
errorStructure: xaiErrorStructure,
|
|
87
86
|
supportsStructuredOutputs: structuredOutputs,
|
|
88
87
|
includeUsage: true
|
|
89
88
|
});
|
|
90
89
|
};
|
|
91
|
-
const createImageModel = (modelId
|
|
92
|
-
return new import_openai_compatible.OpenAICompatibleImageModel(modelId,
|
|
90
|
+
const createImageModel = (modelId) => {
|
|
91
|
+
return new import_openai_compatible.OpenAICompatibleImageModel(modelId, {
|
|
93
92
|
provider: "xai.image",
|
|
94
93
|
url: ({ path }) => `${baseURL}${path}`,
|
|
95
94
|
headers: getHeaders,
|
|
@@ -97,7 +96,7 @@ function createXai(options = {}) {
|
|
|
97
96
|
errorStructure: xaiErrorStructure
|
|
98
97
|
});
|
|
99
98
|
};
|
|
100
|
-
const provider = (modelId
|
|
99
|
+
const provider = (modelId) => createLanguageModel(modelId);
|
|
101
100
|
provider.languageModel = createLanguageModel;
|
|
102
101
|
provider.chat = createLanguageModel;
|
|
103
102
|
provider.textEmbeddingModel = (modelId) => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/xai-provider.ts","../src/xai-chat-
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/xai-provider.ts","../src/xai-chat-options.ts","../src/xai-error.ts"],"sourcesContent":["export { createXai, xai } from './xai-provider';\nexport type { XaiProvider, XaiProviderSettings } from './xai-provider';\nexport type { XaiErrorData } from './xai-error';\n","import {\n OpenAICompatibleChatLanguageModel,\n OpenAICompatibleImageModel,\n ProviderErrorStructure,\n} from '@ai-sdk/openai-compatible';\nimport {\n ImageModelV2,\n LanguageModelV2,\n NoSuchModelError,\n ProviderV2,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n} from '@ai-sdk/provider-utils';\nimport { XaiChatModelId, supportsStructuredOutputs } from './xai-chat-options';\nimport { XaiErrorData, xaiErrorSchema } from './xai-error';\nimport { XaiImageModelId } from './xai-image-settings';\n\nconst xaiErrorStructure: ProviderErrorStructure<XaiErrorData> = {\n errorSchema: xaiErrorSchema,\n errorToMessage: data => data.error,\n};\n\nexport interface XaiProvider extends ProviderV2 {\n /**\nCreates an Xai chat model for text generation.\n */\n (modelId: XaiChatModelId): LanguageModelV2;\n\n /**\nCreates an Xai language model for text generation.\n */\n languageModel(modelId: XaiChatModelId): LanguageModelV2;\n\n /**\nCreates an Xai chat model for text generation.\n */\n chat: (modelId: XaiChatModelId) => LanguageModelV2;\n\n /**\nCreates an Xai image model for image generation.\n@deprecated Use `imageModel` instead.\n */\n image(modelId: XaiImageModelId): ImageModelV2;\n\n /**\nCreates an Xai image model for image generation.\n */\n imageModel(modelId: XaiImageModelId): ImageModelV2;\n}\n\nexport interface XaiProviderSettings {\n /**\nBase URL for the xAI API calls.\n */\n baseURL?: string;\n\n /**\nAPI key for authenticating requests.\n */\n apiKey?: string;\n\n /**\nCustom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport function createXai(options: XaiProviderSettings = {}): XaiProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.x.ai/v1',\n );\n const getHeaders = () => ({\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'XAI_API_KEY',\n description: 'xAI API key',\n })}`,\n ...options.headers,\n });\n\n const createLanguageModel = (modelId: XaiChatModelId) => {\n const structuredOutputs = supportsStructuredOutputs(modelId);\n return new OpenAICompatibleChatLanguageModel(modelId, {\n provider: 'xai.chat',\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n errorStructure: xaiErrorStructure,\n supportsStructuredOutputs: structuredOutputs,\n includeUsage: true,\n });\n };\n\n const createImageModel = (modelId: XaiImageModelId) => {\n return new OpenAICompatibleImageModel(modelId, {\n provider: 'xai.image',\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n errorStructure: xaiErrorStructure,\n });\n };\n\n const provider = (modelId: XaiChatModelId) => createLanguageModel(modelId);\n\n provider.languageModel = createLanguageModel;\n provider.chat = createLanguageModel;\n provider.textEmbeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'textEmbeddingModel' });\n };\n provider.imageModel = createImageModel;\n provider.image = createImageModel;\n\n return provider;\n}\n\nexport const xai = createXai();\n","// https://console.x.ai and see \"View models\"\nexport type XaiChatModelId =\n | 'grok-3'\n | 'grok-3-latest'\n | 'grok-3-fast'\n | 'grok-3-fast-latest'\n | 'grok-3-mini'\n | 'grok-3-mini-latest'\n | 'grok-3-mini-fast'\n | 'grok-3-mini-fast-latest'\n | 'grok-2-vision-1212'\n | 'grok-2-vision'\n | 'grok-2-vision-latest'\n | 'grok-2-image-1212'\n | 'grok-2-image'\n | 'grok-2-image-latest'\n | 'grok-2-1212'\n | 'grok-2'\n | 'grok-2-latest'\n | 'grok-vision-beta'\n | 'grok-beta'\n | (string & {});\n\n/**\n * https://docs.x.ai/docs/guides/structured-outputs\n */\nexport function supportsStructuredOutputs(modelId: XaiChatModelId) {\n return [\n 'grok-3',\n 'grok-3-beta',\n 'grok-3-latest',\n 'grok-3-fast',\n 'grok-3-fast-beta',\n 'grok-3-fast-latest',\n 'grok-3-mini',\n 'grok-3-mini-beta',\n 'grok-3-mini-latest',\n 'grok-3-mini-fast',\n 'grok-3-mini-fast-beta',\n 'grok-3-mini-fast-latest',\n 'grok-2-1212',\n 'grok-2-vision-1212',\n ].includes(modelId);\n}\n","import { z } from 'zod';\n\n// Add error schema and structure\nexport const xaiErrorSchema = z.object({\n code: z.string(),\n error: z.string(),\n});\n\nexport type XaiErrorData = z.infer<typeof xaiErrorSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,+BAIO;AACP,sBAKO;AACP,4BAIO;;;ACWA,SAAS,0BAA0B,SAAyB;AACjE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,SAAS,OAAO;AACpB;;;AC3CA,iBAAkB;AAGX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,MAAM,aAAE,OAAO;AAAA,EACf,OAAO,aAAE,OAAO;AAClB,CAAC;;;AFcD,IAAM,oBAA0D;AAAA,EAC9D,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK;AAC/B;AAqDO,SAAS,UAAU,UAA+B,CAAC,GAAgB;AA5E1E;AA6EE,QAAM,cAAU;AAAA,KACd,aAAQ,YAAR,YAAmB;AAAA,EACrB;AACA,QAAM,aAAa,OAAO;AAAA,IACxB,eAAe,cAAU,kCAAW;AAAA,MAClC,QAAQ,QAAQ;AAAA,MAChB,yBAAyB;AAAA,MACzB,aAAa;AAAA,IACf,CAAC,CAAC;AAAA,IACF,GAAG,QAAQ;AAAA,EACb;AAEA,QAAM,sBAAsB,CAAC,YAA4B;AACvD,UAAM,oBAAoB,0BAA0B,OAAO;AAC3D,WAAO,IAAI,2DAAkC,SAAS;AAAA,MACpD,UAAU;AAAA,MACV,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,MACpC,SAAS;AAAA,MACT,OAAO,QAAQ;AAAA,MACf,gBAAgB;AAAA,MAChB,2BAA2B;AAAA,MAC3B,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AAEA,QAAM,mBAAmB,CAAC,YAA6B;AACrD,WAAO,IAAI,oDAA2B,SAAS;AAAA,MAC7C,UAAU;AAAA,MACV,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,MACpC,SAAS;AAAA,MACT,OAAO,QAAQ;AAAA,MACf,gBAAgB;AAAA,IAClB,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CAAC,YAA4B,oBAAoB,OAAO;AAEzE,WAAS,gBAAgB;AACzB,WAAS,OAAO;AAChB,WAAS,qBAAqB,CAAC,YAAoB;AACjD,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,qBAAqB,CAAC;AAAA,EACzE;AACA,WAAS,aAAa;AACtB,WAAS,QAAQ;AAEjB,SAAO;AACT;AAEO,IAAM,MAAM,UAAU;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// src/xai-provider.ts
|
|
2
|
-
import {
|
|
3
|
-
NoSuchModelError
|
|
4
|
-
} from "@ai-sdk/provider";
|
|
5
2
|
import {
|
|
6
3
|
OpenAICompatibleChatLanguageModel,
|
|
7
4
|
OpenAICompatibleImageModel
|
|
8
5
|
} from "@ai-sdk/openai-compatible";
|
|
6
|
+
import {
|
|
7
|
+
NoSuchModelError
|
|
8
|
+
} from "@ai-sdk/provider";
|
|
9
9
|
import {
|
|
10
10
|
loadApiKey,
|
|
11
11
|
withoutTrailingSlash
|
|
12
12
|
} from "@ai-sdk/provider-utils";
|
|
13
13
|
|
|
14
|
-
// src/xai-chat-
|
|
14
|
+
// src/xai-chat-options.ts
|
|
15
15
|
function supportsStructuredOutputs(modelId) {
|
|
16
16
|
return [
|
|
17
17
|
"grok-3",
|
|
@@ -56,21 +56,20 @@ function createXai(options = {}) {
|
|
|
56
56
|
})}`,
|
|
57
57
|
...options.headers
|
|
58
58
|
});
|
|
59
|
-
const createLanguageModel = (modelId
|
|
59
|
+
const createLanguageModel = (modelId) => {
|
|
60
60
|
const structuredOutputs = supportsStructuredOutputs(modelId);
|
|
61
|
-
return new OpenAICompatibleChatLanguageModel(modelId,
|
|
61
|
+
return new OpenAICompatibleChatLanguageModel(modelId, {
|
|
62
62
|
provider: "xai.chat",
|
|
63
63
|
url: ({ path }) => `${baseURL}${path}`,
|
|
64
64
|
headers: getHeaders,
|
|
65
65
|
fetch: options.fetch,
|
|
66
|
-
defaultObjectGenerationMode: structuredOutputs ? "json" : "tool",
|
|
67
66
|
errorStructure: xaiErrorStructure,
|
|
68
67
|
supportsStructuredOutputs: structuredOutputs,
|
|
69
68
|
includeUsage: true
|
|
70
69
|
});
|
|
71
70
|
};
|
|
72
|
-
const createImageModel = (modelId
|
|
73
|
-
return new OpenAICompatibleImageModel(modelId,
|
|
71
|
+
const createImageModel = (modelId) => {
|
|
72
|
+
return new OpenAICompatibleImageModel(modelId, {
|
|
74
73
|
provider: "xai.image",
|
|
75
74
|
url: ({ path }) => `${baseURL}${path}`,
|
|
76
75
|
headers: getHeaders,
|
|
@@ -78,7 +77,7 @@ function createXai(options = {}) {
|
|
|
78
77
|
errorStructure: xaiErrorStructure
|
|
79
78
|
});
|
|
80
79
|
};
|
|
81
|
-
const provider = (modelId
|
|
80
|
+
const provider = (modelId) => createLanguageModel(modelId);
|
|
82
81
|
provider.languageModel = createLanguageModel;
|
|
83
82
|
provider.chat = createLanguageModel;
|
|
84
83
|
provider.textEmbeddingModel = (modelId) => {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/xai-provider.ts","../src/xai-chat-
|
|
1
|
+
{"version":3,"sources":["../src/xai-provider.ts","../src/xai-chat-options.ts","../src/xai-error.ts"],"sourcesContent":["import {\n OpenAICompatibleChatLanguageModel,\n OpenAICompatibleImageModel,\n ProviderErrorStructure,\n} from '@ai-sdk/openai-compatible';\nimport {\n ImageModelV2,\n LanguageModelV2,\n NoSuchModelError,\n ProviderV2,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n} from '@ai-sdk/provider-utils';\nimport { XaiChatModelId, supportsStructuredOutputs } from './xai-chat-options';\nimport { XaiErrorData, xaiErrorSchema } from './xai-error';\nimport { XaiImageModelId } from './xai-image-settings';\n\nconst xaiErrorStructure: ProviderErrorStructure<XaiErrorData> = {\n errorSchema: xaiErrorSchema,\n errorToMessage: data => data.error,\n};\n\nexport interface XaiProvider extends ProviderV2 {\n /**\nCreates an Xai chat model for text generation.\n */\n (modelId: XaiChatModelId): LanguageModelV2;\n\n /**\nCreates an Xai language model for text generation.\n */\n languageModel(modelId: XaiChatModelId): LanguageModelV2;\n\n /**\nCreates an Xai chat model for text generation.\n */\n chat: (modelId: XaiChatModelId) => LanguageModelV2;\n\n /**\nCreates an Xai image model for image generation.\n@deprecated Use `imageModel` instead.\n */\n image(modelId: XaiImageModelId): ImageModelV2;\n\n /**\nCreates an Xai image model for image generation.\n */\n imageModel(modelId: XaiImageModelId): ImageModelV2;\n}\n\nexport interface XaiProviderSettings {\n /**\nBase URL for the xAI API calls.\n */\n baseURL?: string;\n\n /**\nAPI key for authenticating requests.\n */\n apiKey?: string;\n\n /**\nCustom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport function createXai(options: XaiProviderSettings = {}): XaiProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.x.ai/v1',\n );\n const getHeaders = () => ({\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'XAI_API_KEY',\n description: 'xAI API key',\n })}`,\n ...options.headers,\n });\n\n const createLanguageModel = (modelId: XaiChatModelId) => {\n const structuredOutputs = supportsStructuredOutputs(modelId);\n return new OpenAICompatibleChatLanguageModel(modelId, {\n provider: 'xai.chat',\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n errorStructure: xaiErrorStructure,\n supportsStructuredOutputs: structuredOutputs,\n includeUsage: true,\n });\n };\n\n const createImageModel = (modelId: XaiImageModelId) => {\n return new OpenAICompatibleImageModel(modelId, {\n provider: 'xai.image',\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n errorStructure: xaiErrorStructure,\n });\n };\n\n const provider = (modelId: XaiChatModelId) => createLanguageModel(modelId);\n\n provider.languageModel = createLanguageModel;\n provider.chat = createLanguageModel;\n provider.textEmbeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'textEmbeddingModel' });\n };\n provider.imageModel = createImageModel;\n provider.image = createImageModel;\n\n return provider;\n}\n\nexport const xai = createXai();\n","// https://console.x.ai and see \"View models\"\nexport type XaiChatModelId =\n | 'grok-3'\n | 'grok-3-latest'\n | 'grok-3-fast'\n | 'grok-3-fast-latest'\n | 'grok-3-mini'\n | 'grok-3-mini-latest'\n | 'grok-3-mini-fast'\n | 'grok-3-mini-fast-latest'\n | 'grok-2-vision-1212'\n | 'grok-2-vision'\n | 'grok-2-vision-latest'\n | 'grok-2-image-1212'\n | 'grok-2-image'\n | 'grok-2-image-latest'\n | 'grok-2-1212'\n | 'grok-2'\n | 'grok-2-latest'\n | 'grok-vision-beta'\n | 'grok-beta'\n | (string & {});\n\n/**\n * https://docs.x.ai/docs/guides/structured-outputs\n */\nexport function supportsStructuredOutputs(modelId: XaiChatModelId) {\n return [\n 'grok-3',\n 'grok-3-beta',\n 'grok-3-latest',\n 'grok-3-fast',\n 'grok-3-fast-beta',\n 'grok-3-fast-latest',\n 'grok-3-mini',\n 'grok-3-mini-beta',\n 'grok-3-mini-latest',\n 'grok-3-mini-fast',\n 'grok-3-mini-fast-beta',\n 'grok-3-mini-fast-latest',\n 'grok-2-1212',\n 'grok-2-vision-1212',\n ].includes(modelId);\n}\n","import { z } from 'zod';\n\n// Add error schema and structure\nexport const xaiErrorSchema = z.object({\n code: z.string(),\n error: z.string(),\n});\n\nexport type XaiErrorData = z.infer<typeof xaiErrorSchema>;\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EAGE;AAAA,OAEK;AACP;AAAA,EAEE;AAAA,EACA;AAAA,OACK;;;ACWA,SAAS,0BAA0B,SAAyB;AACjE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,SAAS,OAAO;AACpB;;;AC3CA,SAAS,SAAS;AAGX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,MAAM,EAAE,OAAO;AAAA,EACf,OAAO,EAAE,OAAO;AAClB,CAAC;;;AFcD,IAAM,oBAA0D;AAAA,EAC9D,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK;AAC/B;AAqDO,SAAS,UAAU,UAA+B,CAAC,GAAgB;AA5E1E;AA6EE,QAAM,UAAU;AAAA,KACd,aAAQ,YAAR,YAAmB;AAAA,EACrB;AACA,QAAM,aAAa,OAAO;AAAA,IACxB,eAAe,UAAU,WAAW;AAAA,MAClC,QAAQ,QAAQ;AAAA,MAChB,yBAAyB;AAAA,MACzB,aAAa;AAAA,IACf,CAAC,CAAC;AAAA,IACF,GAAG,QAAQ;AAAA,EACb;AAEA,QAAM,sBAAsB,CAAC,YAA4B;AACvD,UAAM,oBAAoB,0BAA0B,OAAO;AAC3D,WAAO,IAAI,kCAAkC,SAAS;AAAA,MACpD,UAAU;AAAA,MACV,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,MACpC,SAAS;AAAA,MACT,OAAO,QAAQ;AAAA,MACf,gBAAgB;AAAA,MAChB,2BAA2B;AAAA,MAC3B,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AAEA,QAAM,mBAAmB,CAAC,YAA6B;AACrD,WAAO,IAAI,2BAA2B,SAAS;AAAA,MAC7C,UAAU;AAAA,MACV,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,MACpC,SAAS;AAAA,MACT,OAAO,QAAQ;AAAA,MACf,gBAAgB;AAAA,IAClB,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CAAC,YAA4B,oBAAoB,OAAO;AAEzE,WAAS,gBAAgB;AACzB,WAAS,OAAO;AAChB,WAAS,qBAAqB,CAAC,YAAoB;AACjD,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,qBAAqB,CAAC;AAAA,EACzE;AACA,WAAS,aAAa;AACtB,WAAS,QAAQ;AAEjB,SAAO;AACT;AAEO,IAAM,MAAM,UAAU;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/xai",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@ai-sdk/openai-compatible": "0.
|
|
23
|
-
"@ai-sdk/provider": "
|
|
24
|
-
"@ai-sdk/provider-utils": "
|
|
22
|
+
"@ai-sdk/openai-compatible": "1.0.0-alpha.1",
|
|
23
|
+
"@ai-sdk/provider": "2.0.0-alpha.1",
|
|
24
|
+
"@ai-sdk/provider-utils": "3.0.0-alpha.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "20.17.24",
|
|
28
28
|
"tsup": "^8",
|
|
29
|
-
"typescript": "5.
|
|
30
|
-
"zod": "3.
|
|
29
|
+
"typescript": "5.8.3",
|
|
30
|
+
"zod": "3.24.4",
|
|
31
31
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"zod": "^3.
|
|
34
|
+
"zod": "^3.24.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=18"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"homepage": "https://sdk.
|
|
42
|
+
"homepage": "https://ai-sdk.dev/docs",
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
|
45
45
|
"url": "git+https://github.com/vercel/ai.git"
|
|
@@ -51,13 +51,15 @@
|
|
|
51
51
|
"ai"
|
|
52
52
|
],
|
|
53
53
|
"scripts": {
|
|
54
|
-
"build": "tsup",
|
|
55
|
-
"build:watch": "tsup --watch",
|
|
56
|
-
"clean": "rm -rf dist",
|
|
54
|
+
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
55
|
+
"build:watch": "pnpm clean && tsup --watch",
|
|
56
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
57
57
|
"lint": "eslint \"./**/*.ts*\"",
|
|
58
|
-
"type-check": "tsc --
|
|
58
|
+
"type-check": "tsc --build",
|
|
59
59
|
"prettier-check": "prettier --check \"./**/*.ts*\"",
|
|
60
60
|
"test": "pnpm test:node && pnpm test:edge",
|
|
61
|
+
"test:update": "pnpm test:node -u",
|
|
62
|
+
"test:watch": "vitest --config vitest.node.config.js",
|
|
61
63
|
"test:edge": "vitest --config vitest.edge.config.js --run",
|
|
62
64
|
"test:node": "vitest --config vitest.node.config.js --run"
|
|
63
65
|
}
|