@ai-sdk/xai 3.0.84 → 3.0.86

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/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.84" : "0.0.0-test";
2824
+ var VERSION = true ? "3.0.86" : "0.0.0-test";
2815
2825
 
2816
2826
  // src/xai-video-model.ts
2817
2827
  import {