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