@ai-sdk/xai 3.0.30 → 3.0.32
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 +12 -0
- package/dist/index.d.mts +43 -9
- package/dist/index.d.ts +43 -9
- package/dist/index.js +214 -88
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +200 -71
- package/dist/index.mjs.map +1 -1
- package/docs/01-xai.mdx +747 -0
- package/package.json +8 -4
- package/src/index.ts +1 -0
- package/src/responses/xai-responses-api.ts +79 -1
- package/src/responses/xai-responses-language-model.ts +30 -4
- package/src/responses/xai-responses-prepare-tools.test.ts +123 -0
- package/src/responses/xai-responses-prepare-tools.ts +12 -0
- package/src/tool/index.ts +3 -1
- package/src/tool/mcp-server.ts +66 -0
- package/src/tool/web-search.ts +1 -1
- package/src/tool/x-search.ts +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -82,6 +82,24 @@ declare const codeExecution: (args?: Parameters<typeof codeExecutionToolFactory>
|
|
|
82
82
|
error?: string | undefined;
|
|
83
83
|
}>;
|
|
84
84
|
|
|
85
|
+
declare const mcpServerToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
86
|
+
name: string;
|
|
87
|
+
arguments: string;
|
|
88
|
+
result: unknown;
|
|
89
|
+
}, {
|
|
90
|
+
serverUrl: string;
|
|
91
|
+
serverLabel?: string;
|
|
92
|
+
serverDescription?: string;
|
|
93
|
+
allowedTools?: string[];
|
|
94
|
+
headers?: Record<string, string>;
|
|
95
|
+
authorization?: string;
|
|
96
|
+
}>;
|
|
97
|
+
declare const mcpServer: (args: Parameters<typeof mcpServerToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
98
|
+
name: string;
|
|
99
|
+
arguments: string;
|
|
100
|
+
result: unknown;
|
|
101
|
+
}>;
|
|
102
|
+
|
|
85
103
|
declare const viewImageToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
86
104
|
description: string;
|
|
87
105
|
objects?: string[] | undefined;
|
|
@@ -102,7 +120,7 @@ declare const viewXVideo: (args?: Parameters<typeof viewXVideoToolFactory>[0]) =
|
|
|
102
120
|
duration?: number | undefined;
|
|
103
121
|
}>;
|
|
104
122
|
|
|
105
|
-
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<
|
|
123
|
+
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
106
124
|
query: string;
|
|
107
125
|
sources: Array<{
|
|
108
126
|
title: string;
|
|
@@ -114,7 +132,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
114
132
|
excludedDomains?: string[];
|
|
115
133
|
enableImageUnderstanding?: boolean;
|
|
116
134
|
}>;
|
|
117
|
-
declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<
|
|
135
|
+
declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
118
136
|
query: string;
|
|
119
137
|
sources: Array<{
|
|
120
138
|
title: string;
|
|
@@ -123,7 +141,7 @@ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) =>
|
|
|
123
141
|
}>;
|
|
124
142
|
}>;
|
|
125
143
|
|
|
126
|
-
declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<
|
|
144
|
+
declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
127
145
|
query: string;
|
|
128
146
|
posts: Array<{
|
|
129
147
|
author: string;
|
|
@@ -139,7 +157,7 @@ declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWith
|
|
|
139
157
|
enableImageUnderstanding?: boolean;
|
|
140
158
|
enableVideoUnderstanding?: boolean;
|
|
141
159
|
}>;
|
|
142
|
-
declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<
|
|
160
|
+
declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
143
161
|
query: string;
|
|
144
162
|
posts: Array<{
|
|
145
163
|
author: string;
|
|
@@ -157,6 +175,22 @@ declare const xaiTools: {
|
|
|
157
175
|
output: string;
|
|
158
176
|
error?: string | undefined;
|
|
159
177
|
}>;
|
|
178
|
+
mcpServer: (args: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
179
|
+
name: string;
|
|
180
|
+
arguments: string;
|
|
181
|
+
result: unknown;
|
|
182
|
+
}, {
|
|
183
|
+
serverUrl: string;
|
|
184
|
+
serverLabel?: string;
|
|
185
|
+
serverDescription?: string;
|
|
186
|
+
allowedTools?: string[];
|
|
187
|
+
headers?: Record<string, string>;
|
|
188
|
+
authorization?: string;
|
|
189
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
190
|
+
name: string;
|
|
191
|
+
arguments: string;
|
|
192
|
+
result: unknown;
|
|
193
|
+
}>;
|
|
160
194
|
viewImage: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
161
195
|
description: string;
|
|
162
196
|
objects?: string[] | undefined;
|
|
@@ -173,7 +207,7 @@ declare const xaiTools: {
|
|
|
173
207
|
transcript?: string | undefined;
|
|
174
208
|
duration?: number | undefined;
|
|
175
209
|
}>;
|
|
176
|
-
webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<
|
|
210
|
+
webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
177
211
|
query: string;
|
|
178
212
|
sources: Array<{
|
|
179
213
|
title: string;
|
|
@@ -184,7 +218,7 @@ declare const xaiTools: {
|
|
|
184
218
|
allowedDomains?: string[];
|
|
185
219
|
excludedDomains?: string[];
|
|
186
220
|
enableImageUnderstanding?: boolean;
|
|
187
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<
|
|
221
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
188
222
|
query: string;
|
|
189
223
|
sources: Array<{
|
|
190
224
|
title: string;
|
|
@@ -192,7 +226,7 @@ declare const xaiTools: {
|
|
|
192
226
|
snippet: string;
|
|
193
227
|
}>;
|
|
194
228
|
}>;
|
|
195
|
-
xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<
|
|
229
|
+
xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
196
230
|
query: string;
|
|
197
231
|
posts: Array<{
|
|
198
232
|
author: string;
|
|
@@ -207,7 +241,7 @@ declare const xaiTools: {
|
|
|
207
241
|
toDate?: string;
|
|
208
242
|
enableImageUnderstanding?: boolean;
|
|
209
243
|
enableVideoUnderstanding?: boolean;
|
|
210
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<
|
|
244
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
211
245
|
query: string;
|
|
212
246
|
posts: Array<{
|
|
213
247
|
author: string;
|
|
@@ -276,4 +310,4 @@ declare const xai: XaiProvider;
|
|
|
276
310
|
|
|
277
311
|
declare const VERSION: string;
|
|
278
312
|
|
|
279
|
-
export { VERSION, type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, type XaiResponsesProviderOptions, codeExecution, createXai, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|
|
313
|
+
export { VERSION, type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, type XaiResponsesProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|
package/dist/index.d.ts
CHANGED
|
@@ -82,6 +82,24 @@ declare const codeExecution: (args?: Parameters<typeof codeExecutionToolFactory>
|
|
|
82
82
|
error?: string | undefined;
|
|
83
83
|
}>;
|
|
84
84
|
|
|
85
|
+
declare const mcpServerToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
86
|
+
name: string;
|
|
87
|
+
arguments: string;
|
|
88
|
+
result: unknown;
|
|
89
|
+
}, {
|
|
90
|
+
serverUrl: string;
|
|
91
|
+
serverLabel?: string;
|
|
92
|
+
serverDescription?: string;
|
|
93
|
+
allowedTools?: string[];
|
|
94
|
+
headers?: Record<string, string>;
|
|
95
|
+
authorization?: string;
|
|
96
|
+
}>;
|
|
97
|
+
declare const mcpServer: (args: Parameters<typeof mcpServerToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
98
|
+
name: string;
|
|
99
|
+
arguments: string;
|
|
100
|
+
result: unknown;
|
|
101
|
+
}>;
|
|
102
|
+
|
|
85
103
|
declare const viewImageToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
86
104
|
description: string;
|
|
87
105
|
objects?: string[] | undefined;
|
|
@@ -102,7 +120,7 @@ declare const viewXVideo: (args?: Parameters<typeof viewXVideoToolFactory>[0]) =
|
|
|
102
120
|
duration?: number | undefined;
|
|
103
121
|
}>;
|
|
104
122
|
|
|
105
|
-
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<
|
|
123
|
+
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
106
124
|
query: string;
|
|
107
125
|
sources: Array<{
|
|
108
126
|
title: string;
|
|
@@ -114,7 +132,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
114
132
|
excludedDomains?: string[];
|
|
115
133
|
enableImageUnderstanding?: boolean;
|
|
116
134
|
}>;
|
|
117
|
-
declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<
|
|
135
|
+
declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
118
136
|
query: string;
|
|
119
137
|
sources: Array<{
|
|
120
138
|
title: string;
|
|
@@ -123,7 +141,7 @@ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) =>
|
|
|
123
141
|
}>;
|
|
124
142
|
}>;
|
|
125
143
|
|
|
126
|
-
declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<
|
|
144
|
+
declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
127
145
|
query: string;
|
|
128
146
|
posts: Array<{
|
|
129
147
|
author: string;
|
|
@@ -139,7 +157,7 @@ declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWith
|
|
|
139
157
|
enableImageUnderstanding?: boolean;
|
|
140
158
|
enableVideoUnderstanding?: boolean;
|
|
141
159
|
}>;
|
|
142
|
-
declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<
|
|
160
|
+
declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
143
161
|
query: string;
|
|
144
162
|
posts: Array<{
|
|
145
163
|
author: string;
|
|
@@ -157,6 +175,22 @@ declare const xaiTools: {
|
|
|
157
175
|
output: string;
|
|
158
176
|
error?: string | undefined;
|
|
159
177
|
}>;
|
|
178
|
+
mcpServer: (args: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
179
|
+
name: string;
|
|
180
|
+
arguments: string;
|
|
181
|
+
result: unknown;
|
|
182
|
+
}, {
|
|
183
|
+
serverUrl: string;
|
|
184
|
+
serverLabel?: string;
|
|
185
|
+
serverDescription?: string;
|
|
186
|
+
allowedTools?: string[];
|
|
187
|
+
headers?: Record<string, string>;
|
|
188
|
+
authorization?: string;
|
|
189
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
190
|
+
name: string;
|
|
191
|
+
arguments: string;
|
|
192
|
+
result: unknown;
|
|
193
|
+
}>;
|
|
160
194
|
viewImage: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
161
195
|
description: string;
|
|
162
196
|
objects?: string[] | undefined;
|
|
@@ -173,7 +207,7 @@ declare const xaiTools: {
|
|
|
173
207
|
transcript?: string | undefined;
|
|
174
208
|
duration?: number | undefined;
|
|
175
209
|
}>;
|
|
176
|
-
webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<
|
|
210
|
+
webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
177
211
|
query: string;
|
|
178
212
|
sources: Array<{
|
|
179
213
|
title: string;
|
|
@@ -184,7 +218,7 @@ declare const xaiTools: {
|
|
|
184
218
|
allowedDomains?: string[];
|
|
185
219
|
excludedDomains?: string[];
|
|
186
220
|
enableImageUnderstanding?: boolean;
|
|
187
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<
|
|
221
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
188
222
|
query: string;
|
|
189
223
|
sources: Array<{
|
|
190
224
|
title: string;
|
|
@@ -192,7 +226,7 @@ declare const xaiTools: {
|
|
|
192
226
|
snippet: string;
|
|
193
227
|
}>;
|
|
194
228
|
}>;
|
|
195
|
-
xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<
|
|
229
|
+
xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
196
230
|
query: string;
|
|
197
231
|
posts: Array<{
|
|
198
232
|
author: string;
|
|
@@ -207,7 +241,7 @@ declare const xaiTools: {
|
|
|
207
241
|
toDate?: string;
|
|
208
242
|
enableImageUnderstanding?: boolean;
|
|
209
243
|
enableVideoUnderstanding?: boolean;
|
|
210
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<
|
|
244
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
211
245
|
query: string;
|
|
212
246
|
posts: Array<{
|
|
213
247
|
author: string;
|
|
@@ -276,4 +310,4 @@ declare const xai: XaiProvider;
|
|
|
276
310
|
|
|
277
311
|
declare const VERSION: string;
|
|
278
312
|
|
|
279
|
-
export { VERSION, type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, type XaiResponsesProviderOptions, codeExecution, createXai, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|
|
313
|
+
export { VERSION, type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, type XaiResponsesProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|