@ai-sdk/openai 3.0.110 → 3.0.112
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 +16 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +10 -3
- package/dist/internal/index.d.ts +10 -3
- package/dist/internal/index.js +16 -0
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +16 -0
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +21 -12
- package/package.json +3 -3
- package/src/chat/openai-chat-language-model.ts +7 -0
- package/src/image/openai-image-model-options.ts +8 -0
- package/src/openai-config.ts +5 -0
- package/src/responses/convert-to-openai-responses-input.ts +6 -0
- package/src/responses/openai-responses-api.ts +3 -0
- package/src/responses/openai-responses-language-model.ts +1 -0
- package/src/tool/image-generation.ts +4 -2
package/dist/index.mjs
CHANGED
|
@@ -1136,6 +1136,12 @@ var OpenAIChatLanguageModel = class {
|
|
|
1136
1136
|
fetch: this.config.fetch
|
|
1137
1137
|
});
|
|
1138
1138
|
const choice = response.choices[0];
|
|
1139
|
+
if (choice == null) {
|
|
1140
|
+
throw new InvalidResponseDataError({
|
|
1141
|
+
data: rawResponse,
|
|
1142
|
+
message: "Response did not contain any choices."
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1139
1145
|
const content = [];
|
|
1140
1146
|
const text = choice.message.content;
|
|
1141
1147
|
if (text != null && text.length > 0) {
|
|
@@ -2091,6 +2097,10 @@ var modelMaxImagesPerCall = {
|
|
|
2091
2097
|
"gpt-image-1-mini": 10,
|
|
2092
2098
|
"gpt-image-1.5": 10,
|
|
2093
2099
|
"gpt-image-2": 10,
|
|
2100
|
+
"gpt-image-2.5-flare": 10,
|
|
2101
|
+
"gpt-image-2.5-flare-2026-09-08": 10,
|
|
2102
|
+
"gpt-image-2.5-sunburst": 10,
|
|
2103
|
+
"gpt-image-2.5-sunburst-2026-09-08": 10,
|
|
2094
2104
|
"chatgpt-image-latest": 10
|
|
2095
2105
|
};
|
|
2096
2106
|
var defaultResponseFormatPrefixes = ["chatgpt-image-", "gpt-image-"];
|
|
@@ -3387,6 +3397,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3387
3397
|
toolNameMapping,
|
|
3388
3398
|
systemMessageMode,
|
|
3389
3399
|
providerOptionsName,
|
|
3400
|
+
explicitMessageItemType = false,
|
|
3390
3401
|
fileIdPrefixes,
|
|
3391
3402
|
passThroughUnsupportedFiles = false,
|
|
3392
3403
|
store,
|
|
@@ -3418,6 +3429,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3418
3429
|
providerOptionsName
|
|
3419
3430
|
);
|
|
3420
3431
|
input.push({
|
|
3432
|
+
...explicitMessageItemType && { type: "message" },
|
|
3421
3433
|
role: "system",
|
|
3422
3434
|
content: promptCacheBreakpoint == null ? content : [
|
|
3423
3435
|
{
|
|
@@ -3435,6 +3447,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3435
3447
|
providerOptionsName
|
|
3436
3448
|
);
|
|
3437
3449
|
input.push({
|
|
3450
|
+
...explicitMessageItemType && { type: "message" },
|
|
3438
3451
|
role: "developer",
|
|
3439
3452
|
content: promptCacheBreakpoint == null ? content : [
|
|
3440
3453
|
{
|
|
@@ -3464,6 +3477,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3464
3477
|
}
|
|
3465
3478
|
case "user": {
|
|
3466
3479
|
input.push({
|
|
3480
|
+
...explicitMessageItemType && { type: "message" },
|
|
3467
3481
|
role: "user",
|
|
3468
3482
|
content: content.map((part, index) => {
|
|
3469
3483
|
var _a3, _b2, _c2;
|
|
@@ -3545,6 +3559,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3545
3559
|
break;
|
|
3546
3560
|
}
|
|
3547
3561
|
input.push({
|
|
3562
|
+
...explicitMessageItemType && { type: "message" },
|
|
3548
3563
|
role: "assistant",
|
|
3549
3564
|
content: [{ type: "output_text", text: part.text }],
|
|
3550
3565
|
id,
|
|
@@ -5987,6 +6002,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5987
6002
|
toolNameMapping,
|
|
5988
6003
|
systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
|
|
5989
6004
|
providerOptionsName,
|
|
6005
|
+
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
5990
6006
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
5991
6007
|
passThroughUnsupportedFiles: (_d = openaiOptions == null ? void 0 : openaiOptions.passThroughUnsupportedFiles) != null ? _d : false,
|
|
5992
6008
|
store: (_e = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _e : true,
|
|
@@ -8216,7 +8232,7 @@ var OpenAITranscriptionModel = class {
|
|
|
8216
8232
|
};
|
|
8217
8233
|
|
|
8218
8234
|
// src/version.ts
|
|
8219
|
-
var VERSION = true ? "3.0.
|
|
8235
|
+
var VERSION = true ? "3.0.112" : "0.0.0-test";
|
|
8220
8236
|
|
|
8221
8237
|
// src/openai-provider.ts
|
|
8222
8238
|
function createOpenAI(options = {}) {
|