@ai-sdk/xai 3.0.48 → 3.0.49

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 3.0.49
4
+
5
+ ### Patch Changes
6
+
7
+ - 8b3e72d: fix (provider/xai): handle new reasoning text chunk parts
8
+
3
9
  ## 3.0.48
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1277,6 +1277,20 @@ var xaiResponsesChunkSchema = import_v44.z.union([
1277
1277
  summary_index: import_v44.z.number(),
1278
1278
  text: import_v44.z.string()
1279
1279
  }),
1280
+ import_v44.z.object({
1281
+ type: import_v44.z.literal("response.reasoning_text.delta"),
1282
+ item_id: import_v44.z.string(),
1283
+ output_index: import_v44.z.number(),
1284
+ content_index: import_v44.z.number(),
1285
+ delta: import_v44.z.string()
1286
+ }),
1287
+ import_v44.z.object({
1288
+ type: import_v44.z.literal("response.reasoning_text.done"),
1289
+ item_id: import_v44.z.string(),
1290
+ output_index: import_v44.z.number(),
1291
+ content_index: import_v44.z.number(),
1292
+ text: import_v44.z.string()
1293
+ }),
1280
1294
  import_v44.z.object({
1281
1295
  type: import_v44.z.literal("response.web_search_call.in_progress"),
1282
1296
  item_id: import_v44.z.string(),
@@ -2127,6 +2141,35 @@ var XaiResponsesLanguageModel = class {
2127
2141
  if (event.type === "response.reasoning_summary_text.done") {
2128
2142
  return;
2129
2143
  }
2144
+ if (event.type === "response.reasoning_text.delta") {
2145
+ const blockId = `reasoning-${event.item_id}`;
2146
+ if (activeReasoning[event.item_id] == null) {
2147
+ activeReasoning[event.item_id] = {};
2148
+ controller.enqueue({
2149
+ type: "reasoning-start",
2150
+ id: blockId,
2151
+ providerMetadata: {
2152
+ xai: {
2153
+ itemId: event.item_id
2154
+ }
2155
+ }
2156
+ });
2157
+ }
2158
+ controller.enqueue({
2159
+ type: "reasoning-delta",
2160
+ id: blockId,
2161
+ delta: event.delta,
2162
+ providerMetadata: {
2163
+ xai: {
2164
+ itemId: event.item_id
2165
+ }
2166
+ }
2167
+ });
2168
+ return;
2169
+ }
2170
+ if (event.type === "response.reasoning_text.done") {
2171
+ return;
2172
+ }
2130
2173
  if (event.type === "response.output_text.delta") {
2131
2174
  const blockId = `text-${event.item_id}`;
2132
2175
  if (contentBlocks[blockId] == null) {
@@ -2447,7 +2490,7 @@ var xaiTools = {
2447
2490
  };
2448
2491
 
2449
2492
  // src/version.ts
2450
- var VERSION = true ? "3.0.48" : "0.0.0-test";
2493
+ var VERSION = true ? "3.0.49" : "0.0.0-test";
2451
2494
 
2452
2495
  // src/xai-provider.ts
2453
2496
  var xaiErrorStructure = {