@ai-sdk/xai 4.0.0-beta.2 → 4.0.0-beta.21
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 +156 -8
- package/README.md +2 -0
- package/dist/index.d.mts +51 -43
- package/dist/index.d.ts +51 -43
- package/dist/index.js +110 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +111 -50
- package/dist/index.mjs.map +1 -1
- package/docs/01-xai.mdx +30 -336
- package/package.json +4 -6
- package/src/convert-to-xai-chat-messages.ts +5 -5
- package/src/convert-xai-chat-usage.ts +2 -2
- package/src/map-xai-finish-reason.ts +2 -2
- package/src/responses/convert-to-xai-responses-input.ts +7 -5
- package/src/responses/convert-xai-responses-usage.ts +2 -2
- package/src/responses/map-xai-responses-finish-reason.ts +2 -2
- package/src/responses/xai-responses-api.ts +3 -0
- package/src/responses/xai-responses-language-model.ts +71 -30
- package/src/responses/xai-responses-options.ts +4 -0
- package/src/responses/xai-responses-prepare-tools.ts +6 -6
- package/src/xai-chat-language-model.ts +41 -22
- package/src/xai-chat-options.ts +3 -6
- package/src/xai-image-model.ts +43 -28
- package/src/xai-image-options.ts +2 -0
- package/src/xai-image-settings.ts +0 -2
- package/src/xai-prepare-tools.ts +6 -6
- package/src/xai-provider.ts +18 -21
- package/src/xai-video-model.ts +23 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,153 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
8
|
+
- Updated dependencies [38fc777]
|
|
9
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.13
|
|
10
|
+
|
|
11
|
+
## 4.0.0-beta.20
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [2e17091]
|
|
16
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
17
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.12
|
|
18
|
+
|
|
19
|
+
## 4.0.0-beta.19
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [986c6fd]
|
|
24
|
+
- Updated dependencies [493295c]
|
|
25
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
26
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.11
|
|
27
|
+
|
|
28
|
+
## 4.0.0-beta.18
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- 9f20868: fix(provider/xai): correct finish reason for tool calls
|
|
33
|
+
|
|
34
|
+
## 4.0.0-beta.17
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [1f509d4]
|
|
39
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
40
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
41
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.10
|
|
42
|
+
|
|
43
|
+
## 4.0.0-beta.16
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- 4f91b5d: chore(provider/xai): update Grok 4.20 model IDs to their non-beta versions
|
|
48
|
+
|
|
49
|
+
## 4.0.0-beta.15
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
|
|
54
|
+
- Updated dependencies [74d520f]
|
|
55
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.9
|
|
56
|
+
|
|
57
|
+
## 4.0.0-beta.14
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [3887c70]
|
|
62
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
63
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
64
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.8
|
|
65
|
+
|
|
66
|
+
## 4.0.0-beta.13
|
|
67
|
+
|
|
68
|
+
### Major Changes
|
|
69
|
+
|
|
70
|
+
- 776b617: feat(provider): adding new 'custom' content type
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- Updated dependencies [776b617]
|
|
75
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
76
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
77
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.7
|
|
78
|
+
|
|
79
|
+
## 4.0.0-beta.12
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- d20829e: feat(provider/xai): add moderation error, and costInUsdTicks to video model
|
|
84
|
+
- Updated dependencies [61753c3]
|
|
85
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
86
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.6
|
|
87
|
+
|
|
88
|
+
## 4.0.0-beta.11
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- f7d4f01: feat(provider): add support for `reasoning-file` type for files that are part of reasoning
|
|
93
|
+
- Updated dependencies [f7d4f01]
|
|
94
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
95
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
96
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.5
|
|
97
|
+
|
|
98
|
+
## 4.0.0-beta.10
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Updated dependencies [5c2a5a2]
|
|
103
|
+
- @ai-sdk/provider@4.0.0-beta.1
|
|
104
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.4
|
|
105
|
+
- @ai-sdk/provider-utils@5.0.0-beta.2
|
|
106
|
+
|
|
107
|
+
## 4.0.0-beta.9
|
|
108
|
+
|
|
109
|
+
### Patch Changes
|
|
110
|
+
|
|
111
|
+
- Updated dependencies [8f3e1da]
|
|
112
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.3
|
|
113
|
+
|
|
114
|
+
## 4.0.0-beta.8
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- 4799fa5: chore(provider/xai): update provider to use v4 types
|
|
119
|
+
|
|
120
|
+
## 4.0.0-beta.7
|
|
121
|
+
|
|
122
|
+
### Patch Changes
|
|
123
|
+
|
|
124
|
+
- 0f11f10: add reasoningSummary to responses API provider options
|
|
125
|
+
- 12115e9: fix reasoning text extraction from content in responses doGenerate
|
|
126
|
+
|
|
127
|
+
## 4.0.0-beta.6
|
|
128
|
+
|
|
129
|
+
### Major Changes
|
|
130
|
+
|
|
131
|
+
- f62681f: feat(provider/xai): make responses api the default
|
|
132
|
+
|
|
133
|
+
## 4.0.0-beta.5
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- aa5a583: chore(provider/xai): remove obsolete Grok 2 models now that they are shut down in their API
|
|
138
|
+
|
|
139
|
+
## 4.0.0-beta.4
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- 25f1837: feat(xai): add b64_json response format, usage cost tracking, and quality/user parameters for image models
|
|
144
|
+
|
|
145
|
+
## 4.0.0-beta.3
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- f5181ad: feat(provider/xai): support multiple input images for image editing
|
|
150
|
+
|
|
3
151
|
## 4.0.0-beta.2
|
|
4
152
|
|
|
5
153
|
### Patch Changes
|
|
@@ -524,13 +672,13 @@
|
|
|
524
672
|
Before
|
|
525
673
|
|
|
526
674
|
```ts
|
|
527
|
-
model.textEmbeddingModel(
|
|
675
|
+
model.textEmbeddingModel("my-model-id");
|
|
528
676
|
```
|
|
529
677
|
|
|
530
678
|
After
|
|
531
679
|
|
|
532
680
|
```ts
|
|
533
|
-
model.embeddingModel(
|
|
681
|
+
model.embeddingModel("my-model-id");
|
|
534
682
|
```
|
|
535
683
|
|
|
536
684
|
- 2625a04: feat(openai); update spec for mcp approval
|
|
@@ -788,13 +936,13 @@
|
|
|
788
936
|
Before
|
|
789
937
|
|
|
790
938
|
```ts
|
|
791
|
-
model.textEmbeddingModel(
|
|
939
|
+
model.textEmbeddingModel("my-model-id");
|
|
792
940
|
```
|
|
793
941
|
|
|
794
942
|
After
|
|
795
943
|
|
|
796
944
|
```ts
|
|
797
|
-
model.embeddingModel(
|
|
945
|
+
model.embeddingModel("my-model-id");
|
|
798
946
|
```
|
|
799
947
|
|
|
800
948
|
- 8514146: add grok-4-1 model IDs
|
|
@@ -1337,7 +1485,7 @@
|
|
|
1337
1485
|
|
|
1338
1486
|
```js
|
|
1339
1487
|
await generateImage({
|
|
1340
|
-
model: luma.image(
|
|
1488
|
+
model: luma.image("photon-flash-1", {
|
|
1341
1489
|
maxImagesPerCall: 5,
|
|
1342
1490
|
pollIntervalMillis: 500,
|
|
1343
1491
|
}),
|
|
@@ -1350,7 +1498,7 @@
|
|
|
1350
1498
|
|
|
1351
1499
|
```js
|
|
1352
1500
|
await generateImage({
|
|
1353
|
-
model: luma.image(
|
|
1501
|
+
model: luma.image("photon-flash-1"),
|
|
1354
1502
|
prompt,
|
|
1355
1503
|
n: 10,
|
|
1356
1504
|
maxImagesPerCall: 5,
|
|
@@ -1666,7 +1814,7 @@
|
|
|
1666
1814
|
|
|
1667
1815
|
```js
|
|
1668
1816
|
await generateImage({
|
|
1669
|
-
model: luma.image(
|
|
1817
|
+
model: luma.image("photon-flash-1", {
|
|
1670
1818
|
maxImagesPerCall: 5,
|
|
1671
1819
|
pollIntervalMillis: 500,
|
|
1672
1820
|
}),
|
|
@@ -1679,7 +1827,7 @@
|
|
|
1679
1827
|
|
|
1680
1828
|
```js
|
|
1681
1829
|
await generateImage({
|
|
1682
|
-
model: luma.image(
|
|
1830
|
+
model: luma.image("photon-flash-1"),
|
|
1683
1831
|
prompt,
|
|
1684
1832
|
n: 10,
|
|
1685
1833
|
maxImagesPerCall: 5,
|
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
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
|
+
> **Deploying to Vercel?** With Vercel's AI Gateway you can access xAI (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
|
|
7
|
+
|
|
6
8
|
## Setup
|
|
7
9
|
|
|
8
10
|
The xAI Grok provider is available in the `@ai-sdk/xai` module. You can install it with
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import {
|
|
2
|
+
import { ProviderV4, LanguageModelV4, ImageModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
|
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
4
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
5
5
|
|
|
6
|
-
type XaiChatModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | 'grok-
|
|
6
|
+
type XaiChatModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | 'grok-4.20-0309-non-reasoning' | 'grok-4.20-0309-reasoning' | 'grok-4.20-multi-agent-0309' | 'grok-code-fast-1' | 'grok-4' | 'grok-4-0709' | 'grok-4-latest' | 'grok-3' | 'grok-3-latest' | 'grok-3-mini' | 'grok-3-mini-latest' | (string & {});
|
|
7
7
|
declare const xaiLanguageModelChatOptions: z.ZodObject<{
|
|
8
8
|
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
9
9
|
low: "low";
|
|
@@ -58,7 +58,7 @@ declare const xaiErrorDataSchema: z.ZodObject<{
|
|
|
58
58
|
}, z.core.$strip>;
|
|
59
59
|
type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
|
|
60
60
|
|
|
61
|
-
type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | (string & {});
|
|
61
|
+
type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | 'grok-4.20-0309-non-reasoning' | 'grok-4.20-0309-reasoning' | 'grok-4.20-multi-agent-0309' | (string & {});
|
|
62
62
|
/**
|
|
63
63
|
* @see https://docs.x.ai/docs/api-reference#create-new-response
|
|
64
64
|
*/
|
|
@@ -68,6 +68,11 @@ declare const xaiLanguageModelResponsesOptions: z.ZodObject<{
|
|
|
68
68
|
high: "high";
|
|
69
69
|
medium: "medium";
|
|
70
70
|
}>>;
|
|
71
|
+
reasoningSummary: z.ZodOptional<z.ZodEnum<{
|
|
72
|
+
auto: "auto";
|
|
73
|
+
concise: "concise";
|
|
74
|
+
detailed: "detailed";
|
|
75
|
+
}>>;
|
|
71
76
|
logprobs: z.ZodOptional<z.ZodBoolean>;
|
|
72
77
|
topLogprobs: z.ZodOptional<z.ZodNumber>;
|
|
73
78
|
store: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -86,6 +91,12 @@ declare const xaiImageModelOptions: z.ZodObject<{
|
|
|
86
91
|
"1k": "1k";
|
|
87
92
|
"2k": "2k";
|
|
88
93
|
}>>;
|
|
94
|
+
quality: z.ZodOptional<z.ZodEnum<{
|
|
95
|
+
low: "low";
|
|
96
|
+
high: "high";
|
|
97
|
+
medium: "medium";
|
|
98
|
+
}>>;
|
|
99
|
+
user: z.ZodOptional<z.ZodString>;
|
|
89
100
|
}, z.core.$strip>;
|
|
90
101
|
type XaiImageModelOptions = z.infer<typeof xaiImageModelOptions>;
|
|
91
102
|
|
|
@@ -99,16 +110,16 @@ type XaiVideoModelOptions = {
|
|
|
99
110
|
[key: string]: unknown;
|
|
100
111
|
};
|
|
101
112
|
|
|
102
|
-
type XaiImageModelId = 'grok-
|
|
113
|
+
type XaiImageModelId = 'grok-imagine-image' | 'grok-imagine-image-pro' | (string & {});
|
|
103
114
|
|
|
104
115
|
declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
105
116
|
output: string;
|
|
106
117
|
error?: string | undefined;
|
|
107
|
-
}, object>;
|
|
118
|
+
}, object, {}>;
|
|
108
119
|
declare const codeExecution: (args?: Parameters<typeof codeExecutionToolFactory>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
109
120
|
output: string;
|
|
110
121
|
error?: string | undefined;
|
|
111
|
-
}>;
|
|
122
|
+
}, {}>;
|
|
112
123
|
|
|
113
124
|
declare const mcpServerToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
114
125
|
name: string;
|
|
@@ -121,32 +132,32 @@ declare const mcpServerToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
121
132
|
allowedTools?: string[];
|
|
122
133
|
headers?: Record<string, string>;
|
|
123
134
|
authorization?: string;
|
|
124
|
-
}>;
|
|
135
|
+
}, {}>;
|
|
125
136
|
declare const mcpServer: (args: Parameters<typeof mcpServerToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
126
137
|
name: string;
|
|
127
138
|
arguments: string;
|
|
128
139
|
result: unknown;
|
|
129
|
-
}>;
|
|
140
|
+
}, {}>;
|
|
130
141
|
|
|
131
142
|
declare const viewImageToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
132
143
|
description: string;
|
|
133
144
|
objects?: string[] | undefined;
|
|
134
|
-
}, object>;
|
|
145
|
+
}, object, {}>;
|
|
135
146
|
declare const viewImage: (args?: Parameters<typeof viewImageToolFactory>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
136
147
|
description: string;
|
|
137
148
|
objects?: string[] | undefined;
|
|
138
|
-
}>;
|
|
149
|
+
}, {}>;
|
|
139
150
|
|
|
140
151
|
declare const viewXVideoToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
141
152
|
description: string;
|
|
142
153
|
transcript?: string | undefined;
|
|
143
154
|
duration?: number | undefined;
|
|
144
|
-
}, object>;
|
|
155
|
+
}, object, {}>;
|
|
145
156
|
declare const viewXVideo: (args?: Parameters<typeof viewXVideoToolFactory>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
146
157
|
description: string;
|
|
147
158
|
transcript?: string | undefined;
|
|
148
159
|
duration?: number | undefined;
|
|
149
|
-
}>;
|
|
160
|
+
}, {}>;
|
|
150
161
|
|
|
151
162
|
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
152
163
|
query: string;
|
|
@@ -159,7 +170,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
159
170
|
allowedDomains?: string[];
|
|
160
171
|
excludedDomains?: string[];
|
|
161
172
|
enableImageUnderstanding?: boolean;
|
|
162
|
-
}>;
|
|
173
|
+
}, {}>;
|
|
163
174
|
declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
164
175
|
query: string;
|
|
165
176
|
sources: Array<{
|
|
@@ -167,7 +178,7 @@ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) =>
|
|
|
167
178
|
url: string;
|
|
168
179
|
snippet: string;
|
|
169
180
|
}>;
|
|
170
|
-
}>;
|
|
181
|
+
}, {}>;
|
|
171
182
|
|
|
172
183
|
declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
173
184
|
query: string;
|
|
@@ -184,7 +195,7 @@ declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWith
|
|
|
184
195
|
toDate?: string;
|
|
185
196
|
enableImageUnderstanding?: boolean;
|
|
186
197
|
enableVideoUnderstanding?: boolean;
|
|
187
|
-
}>;
|
|
198
|
+
}, {}>;
|
|
188
199
|
declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
189
200
|
query: string;
|
|
190
201
|
posts: Array<{
|
|
@@ -193,16 +204,16 @@ declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_
|
|
|
193
204
|
url: string;
|
|
194
205
|
likes: number;
|
|
195
206
|
}>;
|
|
196
|
-
}>;
|
|
207
|
+
}, {}>;
|
|
197
208
|
|
|
198
209
|
declare const xaiTools: {
|
|
199
210
|
codeExecution: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
200
211
|
output: string;
|
|
201
212
|
error?: string | undefined;
|
|
202
|
-
}, object>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
213
|
+
}, object, {}>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
203
214
|
output: string;
|
|
204
215
|
error?: string | undefined;
|
|
205
|
-
}>;
|
|
216
|
+
}, {}>;
|
|
206
217
|
fileSearch: (args: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
207
218
|
queries: string[];
|
|
208
219
|
results: null | {
|
|
@@ -214,7 +225,7 @@ declare const xaiTools: {
|
|
|
214
225
|
}, {
|
|
215
226
|
vectorStoreIds: string[];
|
|
216
227
|
maxNumResults?: number;
|
|
217
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
228
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
218
229
|
queries: string[];
|
|
219
230
|
results: null | {
|
|
220
231
|
fileId: string;
|
|
@@ -222,7 +233,7 @@ declare const xaiTools: {
|
|
|
222
233
|
score: number;
|
|
223
234
|
text: string;
|
|
224
235
|
}[];
|
|
225
|
-
}>;
|
|
236
|
+
}, {}>;
|
|
226
237
|
mcpServer: (args: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
227
238
|
name: string;
|
|
228
239
|
arguments: string;
|
|
@@ -234,27 +245,27 @@ declare const xaiTools: {
|
|
|
234
245
|
allowedTools?: string[];
|
|
235
246
|
headers?: Record<string, string>;
|
|
236
247
|
authorization?: string;
|
|
237
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
248
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
238
249
|
name: string;
|
|
239
250
|
arguments: string;
|
|
240
251
|
result: unknown;
|
|
241
|
-
}>;
|
|
252
|
+
}, {}>;
|
|
242
253
|
viewImage: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
243
254
|
description: string;
|
|
244
255
|
objects?: string[] | undefined;
|
|
245
|
-
}, object>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
256
|
+
}, object, {}>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
246
257
|
description: string;
|
|
247
258
|
objects?: string[] | undefined;
|
|
248
|
-
}>;
|
|
259
|
+
}, {}>;
|
|
249
260
|
viewXVideo: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
250
261
|
description: string;
|
|
251
262
|
transcript?: string | undefined;
|
|
252
263
|
duration?: number | undefined;
|
|
253
|
-
}, object>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
264
|
+
}, object, {}>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
254
265
|
description: string;
|
|
255
266
|
transcript?: string | undefined;
|
|
256
267
|
duration?: number | undefined;
|
|
257
|
-
}>;
|
|
268
|
+
}, {}>;
|
|
258
269
|
webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
259
270
|
query: string;
|
|
260
271
|
sources: Array<{
|
|
@@ -266,14 +277,14 @@ declare const xaiTools: {
|
|
|
266
277
|
allowedDomains?: string[];
|
|
267
278
|
excludedDomains?: string[];
|
|
268
279
|
enableImageUnderstanding?: boolean;
|
|
269
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
280
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
270
281
|
query: string;
|
|
271
282
|
sources: Array<{
|
|
272
283
|
title: string;
|
|
273
284
|
url: string;
|
|
274
285
|
snippet: string;
|
|
275
286
|
}>;
|
|
276
|
-
}>;
|
|
287
|
+
}, {}>;
|
|
277
288
|
xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
278
289
|
query: string;
|
|
279
290
|
posts: Array<{
|
|
@@ -289,7 +300,7 @@ declare const xaiTools: {
|
|
|
289
300
|
toDate?: string;
|
|
290
301
|
enableImageUnderstanding?: boolean;
|
|
291
302
|
enableVideoUnderstanding?: boolean;
|
|
292
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
303
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
293
304
|
query: string;
|
|
294
305
|
posts: Array<{
|
|
295
306
|
author: string;
|
|
@@ -297,42 +308,39 @@ declare const xaiTools: {
|
|
|
297
308
|
url: string;
|
|
298
309
|
likes: number;
|
|
299
310
|
}>;
|
|
300
|
-
}>;
|
|
311
|
+
}, {}>;
|
|
301
312
|
};
|
|
302
313
|
|
|
303
|
-
interface XaiProvider extends
|
|
304
|
-
|
|
305
|
-
* Creates an Xai chat model for text generation.
|
|
306
|
-
*/
|
|
307
|
-
(modelId: XaiChatModelId): LanguageModelV3;
|
|
314
|
+
interface XaiProvider extends ProviderV4 {
|
|
315
|
+
(modelId: XaiResponsesModelId): LanguageModelV4;
|
|
308
316
|
/**
|
|
309
317
|
* Creates an Xai language model for text generation.
|
|
310
318
|
*/
|
|
311
|
-
languageModel(modelId:
|
|
319
|
+
languageModel(modelId: XaiResponsesModelId): LanguageModelV4;
|
|
312
320
|
/**
|
|
313
321
|
* Creates an Xai chat model for text generation.
|
|
314
322
|
*/
|
|
315
|
-
chat: (modelId: XaiChatModelId) =>
|
|
323
|
+
chat: (modelId: XaiChatModelId) => LanguageModelV4;
|
|
316
324
|
/**
|
|
317
|
-
* Creates an Xai responses model for
|
|
325
|
+
* Creates an Xai responses model for text generation.
|
|
318
326
|
*/
|
|
319
|
-
responses: (modelId: XaiResponsesModelId) =>
|
|
327
|
+
responses: (modelId: XaiResponsesModelId) => LanguageModelV4;
|
|
320
328
|
/**
|
|
321
329
|
* Creates an Xai image model for image generation.
|
|
322
330
|
*/
|
|
323
|
-
image(modelId: XaiImageModelId):
|
|
331
|
+
image(modelId: XaiImageModelId): ImageModelV4;
|
|
324
332
|
/**
|
|
325
333
|
* Creates an Xai image model for image generation.
|
|
326
334
|
*/
|
|
327
|
-
imageModel(modelId: XaiImageModelId):
|
|
335
|
+
imageModel(modelId: XaiImageModelId): ImageModelV4;
|
|
328
336
|
/**
|
|
329
337
|
* Creates an Xai video model for video generation.
|
|
330
338
|
*/
|
|
331
|
-
video(modelId: XaiVideoModelId):
|
|
339
|
+
video(modelId: XaiVideoModelId): Experimental_VideoModelV4;
|
|
332
340
|
/**
|
|
333
341
|
* Creates an Xai video model for video generation.
|
|
334
342
|
*/
|
|
335
|
-
videoModel(modelId: XaiVideoModelId):
|
|
343
|
+
videoModel(modelId: XaiVideoModelId): Experimental_VideoModelV4;
|
|
336
344
|
/**
|
|
337
345
|
* Server-side agentic tools for use with the responses API.
|
|
338
346
|
*/
|