@ai-sdk/xai 2.0.0-alpha.9 → 2.0.0-beta.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 +154 -0
- package/dist/index.d.mts +49 -37
- package/dist/index.d.ts +49 -37
- package/dist/index.js +209 -172
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +160 -123
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,159 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [57edfcb]
|
|
8
|
+
- Updated dependencies [383cbfa]
|
|
9
|
+
- @ai-sdk/provider-utils@3.0.0-beta.5
|
|
10
|
+
- @ai-sdk/openai-compatible@1.0.0-beta.8
|
|
11
|
+
|
|
12
|
+
## 2.0.0-beta.9
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 205077b: fix: improve Zod compatibility
|
|
17
|
+
- Updated dependencies [205077b]
|
|
18
|
+
- @ai-sdk/openai-compatible@1.0.0-beta.7
|
|
19
|
+
- @ai-sdk/provider-utils@3.0.0-beta.4
|
|
20
|
+
|
|
21
|
+
## 2.0.0-beta.8
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 6d835a7: fix (provider/grok): filter duplicated reasoning chunks
|
|
26
|
+
|
|
27
|
+
## 2.0.0-beta.7
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [281bb1c]
|
|
32
|
+
- @ai-sdk/openai-compatible@1.0.0-beta.6
|
|
33
|
+
|
|
34
|
+
## 2.0.0-beta.6
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [05d2819]
|
|
39
|
+
- @ai-sdk/provider-utils@3.0.0-beta.3
|
|
40
|
+
- @ai-sdk/openai-compatible@1.0.0-beta.5
|
|
41
|
+
|
|
42
|
+
## 2.0.0-beta.5
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- 66b9661: feat (provider/xai): export XaiProviderOptions
|
|
47
|
+
- Updated dependencies [1b101e1]
|
|
48
|
+
- @ai-sdk/openai-compatible@1.0.0-beta.4
|
|
49
|
+
|
|
50
|
+
## 2.0.0-beta.4
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- 9e986f7: feat (provider/xai): add grok-4 model id
|
|
55
|
+
|
|
56
|
+
## 2.0.0-beta.3
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [7b069ed]
|
|
61
|
+
- @ai-sdk/openai-compatible@1.0.0-beta.3
|
|
62
|
+
|
|
63
|
+
## 2.0.0-beta.2
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- d1a034f: feature: using Zod 4 for internal stuff
|
|
68
|
+
- Updated dependencies [0571b98]
|
|
69
|
+
- Updated dependencies [39a4fab]
|
|
70
|
+
- Updated dependencies [d1a034f]
|
|
71
|
+
- @ai-sdk/provider-utils@3.0.0-beta.2
|
|
72
|
+
- @ai-sdk/openai-compatible@1.0.0-beta.2
|
|
73
|
+
|
|
74
|
+
## 2.0.0-beta.1
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- Updated dependencies [742b7be]
|
|
79
|
+
- Updated dependencies [7cddb72]
|
|
80
|
+
- Updated dependencies [ccce59b]
|
|
81
|
+
- Updated dependencies [e2b9e4b]
|
|
82
|
+
- Updated dependencies [45c1ea2]
|
|
83
|
+
- Updated dependencies [e025824]
|
|
84
|
+
- Updated dependencies [0d06df6]
|
|
85
|
+
- Updated dependencies [472524a]
|
|
86
|
+
- Updated dependencies [dd3ff01]
|
|
87
|
+
- Updated dependencies [7435eb5]
|
|
88
|
+
- Updated dependencies [cb68df0]
|
|
89
|
+
- Updated dependencies [bfdca8d]
|
|
90
|
+
- Updated dependencies [44f4aba]
|
|
91
|
+
- Updated dependencies [023ba40]
|
|
92
|
+
- Updated dependencies [5e57fae]
|
|
93
|
+
- Updated dependencies [71f938d]
|
|
94
|
+
- Updated dependencies [28a5ed5]
|
|
95
|
+
- @ai-sdk/provider@2.0.0-beta.1
|
|
96
|
+
- @ai-sdk/provider-utils@3.0.0-beta.1
|
|
97
|
+
- @ai-sdk/openai-compatible@1.0.0-beta.1
|
|
98
|
+
|
|
99
|
+
## 2.0.0-alpha.15
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- Updated dependencies [48d257a]
|
|
104
|
+
- Updated dependencies [8ba77a7]
|
|
105
|
+
- @ai-sdk/provider@2.0.0-alpha.15
|
|
106
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.15
|
|
107
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.15
|
|
108
|
+
|
|
109
|
+
## 2.0.0-alpha.14
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- Updated dependencies [b5da06a]
|
|
114
|
+
- Updated dependencies [63f9e9b]
|
|
115
|
+
- Updated dependencies [2e13791]
|
|
116
|
+
- @ai-sdk/provider@2.0.0-alpha.14
|
|
117
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.14
|
|
118
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.14
|
|
119
|
+
|
|
120
|
+
## 2.0.0-alpha.13
|
|
121
|
+
|
|
122
|
+
### Patch Changes
|
|
123
|
+
|
|
124
|
+
- Updated dependencies [68ecf2f]
|
|
125
|
+
- @ai-sdk/provider@2.0.0-alpha.13
|
|
126
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.13
|
|
127
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.13
|
|
128
|
+
|
|
129
|
+
## 2.0.0-alpha.12
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- e2aceaf: feat: add raw chunk support
|
|
134
|
+
- Updated dependencies [e2aceaf]
|
|
135
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.12
|
|
136
|
+
- @ai-sdk/provider@2.0.0-alpha.12
|
|
137
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.12
|
|
138
|
+
|
|
139
|
+
## 2.0.0-alpha.11
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- Updated dependencies [c1e6647]
|
|
144
|
+
- @ai-sdk/provider@2.0.0-alpha.11
|
|
145
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.11
|
|
146
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.11
|
|
147
|
+
|
|
148
|
+
## 2.0.0-alpha.10
|
|
149
|
+
|
|
150
|
+
### Patch Changes
|
|
151
|
+
|
|
152
|
+
- Updated dependencies [c4df419]
|
|
153
|
+
- @ai-sdk/provider@2.0.0-alpha.10
|
|
154
|
+
- @ai-sdk/openai-compatible@1.0.0-alpha.10
|
|
155
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.10
|
|
156
|
+
|
|
3
157
|
## 2.0.0-alpha.9
|
|
4
158
|
|
|
5
159
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
1
2
|
import { ProviderV2, LanguageModelV2, ImageModelV2 } from '@ai-sdk/provider';
|
|
2
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { z } from 'zod';
|
|
4
4
|
|
|
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 & {});
|
|
5
|
+
type XaiChatModelId = 'grok-4' | 'grok-4-0709' | 'grok-4-latest' | '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 & {});
|
|
6
|
+
declare const xaiProviderOptions: z.ZodObject<{
|
|
7
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
8
|
+
low: "low";
|
|
9
|
+
high: "high";
|
|
10
|
+
}>>;
|
|
11
|
+
searchParameters: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
mode: z.ZodEnum<{
|
|
13
|
+
off: "off";
|
|
14
|
+
auto: "auto";
|
|
15
|
+
on: "on";
|
|
16
|
+
}>;
|
|
17
|
+
returnCitations: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
fromDate: z.ZodOptional<z.ZodString>;
|
|
19
|
+
toDate: z.ZodOptional<z.ZodString>;
|
|
20
|
+
maxSearchResults: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
22
|
+
type: z.ZodLiteral<"web">;
|
|
23
|
+
country: z.ZodOptional<z.ZodString>;
|
|
24
|
+
excludedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
allowedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
safeSearch: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
28
|
+
type: z.ZodLiteral<"x">;
|
|
29
|
+
xHandles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"news">;
|
|
32
|
+
country: z.ZodOptional<z.ZodString>;
|
|
33
|
+
excludedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
safeSearch: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
36
|
+
type: z.ZodLiteral<"rss">;
|
|
37
|
+
links: z.ZodArray<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>]>>>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
type XaiProviderOptions = z.infer<typeof xaiProviderOptions>;
|
|
42
|
+
|
|
43
|
+
declare const xaiErrorDataSchema: z.ZodObject<{
|
|
44
|
+
error: z.ZodObject<{
|
|
45
|
+
message: z.ZodString;
|
|
46
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
param: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
48
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
|
|
6
52
|
|
|
7
53
|
type XaiImageModelId = 'grok-2-image' | (string & {});
|
|
8
54
|
|
|
@@ -51,38 +97,4 @@ interface XaiProviderSettings {
|
|
|
51
97
|
declare function createXai(options?: XaiProviderSettings): XaiProvider;
|
|
52
98
|
declare const xai: XaiProvider;
|
|
53
99
|
|
|
54
|
-
|
|
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
|
-
}>;
|
|
71
|
-
}, "strip", z.ZodTypeAny, {
|
|
72
|
-
error: {
|
|
73
|
-
message: string;
|
|
74
|
-
type?: string | null | undefined;
|
|
75
|
-
code?: string | number | null | undefined;
|
|
76
|
-
param?: any;
|
|
77
|
-
};
|
|
78
|
-
}, {
|
|
79
|
-
error: {
|
|
80
|
-
message: string;
|
|
81
|
-
type?: string | null | undefined;
|
|
82
|
-
code?: string | number | null | undefined;
|
|
83
|
-
param?: any;
|
|
84
|
-
};
|
|
85
|
-
}>;
|
|
86
|
-
type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
|
|
87
|
-
|
|
88
|
-
export { type XaiErrorData, type XaiProvider, type XaiProviderSettings, createXai, xai };
|
|
100
|
+
export { type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, createXai, xai };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
1
2
|
import { ProviderV2, LanguageModelV2, ImageModelV2 } from '@ai-sdk/provider';
|
|
2
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { z } from 'zod';
|
|
4
4
|
|
|
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 & {});
|
|
5
|
+
type XaiChatModelId = 'grok-4' | 'grok-4-0709' | 'grok-4-latest' | '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 & {});
|
|
6
|
+
declare const xaiProviderOptions: z.ZodObject<{
|
|
7
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
8
|
+
low: "low";
|
|
9
|
+
high: "high";
|
|
10
|
+
}>>;
|
|
11
|
+
searchParameters: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
mode: z.ZodEnum<{
|
|
13
|
+
off: "off";
|
|
14
|
+
auto: "auto";
|
|
15
|
+
on: "on";
|
|
16
|
+
}>;
|
|
17
|
+
returnCitations: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
fromDate: z.ZodOptional<z.ZodString>;
|
|
19
|
+
toDate: z.ZodOptional<z.ZodString>;
|
|
20
|
+
maxSearchResults: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
22
|
+
type: z.ZodLiteral<"web">;
|
|
23
|
+
country: z.ZodOptional<z.ZodString>;
|
|
24
|
+
excludedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
allowedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
safeSearch: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
28
|
+
type: z.ZodLiteral<"x">;
|
|
29
|
+
xHandles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"news">;
|
|
32
|
+
country: z.ZodOptional<z.ZodString>;
|
|
33
|
+
excludedWebsites: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
safeSearch: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
36
|
+
type: z.ZodLiteral<"rss">;
|
|
37
|
+
links: z.ZodArray<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>]>>>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
type XaiProviderOptions = z.infer<typeof xaiProviderOptions>;
|
|
42
|
+
|
|
43
|
+
declare const xaiErrorDataSchema: z.ZodObject<{
|
|
44
|
+
error: z.ZodObject<{
|
|
45
|
+
message: z.ZodString;
|
|
46
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
param: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
48
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
|
|
6
52
|
|
|
7
53
|
type XaiImageModelId = 'grok-2-image' | (string & {});
|
|
8
54
|
|
|
@@ -51,38 +97,4 @@ interface XaiProviderSettings {
|
|
|
51
97
|
declare function createXai(options?: XaiProviderSettings): XaiProvider;
|
|
52
98
|
declare const xai: XaiProvider;
|
|
53
99
|
|
|
54
|
-
|
|
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
|
-
}>;
|
|
71
|
-
}, "strip", z.ZodTypeAny, {
|
|
72
|
-
error: {
|
|
73
|
-
message: string;
|
|
74
|
-
type?: string | null | undefined;
|
|
75
|
-
code?: string | number | null | undefined;
|
|
76
|
-
param?: any;
|
|
77
|
-
};
|
|
78
|
-
}, {
|
|
79
|
-
error: {
|
|
80
|
-
message: string;
|
|
81
|
-
type?: string | null | undefined;
|
|
82
|
-
code?: string | number | null | undefined;
|
|
83
|
-
param?: any;
|
|
84
|
-
};
|
|
85
|
-
}>;
|
|
86
|
-
type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
|
|
87
|
-
|
|
88
|
-
export { type XaiErrorData, type XaiProvider, type XaiProviderSettings, createXai, xai };
|
|
100
|
+
export { type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, createXai, xai };
|