@ai-sdk/openai 4.0.69 → 4.0.71
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 +19 -0
- package/dist/index.js +29 -7
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +13 -5
- package/dist/internal/index.js +28 -6
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +2 -2
- package/package.json +2 -2
- package/src/image/openai-image-model.ts +4 -3
- package/src/responses/convert-to-openai-responses-input.ts +27 -2
- package/src/responses/openai-responses-api.ts +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 4.0.71
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e76a0a3: fix(openai): cancel image edit URL downloads when the request is aborted
|
|
8
|
+
- Updated dependencies [2973485]
|
|
9
|
+
- Updated dependencies [a4db5ea]
|
|
10
|
+
- Updated dependencies [2937ea2]
|
|
11
|
+
- @ai-sdk/provider-utils@5.0.45
|
|
12
|
+
|
|
13
|
+
## 4.0.70
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- fd75cee: fix(openai): preserve provider file references in Responses tool results
|
|
18
|
+
- 1f5bb62: fix(openai): send assistant text as Responses easy input messages
|
|
19
|
+
- Updated dependencies [0455398]
|
|
20
|
+
- @ai-sdk/provider-utils@5.0.44
|
|
21
|
+
|
|
3
22
|
## 4.0.69
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -2680,10 +2680,10 @@ var OpenAIImageModel = class _OpenAIImageModel {
|
|
|
2680
2680
|
})
|
|
2681
2681
|
],
|
|
2682
2682
|
{ type: file.mediaType }
|
|
2683
|
-
) : downloadBlob(file.url)
|
|
2683
|
+
) : downloadBlob(file.url, { abortSignal })
|
|
2684
2684
|
)
|
|
2685
2685
|
),
|
|
2686
|
-
mask: mask != null ? await fileToBlob(mask) : void 0,
|
|
2686
|
+
mask: mask != null ? await fileToBlob(mask, abortSignal) : void 0,
|
|
2687
2687
|
n,
|
|
2688
2688
|
size,
|
|
2689
2689
|
quality: openaiOptions2.quality,
|
|
@@ -2820,10 +2820,10 @@ function distributeTokenDetails(details, index, total) {
|
|
|
2820
2820
|
}
|
|
2821
2821
|
return result;
|
|
2822
2822
|
}
|
|
2823
|
-
async function fileToBlob(file) {
|
|
2823
|
+
async function fileToBlob(file, abortSignal) {
|
|
2824
2824
|
if (!file) return void 0;
|
|
2825
2825
|
if (file.type === "url") {
|
|
2826
|
-
return downloadBlob(file.url);
|
|
2826
|
+
return downloadBlob(file.url, { abortSignal });
|
|
2827
2827
|
}
|
|
2828
2828
|
const data = file.data instanceof Uint8Array ? file.data : convertBase64ToUint8Array(file.data);
|
|
2829
2829
|
return new Blob([data], { type: file.mediaType });
|
|
@@ -4995,6 +4995,29 @@ async function convertFunctionToolResultOutput({
|
|
|
4995
4995
|
case "file": {
|
|
4996
4996
|
const topLevel = getTopLevelMediaType2(item.mediaType);
|
|
4997
4997
|
const imageDetail = (_b = (_a3 = item.providerOptions) == null ? void 0 : _a3[providerOptionsName]) == null ? void 0 : _b.imageDetail;
|
|
4998
|
+
if (item.data.type === "reference") {
|
|
4999
|
+
const fileId = resolveProviderReference2({
|
|
5000
|
+
reference: item.data.reference,
|
|
5001
|
+
provider: providerOptionsName
|
|
5002
|
+
});
|
|
5003
|
+
if (topLevel === "image") {
|
|
5004
|
+
return {
|
|
5005
|
+
type: "input_image",
|
|
5006
|
+
file_id: fileId,
|
|
5007
|
+
detail: imageDetail,
|
|
5008
|
+
...promptCacheBreakpoint2 != null && {
|
|
5009
|
+
prompt_cache_breakpoint: promptCacheBreakpoint2
|
|
5010
|
+
}
|
|
5011
|
+
};
|
|
5012
|
+
}
|
|
5013
|
+
return {
|
|
5014
|
+
type: "input_file",
|
|
5015
|
+
file_id: fileId,
|
|
5016
|
+
...promptCacheBreakpoint2 != null && {
|
|
5017
|
+
prompt_cache_breakpoint: promptCacheBreakpoint2
|
|
5018
|
+
}
|
|
5019
|
+
};
|
|
5020
|
+
}
|
|
4998
5021
|
if (item.data.type === "data") {
|
|
4999
5022
|
const fullMediaType = resolveFullMediaType2({ part: item });
|
|
5000
5023
|
if (topLevel === "image") {
|
|
@@ -5335,8 +5358,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
5335
5358
|
input.push({
|
|
5336
5359
|
...explicitMessageItemType && { type: "message" },
|
|
5337
5360
|
role: "assistant",
|
|
5338
|
-
content:
|
|
5339
|
-
id,
|
|
5361
|
+
content: part.text,
|
|
5340
5362
|
...phase != null && { phase }
|
|
5341
5363
|
});
|
|
5342
5364
|
break;
|
|
@@ -11945,7 +11967,7 @@ var OpenAISkills = class {
|
|
|
11945
11967
|
};
|
|
11946
11968
|
|
|
11947
11969
|
// src/version.ts
|
|
11948
|
-
var VERSION = true ? "4.0.
|
|
11970
|
+
var VERSION = true ? "4.0.71" : "0.0.0-test";
|
|
11949
11971
|
|
|
11950
11972
|
// src/openai-provider.ts
|
|
11951
11973
|
function createOpenAI(options = {}) {
|