@ai-sdk/xai 2.0.81 → 2.0.82

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 2.0.82
4
+
5
+ ### Patch Changes
6
+
7
+ - 64a6152: fix(provider/xai): preserve images in Responses API tool results
8
+
3
9
  ## 2.0.81
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1410,12 +1410,27 @@ async function convertToXaiResponsesInput({
1410
1410
  outputValue = JSON.stringify(output.value);
1411
1411
  break;
1412
1412
  case "content":
1413
- outputValue = output.value.map((item) => {
1414
- if (item.type === "text") {
1415
- return item.text;
1413
+ outputValue = [];
1414
+ for (const item of output.value) {
1415
+ switch (item.type) {
1416
+ case "text": {
1417
+ outputValue.push({
1418
+ type: "input_text",
1419
+ text: item.text
1420
+ });
1421
+ break;
1422
+ }
1423
+ case "media": {
1424
+ if (item.mediaType.startsWith("image/")) {
1425
+ outputValue.push({
1426
+ type: "input_image",
1427
+ image_url: `data:${item.mediaType};base64,${item.data}`
1428
+ });
1429
+ }
1430
+ break;
1431
+ }
1416
1432
  }
1417
- return "";
1418
- }).join("");
1433
+ }
1419
1434
  break;
1420
1435
  default: {
1421
1436
  const _exhaustiveCheck = output;
@@ -2368,7 +2383,7 @@ var xaiTools = {
2368
2383
  };
2369
2384
 
2370
2385
  // src/version.ts
2371
- var VERSION = true ? "2.0.81" : "0.0.0-test";
2386
+ var VERSION = true ? "2.0.82" : "0.0.0-test";
2372
2387
 
2373
2388
  // src/xai-provider.ts
2374
2389
  var xaiErrorStructure = {