@ai-sdk/xai 4.0.0-beta.6 → 4.0.0-beta.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/xai",
3
- "version": "4.0.0-beta.6",
3
+ "version": "4.0.0-beta.7",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -223,6 +223,9 @@ const outputItemSchema = z.discriminatedUnion('type', [
223
223
  type: z.literal('reasoning'),
224
224
  id: z.string(),
225
225
  summary: z.array(reasoningSummaryPartSchema),
226
+ content: z
227
+ .array(z.object({ type: z.string(), text: z.string() }))
228
+ .nullish(),
226
229
  status: z.string(),
227
230
  encrypted_content: z.string().nullish(),
228
231
  }),
@@ -165,8 +165,16 @@ export class XaiResponsesLanguageModel implements LanguageModelV3 {
165
165
  : { type: 'json_object' },
166
166
  },
167
167
  }),
168
- ...(options.reasoningEffort != null && {
169
- reasoning: { effort: options.reasoningEffort },
168
+ ...((options.reasoningEffort != null ||
169
+ options.reasoningSummary != null) && {
170
+ reasoning: {
171
+ ...(options.reasoningEffort != null && {
172
+ effort: options.reasoningEffort,
173
+ }),
174
+ ...(options.reasoningSummary != null && {
175
+ summary: options.reasoningSummary,
176
+ }),
177
+ },
170
178
  }),
171
179
  ...(options.store === false && {
172
180
  store: options.store,
@@ -360,12 +368,16 @@ export class XaiResponsesLanguageModel implements LanguageModelV3 {
360
368
  }
361
369
 
362
370
  case 'reasoning': {
363
- const summaryTexts = part.summary
364
- .map(s => s.text)
365
- .filter(text => text && text.length > 0);
371
+ const texts =
372
+ part.summary.length > 0
373
+ ? part.summary.map(s => s.text)
374
+ : (part.content ?? []).map(c => c.text);
375
+
376
+ const reasoningText = texts
377
+ .filter(text => text && text.length > 0)
378
+ .join('');
366
379
 
367
- if (summaryTexts.length > 0) {
368
- const reasoningText = summaryTexts.join('');
380
+ if (reasoningText) {
369
381
  if (part.encrypted_content || part.id) {
370
382
  content.push({
371
383
  type: 'reasoning',
@@ -17,6 +17,7 @@ export const xaiLanguageModelResponsesOptions = z.object({
17
17
  * Possible values are `low` (uses fewer reasoning tokens), `medium` and `high` (uses more reasoning tokens).
18
18
  */
19
19
  reasoningEffort: z.enum(['low', 'medium', 'high']).optional(),
20
+ reasoningSummary: z.enum(['auto', 'concise', 'detailed']).optional(),
20
21
  logprobs: z.boolean().optional(),
21
22
  topLogprobs: z.number().int().min(0).max(8).optional(),
22
23
  /**