@ai-sdk/xai 3.0.84 → 3.0.85
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 +18 -0
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/convert-to-xai-chat-messages.ts +3 -3
- package/src/convert-xai-chat-usage.ts +2 -2
- package/src/map-xai-finish-reason.ts +1 -1
- package/src/responses/convert-to-xai-responses-input.ts +14 -4
- package/src/responses/convert-xai-responses-usage.ts +2 -2
- package/src/responses/map-xai-responses-finish-reason.ts +1 -1
- package/src/responses/xai-responses-api.ts +2 -1
- package/src/responses/xai-responses-language-model.ts +11 -6
- package/src/responses/xai-responses-prepare-tools.ts +3 -3
- package/src/xai-chat-language-model.ts +12 -12
- package/src/xai-image-model.ts +3 -3
- package/src/xai-prepare-tools.ts +3 -3
- package/src/xai-provider.ts +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1080,9 +1080,14 @@ async function convertToXaiResponsesInput({
|
|
|
1080
1080
|
const mediaType = block.mediaType === "image/*" ? "image/jpeg" : block.mediaType;
|
|
1081
1081
|
const imageUrl = block.data instanceof URL ? block.data.toString() : `data:${mediaType};base64,${convertToBase642(block.data)}`;
|
|
1082
1082
|
contentParts.push({ type: "input_image", image_url: imageUrl });
|
|
1083
|
+
} else if (block.data instanceof URL) {
|
|
1084
|
+
contentParts.push({
|
|
1085
|
+
type: "input_file",
|
|
1086
|
+
file_url: block.data.toString()
|
|
1087
|
+
});
|
|
1083
1088
|
} else {
|
|
1084
1089
|
throw new UnsupportedFunctionalityError3({
|
|
1085
|
-
functionality: `file part media type ${block.mediaType}`
|
|
1090
|
+
functionality: `file part media type ${block.mediaType} as inline data (xAI Responses requires a URL or a Files API reference for non-image files)`
|
|
1086
1091
|
});
|
|
1087
1092
|
}
|
|
1088
1093
|
break;
|
|
@@ -2037,7 +2042,12 @@ var XaiResponsesLanguageModel = class {
|
|
|
2037
2042
|
constructor(modelId, config) {
|
|
2038
2043
|
this.specificationVersion = "v3";
|
|
2039
2044
|
this.supportedUrls = {
|
|
2040
|
-
"image/*": [/^https?:\/\/.*$/]
|
|
2045
|
+
"image/*": [/^https?:\/\/.*$/],
|
|
2046
|
+
// xAI's Responses API accepts non-image documents (PDF, plain text, CSV, etc.) as
|
|
2047
|
+
// `{ type: 'input_file', file_url }`. Keeping these URLs intact here lets them pass
|
|
2048
|
+
// through to the converter instead of being downloaded to bytes by the SDK.
|
|
2049
|
+
"application/pdf": [/^https?:\/\/.*$/],
|
|
2050
|
+
"text/*": [/^https?:\/\/.*$/]
|
|
2041
2051
|
};
|
|
2042
2052
|
this.modelId = modelId;
|
|
2043
2053
|
this.config = config;
|
|
@@ -2811,7 +2821,7 @@ var xaiTools = {
|
|
|
2811
2821
|
};
|
|
2812
2822
|
|
|
2813
2823
|
// src/version.ts
|
|
2814
|
-
var VERSION = true ? "3.0.
|
|
2824
|
+
var VERSION = true ? "3.0.85" : "0.0.0-test";
|
|
2815
2825
|
|
|
2816
2826
|
// src/xai-video-model.ts
|
|
2817
2827
|
import {
|