@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/CHANGELOG.md +7 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/responses/xai-responses-api.ts +3 -0
- package/src/responses/xai-responses-language-model.ts +19 -7
- package/src/responses/xai-responses-options.ts +1 -0
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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
|
|
364
|
-
.
|
|
365
|
-
|
|
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 (
|
|
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
|
/**
|