@ai-sdk/xai 4.0.0-beta.43 → 4.0.0-beta.45
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 +26 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/package.json +9 -7
- package/src/convert-to-xai-chat-messages.ts +1 -1
- package/src/tool/code-execution.ts +2 -2
- package/src/tool/file-search.ts +2 -2
- package/src/tool/mcp-server.ts +2 -2
- package/src/tool/view-image.ts +2 -2
- package/src/tool/view-x-video.ts +2 -2
- package/src/tool/web-search.ts +2 -2
- package/src/tool/x-search.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.45
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9f0e36c: trigger release for all packages after provenance setup
|
|
8
|
+
- Updated dependencies [9f0e36c]
|
|
9
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.33
|
|
10
|
+
- @ai-sdk/provider@4.0.0-beta.13
|
|
11
|
+
- @ai-sdk/provider-utils@5.0.0-beta.28
|
|
12
|
+
|
|
13
|
+
## 4.0.0-beta.44
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 58a2ad7: fix: more precise default message for tool execution denial
|
|
18
|
+
- Updated dependencies [ab81968]
|
|
19
|
+
- Updated dependencies [785fe16]
|
|
20
|
+
- Updated dependencies [67df0a0]
|
|
21
|
+
- Updated dependencies [befb78c]
|
|
22
|
+
- Updated dependencies [0458559]
|
|
23
|
+
- Updated dependencies [58a2ad7]
|
|
24
|
+
- Updated dependencies [5852c0a]
|
|
25
|
+
- Updated dependencies [fc92055]
|
|
26
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.32
|
|
27
|
+
- @ai-sdk/provider-utils@5.0.0-beta.27
|
|
28
|
+
|
|
3
29
|
## 4.0.0-beta.43
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -182,7 +182,7 @@ type XaiFilesOptions = InferSchema<typeof xaiFilesOptionsSchema>;
|
|
|
182
182
|
|
|
183
183
|
type XaiImageModelId = 'grok-imagine-image' | 'grok-imagine-image-pro' | (string & {});
|
|
184
184
|
|
|
185
|
-
declare const codeExecutionToolFactory: _ai_sdk_provider_utils.
|
|
185
|
+
declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<Record<string, never>, {
|
|
186
186
|
output: string;
|
|
187
187
|
error?: string | undefined;
|
|
188
188
|
}, object, {}>;
|
|
@@ -191,7 +191,7 @@ declare const codeExecution: (args?: Parameters<typeof codeExecutionToolFactory>
|
|
|
191
191
|
error?: string | undefined;
|
|
192
192
|
}, {}>;
|
|
193
193
|
|
|
194
|
-
declare const mcpServerToolFactory: _ai_sdk_provider_utils.
|
|
194
|
+
declare const mcpServerToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
|
|
195
195
|
name: string;
|
|
196
196
|
arguments: string;
|
|
197
197
|
result: unknown;
|
|
@@ -209,7 +209,7 @@ declare const mcpServer: (args: Parameters<typeof mcpServerToolFactory>[0]) => _
|
|
|
209
209
|
result: unknown;
|
|
210
210
|
}, {}>;
|
|
211
211
|
|
|
212
|
-
declare const viewImageToolFactory: _ai_sdk_provider_utils.
|
|
212
|
+
declare const viewImageToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<Record<string, never>, {
|
|
213
213
|
description: string;
|
|
214
214
|
objects?: string[] | undefined;
|
|
215
215
|
}, object, {}>;
|
|
@@ -218,7 +218,7 @@ declare const viewImage: (args?: Parameters<typeof viewImageToolFactory>[0]) =>
|
|
|
218
218
|
objects?: string[] | undefined;
|
|
219
219
|
}, {}>;
|
|
220
220
|
|
|
221
|
-
declare const viewXVideoToolFactory: _ai_sdk_provider_utils.
|
|
221
|
+
declare const viewXVideoToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<Record<string, never>, {
|
|
222
222
|
description: string;
|
|
223
223
|
transcript?: string | undefined;
|
|
224
224
|
duration?: number | undefined;
|
|
@@ -229,7 +229,7 @@ declare const viewXVideo: (args?: Parameters<typeof viewXVideoToolFactory>[0]) =
|
|
|
229
229
|
duration?: number | undefined;
|
|
230
230
|
}, {}>;
|
|
231
231
|
|
|
232
|
-
declare const webSearchToolFactory: _ai_sdk_provider_utils.
|
|
232
|
+
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
|
|
233
233
|
query: string;
|
|
234
234
|
sources: Array<{
|
|
235
235
|
title: string;
|
|
@@ -250,7 +250,7 @@ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) =>
|
|
|
250
250
|
}>;
|
|
251
251
|
}, {}>;
|
|
252
252
|
|
|
253
|
-
declare const xSearchToolFactory: _ai_sdk_provider_utils.
|
|
253
|
+
declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
|
|
254
254
|
query: string;
|
|
255
255
|
posts: Array<{
|
|
256
256
|
author: string;
|
|
@@ -277,14 +277,14 @@ declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_
|
|
|
277
277
|
}, {}>;
|
|
278
278
|
|
|
279
279
|
declare const xaiTools: {
|
|
280
|
-
codeExecution: (args?: Parameters<_ai_sdk_provider_utils.
|
|
280
|
+
codeExecution: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<Record<string, never>, {
|
|
281
281
|
output: string;
|
|
282
282
|
error?: string | undefined;
|
|
283
283
|
}, object, {}>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
284
284
|
output: string;
|
|
285
285
|
error?: string | undefined;
|
|
286
286
|
}, {}>;
|
|
287
|
-
fileSearch: (args: Parameters<_ai_sdk_provider_utils.
|
|
287
|
+
fileSearch: (args: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
|
|
288
288
|
queries: string[];
|
|
289
289
|
results: null | {
|
|
290
290
|
fileId: string;
|
|
@@ -304,7 +304,7 @@ declare const xaiTools: {
|
|
|
304
304
|
text: string;
|
|
305
305
|
}[];
|
|
306
306
|
}, {}>;
|
|
307
|
-
mcpServer: (args: Parameters<_ai_sdk_provider_utils.
|
|
307
|
+
mcpServer: (args: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
|
|
308
308
|
name: string;
|
|
309
309
|
arguments: string;
|
|
310
310
|
result: unknown;
|
|
@@ -320,14 +320,14 @@ declare const xaiTools: {
|
|
|
320
320
|
arguments: string;
|
|
321
321
|
result: unknown;
|
|
322
322
|
}, {}>;
|
|
323
|
-
viewImage: (args?: Parameters<_ai_sdk_provider_utils.
|
|
323
|
+
viewImage: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<Record<string, never>, {
|
|
324
324
|
description: string;
|
|
325
325
|
objects?: string[] | undefined;
|
|
326
326
|
}, object, {}>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
|
|
327
327
|
description: string;
|
|
328
328
|
objects?: string[] | undefined;
|
|
329
329
|
}, {}>;
|
|
330
|
-
viewXVideo: (args?: Parameters<_ai_sdk_provider_utils.
|
|
330
|
+
viewXVideo: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<Record<string, never>, {
|
|
331
331
|
description: string;
|
|
332
332
|
transcript?: string | undefined;
|
|
333
333
|
duration?: number | undefined;
|
|
@@ -336,7 +336,7 @@ declare const xaiTools: {
|
|
|
336
336
|
transcript?: string | undefined;
|
|
337
337
|
duration?: number | undefined;
|
|
338
338
|
}, {}>;
|
|
339
|
-
webSearch: (args?: Parameters<_ai_sdk_provider_utils.
|
|
339
|
+
webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
|
|
340
340
|
query: string;
|
|
341
341
|
sources: Array<{
|
|
342
342
|
title: string;
|
|
@@ -355,7 +355,7 @@ declare const xaiTools: {
|
|
|
355
355
|
snippet: string;
|
|
356
356
|
}>;
|
|
357
357
|
}, {}>;
|
|
358
|
-
xSearch: (args?: Parameters<_ai_sdk_provider_utils.
|
|
358
|
+
xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
|
|
359
359
|
query: string;
|
|
360
360
|
posts: Array<{
|
|
361
361
|
author: string;
|
package/dist/index.js
CHANGED
|
@@ -133,7 +133,7 @@ function convertToXaiChatMessages(prompt) {
|
|
|
133
133
|
contentValue = output.value;
|
|
134
134
|
break;
|
|
135
135
|
case "execution-denied":
|
|
136
|
-
contentValue = (_a = output.reason) != null ? _a : "Tool execution denied.";
|
|
136
|
+
contentValue = (_a = output.reason) != null ? _a : "Tool call execution denied.";
|
|
137
137
|
break;
|
|
138
138
|
case "content":
|
|
139
139
|
case "json":
|
|
@@ -1808,7 +1808,7 @@ import { validateTypes } from "@ai-sdk/provider-utils";
|
|
|
1808
1808
|
|
|
1809
1809
|
// src/tool/file-search.ts
|
|
1810
1810
|
import {
|
|
1811
|
-
|
|
1811
|
+
createProviderExecutedToolFactory,
|
|
1812
1812
|
lazySchema,
|
|
1813
1813
|
zodSchema
|
|
1814
1814
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1836,7 +1836,7 @@ var fileSearchOutputSchema = lazySchema(
|
|
|
1836
1836
|
})
|
|
1837
1837
|
)
|
|
1838
1838
|
);
|
|
1839
|
-
var fileSearchToolFactory =
|
|
1839
|
+
var fileSearchToolFactory = createProviderExecutedToolFactory({
|
|
1840
1840
|
id: "xai.file_search",
|
|
1841
1841
|
inputSchema: lazySchema(() => zodSchema(z8.object({}))),
|
|
1842
1842
|
outputSchema: fileSearchOutputSchema
|
|
@@ -1845,7 +1845,7 @@ var fileSearch = (args) => fileSearchToolFactory(args);
|
|
|
1845
1845
|
|
|
1846
1846
|
// src/tool/mcp-server.ts
|
|
1847
1847
|
import {
|
|
1848
|
-
|
|
1848
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
|
|
1849
1849
|
lazySchema as lazySchema2,
|
|
1850
1850
|
zodSchema as zodSchema2
|
|
1851
1851
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1871,7 +1871,7 @@ var mcpServerOutputSchema = lazySchema2(
|
|
|
1871
1871
|
})
|
|
1872
1872
|
)
|
|
1873
1873
|
);
|
|
1874
|
-
var mcpServerToolFactory =
|
|
1874
|
+
var mcpServerToolFactory = createProviderExecutedToolFactory2({
|
|
1875
1875
|
id: "xai.mcp",
|
|
1876
1876
|
inputSchema: lazySchema2(() => zodSchema2(z9.object({}))),
|
|
1877
1877
|
outputSchema: mcpServerOutputSchema
|
|
@@ -1880,7 +1880,7 @@ var mcpServer = (args) => mcpServerToolFactory(args);
|
|
|
1880
1880
|
|
|
1881
1881
|
// src/tool/web-search.ts
|
|
1882
1882
|
import {
|
|
1883
|
-
|
|
1883
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
|
|
1884
1884
|
lazySchema as lazySchema3,
|
|
1885
1885
|
zodSchema as zodSchema3
|
|
1886
1886
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1908,7 +1908,7 @@ var webSearchOutputSchema = lazySchema3(
|
|
|
1908
1908
|
})
|
|
1909
1909
|
)
|
|
1910
1910
|
);
|
|
1911
|
-
var webSearchToolFactory =
|
|
1911
|
+
var webSearchToolFactory = createProviderExecutedToolFactory3({
|
|
1912
1912
|
id: "xai.web_search",
|
|
1913
1913
|
inputSchema: lazySchema3(() => zodSchema3(z10.object({}))),
|
|
1914
1914
|
outputSchema: webSearchOutputSchema
|
|
@@ -1917,7 +1917,7 @@ var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
|
1917
1917
|
|
|
1918
1918
|
// src/tool/x-search.ts
|
|
1919
1919
|
import {
|
|
1920
|
-
|
|
1920
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
|
|
1921
1921
|
lazySchema as lazySchema4,
|
|
1922
1922
|
zodSchema as zodSchema4
|
|
1923
1923
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1949,7 +1949,7 @@ var xSearchOutputSchema = lazySchema4(
|
|
|
1949
1949
|
})
|
|
1950
1950
|
)
|
|
1951
1951
|
);
|
|
1952
|
-
var xSearchToolFactory =
|
|
1952
|
+
var xSearchToolFactory = createProviderExecutedToolFactory4({
|
|
1953
1953
|
id: "xai.x_search",
|
|
1954
1954
|
inputSchema: lazySchema4(() => zodSchema4(z11.object({}))),
|
|
1955
1955
|
outputSchema: xSearchOutputSchema
|
|
@@ -2875,13 +2875,13 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2875
2875
|
};
|
|
2876
2876
|
|
|
2877
2877
|
// src/tool/code-execution.ts
|
|
2878
|
-
import {
|
|
2878
|
+
import { createProviderExecutedToolFactory as createProviderExecutedToolFactory5 } from "@ai-sdk/provider-utils";
|
|
2879
2879
|
import { z as z12 } from "zod/v4";
|
|
2880
2880
|
var codeExecutionOutputSchema = z12.object({
|
|
2881
2881
|
output: z12.string().describe("the output of the code execution"),
|
|
2882
2882
|
error: z12.string().optional().describe("any error that occurred")
|
|
2883
2883
|
});
|
|
2884
|
-
var codeExecutionToolFactory =
|
|
2884
|
+
var codeExecutionToolFactory = createProviderExecutedToolFactory5({
|
|
2885
2885
|
id: "xai.code_execution",
|
|
2886
2886
|
inputSchema: z12.object({}).describe("no input parameters"),
|
|
2887
2887
|
outputSchema: codeExecutionOutputSchema
|
|
@@ -2889,13 +2889,13 @@ var codeExecutionToolFactory = createProviderToolFactoryWithOutputSchema5({
|
|
|
2889
2889
|
var codeExecution = (args = {}) => codeExecutionToolFactory(args);
|
|
2890
2890
|
|
|
2891
2891
|
// src/tool/view-image.ts
|
|
2892
|
-
import {
|
|
2892
|
+
import { createProviderExecutedToolFactory as createProviderExecutedToolFactory6 } from "@ai-sdk/provider-utils";
|
|
2893
2893
|
import { z as z13 } from "zod/v4";
|
|
2894
2894
|
var viewImageOutputSchema = z13.object({
|
|
2895
2895
|
description: z13.string().describe("description of the image"),
|
|
2896
2896
|
objects: z13.array(z13.string()).optional().describe("objects detected in the image")
|
|
2897
2897
|
});
|
|
2898
|
-
var viewImageToolFactory =
|
|
2898
|
+
var viewImageToolFactory = createProviderExecutedToolFactory6({
|
|
2899
2899
|
id: "xai.view_image",
|
|
2900
2900
|
inputSchema: z13.object({}).describe("no input parameters"),
|
|
2901
2901
|
outputSchema: viewImageOutputSchema
|
|
@@ -2903,14 +2903,14 @@ var viewImageToolFactory = createProviderToolFactoryWithOutputSchema6({
|
|
|
2903
2903
|
var viewImage = (args = {}) => viewImageToolFactory(args);
|
|
2904
2904
|
|
|
2905
2905
|
// src/tool/view-x-video.ts
|
|
2906
|
-
import {
|
|
2906
|
+
import { createProviderExecutedToolFactory as createProviderExecutedToolFactory7 } from "@ai-sdk/provider-utils";
|
|
2907
2907
|
import { z as z14 } from "zod/v4";
|
|
2908
2908
|
var viewXVideoOutputSchema = z14.object({
|
|
2909
2909
|
transcript: z14.string().optional().describe("transcript of the video"),
|
|
2910
2910
|
description: z14.string().describe("description of the video content"),
|
|
2911
2911
|
duration: z14.number().optional().describe("duration in seconds")
|
|
2912
2912
|
});
|
|
2913
|
-
var viewXVideoToolFactory =
|
|
2913
|
+
var viewXVideoToolFactory = createProviderExecutedToolFactory7({
|
|
2914
2914
|
id: "xai.view_x_video",
|
|
2915
2915
|
inputSchema: z14.object({}).describe("no input parameters"),
|
|
2916
2916
|
outputSchema: viewXVideoOutputSchema
|
|
@@ -2929,7 +2929,7 @@ var xaiTools = {
|
|
|
2929
2929
|
};
|
|
2930
2930
|
|
|
2931
2931
|
// src/version.ts
|
|
2932
|
-
var VERSION = true ? "4.0.0-beta.
|
|
2932
|
+
var VERSION = true ? "4.0.0-beta.45" : "0.0.0-test";
|
|
2933
2933
|
|
|
2934
2934
|
// src/files/xai-files.ts
|
|
2935
2935
|
import {
|