@ai-sdk/xai 2.0.43 → 2.0.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 +14 -2
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1377,11 +1377,9 @@ async function prepareResponsesTools({
|
|
|
1377
1377
|
} else {
|
|
1378
1378
|
xaiTools2.push({
|
|
1379
1379
|
type: "function",
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
parameters: tool.inputSchema
|
|
1384
|
-
}
|
|
1380
|
+
name: tool.name,
|
|
1381
|
+
description: tool.description,
|
|
1382
|
+
parameters: tool.inputSchema
|
|
1385
1383
|
});
|
|
1386
1384
|
}
|
|
1387
1385
|
}
|
|
@@ -1561,7 +1559,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
1561
1559
|
};
|
|
1562
1560
|
}
|
|
1563
1561
|
async doGenerate(options) {
|
|
1564
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1562
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1565
1563
|
const {
|
|
1566
1564
|
args: body,
|
|
1567
1565
|
warnings,
|
|
@@ -1662,7 +1660,8 @@ var XaiResponsesLanguageModel = class {
|
|
|
1662
1660
|
inputTokens: response.usage.input_tokens,
|
|
1663
1661
|
outputTokens: response.usage.output_tokens,
|
|
1664
1662
|
totalTokens: response.usage.total_tokens,
|
|
1665
|
-
reasoningTokens: (_h = response.usage.output_tokens_details) == null ? void 0 : _h.reasoning_tokens
|
|
1663
|
+
reasoningTokens: (_h = response.usage.output_tokens_details) == null ? void 0 : _h.reasoning_tokens,
|
|
1664
|
+
cachedInputTokens: (_i = response.usage.input_tokens_details) == null ? void 0 : _i.cached_tokens
|
|
1666
1665
|
},
|
|
1667
1666
|
request: { body },
|
|
1668
1667
|
response: {
|
|
@@ -1714,7 +1713,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
1714
1713
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1715
1714
|
},
|
|
1716
1715
|
transform(chunk, controller) {
|
|
1717
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1716
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1718
1717
|
if (options.includeRawChunks) {
|
|
1719
1718
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
1720
1719
|
}
|
|
@@ -1805,9 +1804,10 @@ var XaiResponsesLanguageModel = class {
|
|
|
1805
1804
|
const response2 = event.response;
|
|
1806
1805
|
if (response2.usage) {
|
|
1807
1806
|
usage.inputTokens = response2.usage.input_tokens;
|
|
1807
|
+
usage.cachedInputTokens = (_c = response2.usage.input_tokens_details) == null ? void 0 : _c.cached_tokens;
|
|
1808
1808
|
usage.outputTokens = response2.usage.output_tokens;
|
|
1809
1809
|
usage.totalTokens = response2.usage.total_tokens;
|
|
1810
|
-
usage.reasoningTokens = (
|
|
1810
|
+
usage.reasoningTokens = (_d = response2.usage.output_tokens_details) == null ? void 0 : _d.reasoning_tokens;
|
|
1811
1811
|
}
|
|
1812
1812
|
if (response2.status) {
|
|
1813
1813
|
finishReason = mapXaiResponsesFinishReason(response2.status);
|
|
@@ -1830,15 +1830,15 @@ var XaiResponsesLanguageModel = class {
|
|
|
1830
1830
|
"x_semantic_search",
|
|
1831
1831
|
"x_thread_fetch"
|
|
1832
1832
|
];
|
|
1833
|
-
let toolName = (
|
|
1834
|
-
if (webSearchSubTools.includes((
|
|
1833
|
+
let toolName = (_e = part.name) != null ? _e : "";
|
|
1834
|
+
if (webSearchSubTools.includes((_f = part.name) != null ? _f : "")) {
|
|
1835
1835
|
toolName = webSearchToolName != null ? webSearchToolName : "web_search";
|
|
1836
|
-
} else if (xSearchSubTools.includes((
|
|
1836
|
+
} else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "")) {
|
|
1837
1837
|
toolName = xSearchToolName != null ? xSearchToolName : "x_search";
|
|
1838
1838
|
} else if (part.name === "code_execution") {
|
|
1839
1839
|
toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
|
|
1840
1840
|
}
|
|
1841
|
-
const toolInput = part.type === "custom_tool_call" ? (
|
|
1841
|
+
const toolInput = part.type === "custom_tool_call" ? (_h = part.input) != null ? _h : "" : (_i = part.arguments) != null ? _i : "";
|
|
1842
1842
|
controller.enqueue({
|
|
1843
1843
|
type: "tool-input-start",
|
|
1844
1844
|
id: part.id,
|
|
@@ -1888,7 +1888,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
1888
1888
|
sourceType: "url",
|
|
1889
1889
|
id: self.config.generateId(),
|
|
1890
1890
|
url: annotation.url,
|
|
1891
|
-
title: (
|
|
1891
|
+
title: (_j = annotation.title) != null ? _j : annotation.url
|
|
1892
1892
|
});
|
|
1893
1893
|
}
|
|
1894
1894
|
}
|
|
@@ -1996,7 +1996,7 @@ var xaiTools = {
|
|
|
1996
1996
|
};
|
|
1997
1997
|
|
|
1998
1998
|
// src/version.ts
|
|
1999
|
-
var VERSION = true ? "2.0.
|
|
1999
|
+
var VERSION = true ? "2.0.45" : "0.0.0-test";
|
|
2000
2000
|
|
|
2001
2001
|
// src/xai-provider.ts
|
|
2002
2002
|
var xaiErrorStructure = {
|