@ai-sdk/xai 2.0.63 → 2.0.64
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 +6 -0
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1788,6 +1788,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
1788
1788
|
fetch: this.config.fetch
|
|
1789
1789
|
});
|
|
1790
1790
|
const content = [];
|
|
1791
|
+
let hasFunctionCall = false;
|
|
1791
1792
|
const webSearchSubTools = [
|
|
1792
1793
|
"web_search",
|
|
1793
1794
|
"web_search_with_snippets",
|
|
@@ -1845,6 +1846,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
1845
1846
|
break;
|
|
1846
1847
|
}
|
|
1847
1848
|
case "function_call": {
|
|
1849
|
+
hasFunctionCall = true;
|
|
1848
1850
|
content.push({
|
|
1849
1851
|
type: "tool-call",
|
|
1850
1852
|
toolCallId: part.call_id,
|
|
@@ -1886,7 +1888,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
1886
1888
|
}
|
|
1887
1889
|
return {
|
|
1888
1890
|
content,
|
|
1889
|
-
finishReason: mapXaiResponsesFinishReason(response.status),
|
|
1891
|
+
finishReason: hasFunctionCall ? "tool-calls" : mapXaiResponsesFinishReason(response.status),
|
|
1890
1892
|
usage: convertXaiResponsesUsage(response.usage),
|
|
1891
1893
|
request: { body },
|
|
1892
1894
|
response: {
|
|
@@ -1927,6 +1929,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
1927
1929
|
outputTokens: void 0,
|
|
1928
1930
|
totalTokens: void 0
|
|
1929
1931
|
};
|
|
1932
|
+
let hasFunctionCall = false;
|
|
1930
1933
|
let isFirstChunk = true;
|
|
1931
1934
|
const contentBlocks = {};
|
|
1932
1935
|
const seenToolCalls = /* @__PURE__ */ new Set();
|
|
@@ -2073,7 +2076,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
2073
2076
|
usage.cachedInputTokens = converted.cachedInputTokens;
|
|
2074
2077
|
}
|
|
2075
2078
|
if (response2.status) {
|
|
2076
|
-
finishReason = mapXaiResponsesFinishReason(response2.status);
|
|
2079
|
+
finishReason = hasFunctionCall ? "tool-calls" : mapXaiResponsesFinishReason(response2.status);
|
|
2077
2080
|
}
|
|
2078
2081
|
return;
|
|
2079
2082
|
}
|
|
@@ -2213,6 +2216,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
2213
2216
|
toolName: part.name
|
|
2214
2217
|
});
|
|
2215
2218
|
} else if (event.type === "response.output_item.done") {
|
|
2219
|
+
hasFunctionCall = true;
|
|
2216
2220
|
ongoingToolCalls[event.output_index] = void 0;
|
|
2217
2221
|
controller.enqueue({
|
|
2218
2222
|
type: "tool-input-end",
|
|
@@ -2303,7 +2307,7 @@ var xaiTools = {
|
|
|
2303
2307
|
};
|
|
2304
2308
|
|
|
2305
2309
|
// src/version.ts
|
|
2306
|
-
var VERSION = true ? "2.0.
|
|
2310
|
+
var VERSION = true ? "2.0.64" : "0.0.0-test";
|
|
2307
2311
|
|
|
2308
2312
|
// src/xai-provider.ts
|
|
2309
2313
|
var xaiErrorStructure = {
|