@ai-sdk/xai 4.0.0-beta.6 → 4.0.0-beta.8
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 +13 -0
- package/dist/index.d.mts +15 -10
- package/dist/index.d.ts +15 -10
- package/dist/index.js +25 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/convert-to-xai-chat-messages.ts +5 -5
- package/src/convert-xai-chat-usage.ts +2 -2
- package/src/map-xai-finish-reason.ts +2 -2
- package/src/responses/convert-to-xai-responses-input.ts +5 -5
- package/src/responses/convert-xai-responses-usage.ts +2 -2
- package/src/responses/map-xai-responses-finish-reason.ts +2 -2
- package/src/responses/xai-responses-api.ts +3 -0
- package/src/responses/xai-responses-language-model.ts +40 -28
- package/src/responses/xai-responses-options.ts +1 -0
- package/src/responses/xai-responses-prepare-tools.ts +6 -6
- package/src/xai-chat-language-model.ts +21 -21
- package/src/xai-image-model.ts +6 -6
- package/src/xai-prepare-tools.ts +6 -6
- package/src/xai-provider.ts +14 -14
- package/src/xai-video-model.ts +7 -7
package/dist/index.mjs
CHANGED
|
@@ -356,7 +356,7 @@ function prepareTools({
|
|
|
356
356
|
// src/xai-chat-language-model.ts
|
|
357
357
|
var XaiChatLanguageModel = class {
|
|
358
358
|
constructor(modelId, config) {
|
|
359
|
-
this.specificationVersion = "
|
|
359
|
+
this.specificationVersion = "v4";
|
|
360
360
|
this.supportedUrls = {
|
|
361
361
|
"image/*": [/^https?:\/\/.*$/]
|
|
362
362
|
};
|
|
@@ -898,7 +898,7 @@ var XaiImageModel = class {
|
|
|
898
898
|
constructor(modelId, config) {
|
|
899
899
|
this.modelId = modelId;
|
|
900
900
|
this.config = config;
|
|
901
|
-
this.specificationVersion = "
|
|
901
|
+
this.specificationVersion = "v4";
|
|
902
902
|
this.maxImagesPerCall = 3;
|
|
903
903
|
}
|
|
904
904
|
get provider() {
|
|
@@ -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
|
/**
|
|
@@ -1981,7 +1983,7 @@ async function prepareResponsesTools({
|
|
|
1981
1983
|
// src/responses/xai-responses-language-model.ts
|
|
1982
1984
|
var XaiResponsesLanguageModel = class {
|
|
1983
1985
|
constructor(modelId, config) {
|
|
1984
|
-
this.specificationVersion = "
|
|
1986
|
+
this.specificationVersion = "v4";
|
|
1985
1987
|
this.supportedUrls = {
|
|
1986
1988
|
"image/*": [/^https?:\/\/.*$/]
|
|
1987
1989
|
};
|
|
@@ -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.8" : "0.0.0-test";
|
|
2740
2749
|
|
|
2741
2750
|
// src/xai-video-model.ts
|
|
2742
2751
|
import {
|
|
@@ -2777,7 +2786,7 @@ var XaiVideoModel = class {
|
|
|
2777
2786
|
constructor(modelId, config) {
|
|
2778
2787
|
this.modelId = modelId;
|
|
2779
2788
|
this.config = config;
|
|
2780
|
-
this.specificationVersion = "
|
|
2789
|
+
this.specificationVersion = "v4";
|
|
2781
2790
|
this.maxVideosPerCall = 1;
|
|
2782
2791
|
}
|
|
2783
2792
|
get provider() {
|
|
@@ -3030,7 +3039,7 @@ function createXai(options = {}) {
|
|
|
3030
3039
|
});
|
|
3031
3040
|
};
|
|
3032
3041
|
const provider = (modelId) => createResponsesLanguageModel(modelId);
|
|
3033
|
-
provider.specificationVersion = "
|
|
3042
|
+
provider.specificationVersion = "v4";
|
|
3034
3043
|
provider.languageModel = createResponsesLanguageModel;
|
|
3035
3044
|
provider.chat = createChatLanguageModel;
|
|
3036
3045
|
provider.responses = createResponsesLanguageModel;
|