@ai-sdk/xai 4.0.0-beta.16 → 4.0.0-beta.18
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 +15 -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 +4 -4
- package/src/responses/xai-responses-language-model.ts +10 -2
package/dist/index.mjs
CHANGED
|
@@ -2164,6 +2164,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
2164
2164
|
fetch: this.config.fetch
|
|
2165
2165
|
});
|
|
2166
2166
|
const content = [];
|
|
2167
|
+
let hasFunctionCall = false;
|
|
2167
2168
|
const webSearchSubTools = [
|
|
2168
2169
|
"web_search",
|
|
2169
2170
|
"web_search_with_snippets",
|
|
@@ -2248,6 +2249,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
2248
2249
|
break;
|
|
2249
2250
|
}
|
|
2250
2251
|
case "function_call": {
|
|
2252
|
+
hasFunctionCall = true;
|
|
2251
2253
|
content.push({
|
|
2252
2254
|
type: "tool-call",
|
|
2253
2255
|
toolCallId: part.call_id,
|
|
@@ -2290,7 +2292,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
2290
2292
|
return {
|
|
2291
2293
|
content,
|
|
2292
2294
|
finishReason: {
|
|
2293
|
-
unified: mapXaiResponsesFinishReason(response.status),
|
|
2295
|
+
unified: hasFunctionCall ? "tool-calls" : mapXaiResponsesFinishReason(response.status),
|
|
2294
2296
|
raw: (_n = response.status) != null ? _n : void 0
|
|
2295
2297
|
},
|
|
2296
2298
|
usage: response.usage ? convertXaiResponsesUsage(response.usage) : {
|
|
@@ -2336,6 +2338,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
2336
2338
|
unified: "other",
|
|
2337
2339
|
raw: void 0
|
|
2338
2340
|
};
|
|
2341
|
+
let hasFunctionCall = false;
|
|
2339
2342
|
let usage = void 0;
|
|
2340
2343
|
let isFirstChunk = true;
|
|
2341
2344
|
const contentBlocks = {};
|
|
@@ -2480,7 +2483,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
2480
2483
|
}
|
|
2481
2484
|
if (response2.status) {
|
|
2482
2485
|
finishReason = {
|
|
2483
|
-
unified: mapXaiResponsesFinishReason(response2.status),
|
|
2486
|
+
unified: hasFunctionCall ? "tool-calls" : mapXaiResponsesFinishReason(response2.status),
|
|
2484
2487
|
raw: response2.status
|
|
2485
2488
|
};
|
|
2486
2489
|
}
|
|
@@ -2673,6 +2676,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
2673
2676
|
toolName: part.name
|
|
2674
2677
|
});
|
|
2675
2678
|
} else if (event.type === "response.output_item.done") {
|
|
2679
|
+
hasFunctionCall = true;
|
|
2676
2680
|
ongoingToolCalls[event.output_index] = void 0;
|
|
2677
2681
|
controller.enqueue({
|
|
2678
2682
|
type: "tool-input-end",
|
|
@@ -2774,7 +2778,7 @@ var xaiTools = {
|
|
|
2774
2778
|
};
|
|
2775
2779
|
|
|
2776
2780
|
// src/version.ts
|
|
2777
|
-
var VERSION = true ? "4.0.0-beta.
|
|
2781
|
+
var VERSION = true ? "4.0.0-beta.18" : "0.0.0-test";
|
|
2778
2782
|
|
|
2779
2783
|
// src/xai-video-model.ts
|
|
2780
2784
|
import {
|