@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/dist/index.mjs
CHANGED
|
@@ -1348,6 +1348,7 @@ var outputItemSchema = z6.discriminatedUnion("type", [
|
|
|
1348
1348
|
type: z6.literal("reasoning"),
|
|
1349
1349
|
id: z6.string(),
|
|
1350
1350
|
summary: z6.array(reasoningSummaryPartSchema),
|
|
1351
|
+
content: z6.array(z6.object({ type: z6.string(), text: z6.string() })).nullish(),
|
|
1351
1352
|
status: z6.string(),
|
|
1352
1353
|
encrypted_content: z6.string().nullish()
|
|
1353
1354
|
})
|
|
@@ -1654,6 +1655,7 @@ var xaiLanguageModelResponsesOptions = z7.object({
|
|
|
1654
1655
|
* Possible values are `low` (uses fewer reasoning tokens), `medium` and `high` (uses more reasoning tokens).
|
|
1655
1656
|
*/
|
|
1656
1657
|
reasoningEffort: z7.enum(["low", "medium", "high"]).optional(),
|
|
1658
|
+
reasoningSummary: z7.enum(["auto", "concise", "detailed"]).optional(),
|
|
1657
1659
|
logprobs: z7.boolean().optional(),
|
|
1658
1660
|
topLogprobs: z7.number().int().min(0).max(8).optional(),
|
|
1659
1661
|
/**
|
|
@@ -2070,8 +2072,15 @@ var XaiResponsesLanguageModel = class {
|
|
|
2070
2072
|
} : { type: "json_object" }
|
|
2071
2073
|
}
|
|
2072
2074
|
},
|
|
2073
|
-
...options.reasoningEffort != null && {
|
|
2074
|
-
reasoning: {
|
|
2075
|
+
...(options.reasoningEffort != null || options.reasoningSummary != null) && {
|
|
2076
|
+
reasoning: {
|
|
2077
|
+
...options.reasoningEffort != null && {
|
|
2078
|
+
effort: options.reasoningEffort
|
|
2079
|
+
},
|
|
2080
|
+
...options.reasoningSummary != null && {
|
|
2081
|
+
summary: options.reasoningSummary
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2075
2084
|
},
|
|
2076
2085
|
...options.store === false && {
|
|
2077
2086
|
store: options.store
|
|
@@ -2100,7 +2109,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
2100
2109
|
};
|
|
2101
2110
|
}
|
|
2102
2111
|
async doGenerate(options) {
|
|
2103
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2112
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
2104
2113
|
const {
|
|
2105
2114
|
args: body,
|
|
2106
2115
|
warnings,
|
|
@@ -2219,9 +2228,9 @@ var XaiResponsesLanguageModel = class {
|
|
|
2219
2228
|
break;
|
|
2220
2229
|
}
|
|
2221
2230
|
case "reasoning": {
|
|
2222
|
-
const
|
|
2223
|
-
|
|
2224
|
-
|
|
2231
|
+
const texts = part.summary.length > 0 ? part.summary.map((s) => s.text) : ((_m = part.content) != null ? _m : []).map((c) => c.text);
|
|
2232
|
+
const reasoningText = texts.filter((text) => text && text.length > 0).join("");
|
|
2233
|
+
if (reasoningText) {
|
|
2225
2234
|
if (part.encrypted_content || part.id) {
|
|
2226
2235
|
content.push({
|
|
2227
2236
|
type: "reasoning",
|
|
@@ -2253,7 +2262,7 @@ var XaiResponsesLanguageModel = class {
|
|
|
2253
2262
|
content,
|
|
2254
2263
|
finishReason: {
|
|
2255
2264
|
unified: mapXaiResponsesFinishReason(response.status),
|
|
2256
|
-
raw: (
|
|
2265
|
+
raw: (_n = response.status) != null ? _n : void 0
|
|
2257
2266
|
},
|
|
2258
2267
|
usage: response.usage ? convertXaiResponsesUsage(response.usage) : {
|
|
2259
2268
|
inputTokens: { total: 0, noCache: 0, cacheRead: 0, cacheWrite: 0 },
|
|
@@ -2736,7 +2745,7 @@ var xaiTools = {
|
|
|
2736
2745
|
};
|
|
2737
2746
|
|
|
2738
2747
|
// src/version.ts
|
|
2739
|
-
var VERSION = true ? "4.0.0-beta.
|
|
2748
|
+
var VERSION = true ? "4.0.0-beta.7" : "0.0.0-test";
|
|
2740
2749
|
|
|
2741
2750
|
// src/xai-video-model.ts
|
|
2742
2751
|
import {
|