@ai-sdk/xai 4.0.0-beta.42 → 4.0.0-beta.44
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 +47 -30
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/src/convert-to-xai-chat-messages.ts +1 -1
- package/src/responses/xai-responses-api.ts +1 -0
- package/src/responses/xai-responses-language-model.ts +16 -0
- 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.44
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 58a2ad7: fix: more precise default message for tool execution denial
|
|
8
|
+
- Updated dependencies [ab81968]
|
|
9
|
+
- Updated dependencies [785fe16]
|
|
10
|
+
- Updated dependencies [67df0a0]
|
|
11
|
+
- Updated dependencies [befb78c]
|
|
12
|
+
- Updated dependencies [0458559]
|
|
13
|
+
- Updated dependencies [58a2ad7]
|
|
14
|
+
- Updated dependencies [5852c0a]
|
|
15
|
+
- Updated dependencies [fc92055]
|
|
16
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.32
|
|
17
|
+
- @ai-sdk/provider-utils@5.0.0-beta.27
|
|
18
|
+
|
|
19
|
+
## 4.0.0-beta.43
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- a0b0a0c: expose costInUsdTicks in responses provider metadata
|
|
24
|
+
- Updated dependencies [2e98477]
|
|
25
|
+
- Updated dependencies [bfb756d]
|
|
26
|
+
- @ai-sdk/provider-utils@5.0.0-beta.26
|
|
27
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.31
|
|
28
|
+
|
|
3
29
|
## 4.0.0-beta.42
|
|
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":
|
|
@@ -1463,7 +1463,8 @@ var xaiResponsesUsageSchema = z6.object({
|
|
|
1463
1463
|
reasoning_tokens: z6.number().optional()
|
|
1464
1464
|
}).optional(),
|
|
1465
1465
|
num_sources_used: z6.number().optional(),
|
|
1466
|
-
num_server_side_tools_used: z6.number().optional()
|
|
1466
|
+
num_server_side_tools_used: z6.number().optional(),
|
|
1467
|
+
cost_in_usd_ticks: z6.number().nullish()
|
|
1467
1468
|
});
|
|
1468
1469
|
var xaiResponsesResponseSchema = z6.object({
|
|
1469
1470
|
id: z6.string().nullish(),
|
|
@@ -1807,7 +1808,7 @@ import { validateTypes } from "@ai-sdk/provider-utils";
|
|
|
1807
1808
|
|
|
1808
1809
|
// src/tool/file-search.ts
|
|
1809
1810
|
import {
|
|
1810
|
-
|
|
1811
|
+
createProviderExecutedToolFactory,
|
|
1811
1812
|
lazySchema,
|
|
1812
1813
|
zodSchema
|
|
1813
1814
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1835,7 +1836,7 @@ var fileSearchOutputSchema = lazySchema(
|
|
|
1835
1836
|
})
|
|
1836
1837
|
)
|
|
1837
1838
|
);
|
|
1838
|
-
var fileSearchToolFactory =
|
|
1839
|
+
var fileSearchToolFactory = createProviderExecutedToolFactory({
|
|
1839
1840
|
id: "xai.file_search",
|
|
1840
1841
|
inputSchema: lazySchema(() => zodSchema(z8.object({}))),
|
|
1841
1842
|
outputSchema: fileSearchOutputSchema
|
|
@@ -1844,7 +1845,7 @@ var fileSearch = (args) => fileSearchToolFactory(args);
|
|
|
1844
1845
|
|
|
1845
1846
|
// src/tool/mcp-server.ts
|
|
1846
1847
|
import {
|
|
1847
|
-
|
|
1848
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
|
|
1848
1849
|
lazySchema as lazySchema2,
|
|
1849
1850
|
zodSchema as zodSchema2
|
|
1850
1851
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1870,7 +1871,7 @@ var mcpServerOutputSchema = lazySchema2(
|
|
|
1870
1871
|
})
|
|
1871
1872
|
)
|
|
1872
1873
|
);
|
|
1873
|
-
var mcpServerToolFactory =
|
|
1874
|
+
var mcpServerToolFactory = createProviderExecutedToolFactory2({
|
|
1874
1875
|
id: "xai.mcp",
|
|
1875
1876
|
inputSchema: lazySchema2(() => zodSchema2(z9.object({}))),
|
|
1876
1877
|
outputSchema: mcpServerOutputSchema
|
|
@@ -1879,7 +1880,7 @@ var mcpServer = (args) => mcpServerToolFactory(args);
|
|
|
1879
1880
|
|
|
1880
1881
|
// src/tool/web-search.ts
|
|
1881
1882
|
import {
|
|
1882
|
-
|
|
1883
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
|
|
1883
1884
|
lazySchema as lazySchema3,
|
|
1884
1885
|
zodSchema as zodSchema3
|
|
1885
1886
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1907,7 +1908,7 @@ var webSearchOutputSchema = lazySchema3(
|
|
|
1907
1908
|
})
|
|
1908
1909
|
)
|
|
1909
1910
|
);
|
|
1910
|
-
var webSearchToolFactory =
|
|
1911
|
+
var webSearchToolFactory = createProviderExecutedToolFactory3({
|
|
1911
1912
|
id: "xai.web_search",
|
|
1912
1913
|
inputSchema: lazySchema3(() => zodSchema3(z10.object({}))),
|
|
1913
1914
|
outputSchema: webSearchOutputSchema
|
|
@@ -1916,7 +1917,7 @@ var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
|
1916
1917
|
|
|
1917
1918
|
// src/tool/x-search.ts
|
|
1918
1919
|
import {
|
|
1919
|
-
|
|
1920
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
|
|
1920
1921
|
lazySchema as lazySchema4,
|
|
1921
1922
|
zodSchema as zodSchema4
|
|
1922
1923
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1948,7 +1949,7 @@ var xSearchOutputSchema = lazySchema4(
|
|
|
1948
1949
|
})
|
|
1949
1950
|
)
|
|
1950
1951
|
);
|
|
1951
|
-
var xSearchToolFactory =
|
|
1952
|
+
var xSearchToolFactory = createProviderExecutedToolFactory4({
|
|
1952
1953
|
id: "xai.x_search",
|
|
1953
1954
|
inputSchema: lazySchema4(() => zodSchema4(z11.object({}))),
|
|
1954
1955
|
outputSchema: xSearchOutputSchema
|
|
@@ -2255,7 +2256,7 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2255
2256
|
};
|
|
2256
2257
|
}
|
|
2257
2258
|
async doGenerate(options) {
|
|
2258
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
2259
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2259
2260
|
const {
|
|
2260
2261
|
args: body,
|
|
2261
2262
|
warnings,
|
|
@@ -2412,6 +2413,13 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2412
2413
|
inputTokens: { total: 0, noCache: 0, cacheRead: 0, cacheWrite: 0 },
|
|
2413
2414
|
outputTokens: { total: 0, text: 0, reasoning: 0 }
|
|
2414
2415
|
},
|
|
2416
|
+
...((_q = response.usage) == null ? void 0 : _q.cost_in_usd_ticks) != null && {
|
|
2417
|
+
providerMetadata: {
|
|
2418
|
+
xai: {
|
|
2419
|
+
costInUsdTicks: response.usage.cost_in_usd_ticks
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
},
|
|
2415
2423
|
request: { body },
|
|
2416
2424
|
response: {
|
|
2417
2425
|
...getResponseMetadata(response),
|
|
@@ -2453,6 +2461,7 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2453
2461
|
};
|
|
2454
2462
|
let hasFunctionCall = false;
|
|
2455
2463
|
let usage = void 0;
|
|
2464
|
+
let costInUsdTicks = void 0;
|
|
2456
2465
|
let isFirstChunk = true;
|
|
2457
2466
|
const contentBlocks = {};
|
|
2458
2467
|
const seenToolCalls = /* @__PURE__ */ new Set();
|
|
@@ -2466,7 +2475,7 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2466
2475
|
controller.enqueue({ type: "stream-start", warnings });
|
|
2467
2476
|
},
|
|
2468
2477
|
transform(chunk, controller) {
|
|
2469
|
-
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
2478
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
2470
2479
|
if (options.includeRawChunks) {
|
|
2471
2480
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
2472
2481
|
}
|
|
@@ -2593,9 +2602,10 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2593
2602
|
const response2 = event.response;
|
|
2594
2603
|
if (response2.usage) {
|
|
2595
2604
|
usage = convertXaiResponsesUsage(response2.usage);
|
|
2605
|
+
costInUsdTicks = (_c2 = response2.usage.cost_in_usd_ticks) != null ? _c2 : void 0;
|
|
2596
2606
|
}
|
|
2597
2607
|
if (event.type === "response.incomplete") {
|
|
2598
|
-
const reason = "incomplete_details" in response2 ? (
|
|
2608
|
+
const reason = "incomplete_details" in response2 ? (_d = response2.incomplete_details) == null ? void 0 : _d.reason : void 0;
|
|
2599
2609
|
finishReason = {
|
|
2600
2610
|
unified: reason ? mapXaiResponsesFinishReason(reason) : "other",
|
|
2601
2611
|
raw: reason != null ? reason : "incomplete"
|
|
@@ -2609,7 +2619,7 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2609
2619
|
return;
|
|
2610
2620
|
}
|
|
2611
2621
|
if (event.type === "response.failed") {
|
|
2612
|
-
const reason = (
|
|
2622
|
+
const reason = (_e = event.response.incomplete_details) == null ? void 0 : _e.reason;
|
|
2613
2623
|
finishReason = {
|
|
2614
2624
|
unified: reason ? mapXaiResponsesFinishReason(reason) : "error",
|
|
2615
2625
|
raw: reason != null ? reason : "error"
|
|
@@ -2705,13 +2715,13 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2705
2715
|
toolCallId: part.id,
|
|
2706
2716
|
toolName,
|
|
2707
2717
|
result: {
|
|
2708
|
-
queries: (
|
|
2709
|
-
results: (
|
|
2718
|
+
queries: (_f = part.queries) != null ? _f : [],
|
|
2719
|
+
results: (_h = (_g = part.results) == null ? void 0 : _g.map((result) => ({
|
|
2710
2720
|
fileId: result.file_id,
|
|
2711
2721
|
filename: result.filename,
|
|
2712
2722
|
score: result.score,
|
|
2713
2723
|
text: result.text
|
|
2714
|
-
}))) != null ?
|
|
2724
|
+
}))) != null ? _h : null
|
|
2715
2725
|
}
|
|
2716
2726
|
});
|
|
2717
2727
|
}
|
|
@@ -2729,17 +2739,17 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2729
2739
|
"x_semantic_search",
|
|
2730
2740
|
"x_thread_fetch"
|
|
2731
2741
|
];
|
|
2732
|
-
let toolName = (
|
|
2733
|
-
if (webSearchSubTools.includes((
|
|
2742
|
+
let toolName = (_i = part.name) != null ? _i : "";
|
|
2743
|
+
if (webSearchSubTools.includes((_j = part.name) != null ? _j : "") || part.type === "web_search_call") {
|
|
2734
2744
|
toolName = webSearchToolName != null ? webSearchToolName : "web_search";
|
|
2735
|
-
} else if (xSearchSubTools.includes((
|
|
2745
|
+
} else if (xSearchSubTools.includes((_k = part.name) != null ? _k : "") || part.type === "x_search_call") {
|
|
2736
2746
|
toolName = xSearchToolName != null ? xSearchToolName : "x_search";
|
|
2737
2747
|
} else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
|
|
2738
2748
|
toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
|
|
2739
2749
|
} else if (part.type === "mcp_call") {
|
|
2740
|
-
toolName = (
|
|
2750
|
+
toolName = (_l = mcpToolName != null ? mcpToolName : part.name) != null ? _l : "mcp";
|
|
2741
2751
|
}
|
|
2742
|
-
const toolInput = part.type === "custom_tool_call" ? (
|
|
2752
|
+
const toolInput = part.type === "custom_tool_call" ? (_m = part.input) != null ? _m : "" : part.type === "mcp_call" ? (_n = part.arguments) != null ? _n : "" : (_o = part.arguments) != null ? _o : "";
|
|
2743
2753
|
const shouldEmit = part.type === "custom_tool_call" ? event.type === "response.output_item.done" : !seenToolCalls.has(part.id);
|
|
2744
2754
|
if (shouldEmit && !seenToolCalls.has(part.id)) {
|
|
2745
2755
|
seenToolCalls.add(part.id);
|
|
@@ -2792,7 +2802,7 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2792
2802
|
sourceType: "url",
|
|
2793
2803
|
id: self.config.generateId(),
|
|
2794
2804
|
url: annotation.url,
|
|
2795
|
-
title: (
|
|
2805
|
+
title: (_p = annotation.title) != null ? _p : annotation.url
|
|
2796
2806
|
});
|
|
2797
2807
|
}
|
|
2798
2808
|
}
|
|
@@ -2846,6 +2856,13 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2846
2856
|
cacheWrite: 0
|
|
2847
2857
|
},
|
|
2848
2858
|
outputTokens: { total: 0, text: 0, reasoning: 0 }
|
|
2859
|
+
},
|
|
2860
|
+
...costInUsdTicks != null && {
|
|
2861
|
+
providerMetadata: {
|
|
2862
|
+
xai: {
|
|
2863
|
+
costInUsdTicks
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2849
2866
|
}
|
|
2850
2867
|
});
|
|
2851
2868
|
}
|
|
@@ -2858,13 +2875,13 @@ var XaiResponsesLanguageModel = class _XaiResponsesLanguageModel {
|
|
|
2858
2875
|
};
|
|
2859
2876
|
|
|
2860
2877
|
// src/tool/code-execution.ts
|
|
2861
|
-
import {
|
|
2878
|
+
import { createProviderExecutedToolFactory as createProviderExecutedToolFactory5 } from "@ai-sdk/provider-utils";
|
|
2862
2879
|
import { z as z12 } from "zod/v4";
|
|
2863
2880
|
var codeExecutionOutputSchema = z12.object({
|
|
2864
2881
|
output: z12.string().describe("the output of the code execution"),
|
|
2865
2882
|
error: z12.string().optional().describe("any error that occurred")
|
|
2866
2883
|
});
|
|
2867
|
-
var codeExecutionToolFactory =
|
|
2884
|
+
var codeExecutionToolFactory = createProviderExecutedToolFactory5({
|
|
2868
2885
|
id: "xai.code_execution",
|
|
2869
2886
|
inputSchema: z12.object({}).describe("no input parameters"),
|
|
2870
2887
|
outputSchema: codeExecutionOutputSchema
|
|
@@ -2872,13 +2889,13 @@ var codeExecutionToolFactory = createProviderToolFactoryWithOutputSchema5({
|
|
|
2872
2889
|
var codeExecution = (args = {}) => codeExecutionToolFactory(args);
|
|
2873
2890
|
|
|
2874
2891
|
// src/tool/view-image.ts
|
|
2875
|
-
import {
|
|
2892
|
+
import { createProviderExecutedToolFactory as createProviderExecutedToolFactory6 } from "@ai-sdk/provider-utils";
|
|
2876
2893
|
import { z as z13 } from "zod/v4";
|
|
2877
2894
|
var viewImageOutputSchema = z13.object({
|
|
2878
2895
|
description: z13.string().describe("description of the image"),
|
|
2879
2896
|
objects: z13.array(z13.string()).optional().describe("objects detected in the image")
|
|
2880
2897
|
});
|
|
2881
|
-
var viewImageToolFactory =
|
|
2898
|
+
var viewImageToolFactory = createProviderExecutedToolFactory6({
|
|
2882
2899
|
id: "xai.view_image",
|
|
2883
2900
|
inputSchema: z13.object({}).describe("no input parameters"),
|
|
2884
2901
|
outputSchema: viewImageOutputSchema
|
|
@@ -2886,14 +2903,14 @@ var viewImageToolFactory = createProviderToolFactoryWithOutputSchema6({
|
|
|
2886
2903
|
var viewImage = (args = {}) => viewImageToolFactory(args);
|
|
2887
2904
|
|
|
2888
2905
|
// src/tool/view-x-video.ts
|
|
2889
|
-
import {
|
|
2906
|
+
import { createProviderExecutedToolFactory as createProviderExecutedToolFactory7 } from "@ai-sdk/provider-utils";
|
|
2890
2907
|
import { z as z14 } from "zod/v4";
|
|
2891
2908
|
var viewXVideoOutputSchema = z14.object({
|
|
2892
2909
|
transcript: z14.string().optional().describe("transcript of the video"),
|
|
2893
2910
|
description: z14.string().describe("description of the video content"),
|
|
2894
2911
|
duration: z14.number().optional().describe("duration in seconds")
|
|
2895
2912
|
});
|
|
2896
|
-
var viewXVideoToolFactory =
|
|
2913
|
+
var viewXVideoToolFactory = createProviderExecutedToolFactory7({
|
|
2897
2914
|
id: "xai.view_x_video",
|
|
2898
2915
|
inputSchema: z14.object({}).describe("no input parameters"),
|
|
2899
2916
|
outputSchema: viewXVideoOutputSchema
|
|
@@ -2912,7 +2929,7 @@ var xaiTools = {
|
|
|
2912
2929
|
};
|
|
2913
2930
|
|
|
2914
2931
|
// src/version.ts
|
|
2915
|
-
var VERSION = true ? "4.0.0-beta.
|
|
2932
|
+
var VERSION = true ? "4.0.0-beta.44" : "0.0.0-test";
|
|
2916
2933
|
|
|
2917
2934
|
// src/files/xai-files.ts
|
|
2918
2935
|
import {
|