@ai-sdk/openai 2.0.46 → 2.0.47

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/openai
2
2
 
3
+ ## 2.0.47
4
+
5
+ ### Patch Changes
6
+
7
+ - 99e2a2a: feat(provider/openai): support file and image tool results
8
+
3
9
  ## 2.0.46
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2340,11 +2340,29 @@ async function convertToOpenAIResponsesInput({
2340
2340
  case "error-text":
2341
2341
  contentValue = output.value;
2342
2342
  break;
2343
- case "content":
2344
2343
  case "json":
2345
2344
  case "error-json":
2346
2345
  contentValue = JSON.stringify(output.value);
2347
2346
  break;
2347
+ case "content":
2348
+ contentValue = output.value.map((item) => {
2349
+ switch (item.type) {
2350
+ case "text": {
2351
+ return { type: "input_text", text: item.text };
2352
+ }
2353
+ case "media": {
2354
+ return item.mediaType.startsWith("image/") ? {
2355
+ type: "input_image",
2356
+ image_url: `data:${item.mediaType};base64,${item.data}`
2357
+ } : {
2358
+ type: "input_file",
2359
+ filename: "data",
2360
+ file_data: `data:${item.mediaType};base64,${item.data}`
2361
+ };
2362
+ }
2363
+ }
2364
+ });
2365
+ break;
2348
2366
  }
2349
2367
  input.push({
2350
2368
  type: "function_call_output",
@@ -4397,7 +4415,7 @@ var OpenAITranscriptionModel = class {
4397
4415
  };
4398
4416
 
4399
4417
  // src/version.ts
4400
- var VERSION = true ? "2.0.46" : "0.0.0-test";
4418
+ var VERSION = true ? "2.0.47" : "0.0.0-test";
4401
4419
 
4402
4420
  // src/openai-provider.ts
4403
4421
  function createOpenAI(options = {}) {