@ai-sdk/xai 3.0.74 → 3.0.76

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/dist/index.mjs CHANGED
@@ -2126,6 +2126,7 @@ var XaiResponsesLanguageModel = class {
2126
2126
  fetch: this.config.fetch
2127
2127
  });
2128
2128
  const content = [];
2129
+ let hasFunctionCall = false;
2129
2130
  const webSearchSubTools = [
2130
2131
  "web_search",
2131
2132
  "web_search_with_snippets",
@@ -2210,6 +2211,7 @@ var XaiResponsesLanguageModel = class {
2210
2211
  break;
2211
2212
  }
2212
2213
  case "function_call": {
2214
+ hasFunctionCall = true;
2213
2215
  content.push({
2214
2216
  type: "tool-call",
2215
2217
  toolCallId: part.call_id,
@@ -2252,7 +2254,7 @@ var XaiResponsesLanguageModel = class {
2252
2254
  return {
2253
2255
  content,
2254
2256
  finishReason: {
2255
- unified: mapXaiResponsesFinishReason(response.status),
2257
+ unified: hasFunctionCall ? "tool-calls" : mapXaiResponsesFinishReason(response.status),
2256
2258
  raw: (_m = response.status) != null ? _m : void 0
2257
2259
  },
2258
2260
  usage: response.usage ? convertXaiResponsesUsage(response.usage) : {
@@ -2298,6 +2300,7 @@ var XaiResponsesLanguageModel = class {
2298
2300
  unified: "other",
2299
2301
  raw: void 0
2300
2302
  };
2303
+ let hasFunctionCall = false;
2301
2304
  let usage = void 0;
2302
2305
  let isFirstChunk = true;
2303
2306
  const contentBlocks = {};
@@ -2442,7 +2445,7 @@ var XaiResponsesLanguageModel = class {
2442
2445
  }
2443
2446
  if (response2.status) {
2444
2447
  finishReason = {
2445
- unified: mapXaiResponsesFinishReason(response2.status),
2448
+ unified: hasFunctionCall ? "tool-calls" : mapXaiResponsesFinishReason(response2.status),
2446
2449
  raw: response2.status
2447
2450
  };
2448
2451
  }
@@ -2635,6 +2638,7 @@ var XaiResponsesLanguageModel = class {
2635
2638
  toolName: part.name
2636
2639
  });
2637
2640
  } else if (event.type === "response.output_item.done") {
2641
+ hasFunctionCall = true;
2638
2642
  ongoingToolCalls[event.output_index] = void 0;
2639
2643
  controller.enqueue({
2640
2644
  type: "tool-input-end",
@@ -2736,7 +2740,7 @@ var xaiTools = {
2736
2740
  };
2737
2741
 
2738
2742
  // src/version.ts
2739
- var VERSION = true ? "3.0.74" : "0.0.0-test";
2743
+ var VERSION = true ? "3.0.76" : "0.0.0-test";
2740
2744
 
2741
2745
  // src/xai-video-model.ts
2742
2746
  import {