@ai-sdk/openai 4.0.0-canary.46 → 4.0.0-canary.48
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 +15 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +64 -38
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +2 -2
- package/dist/internal/index.js +63 -37
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +1 -0
- package/package.json +3 -3
- package/src/chat/openai-chat-language-model-options.ts +2 -0
- package/src/openai-language-model-capabilities.ts +3 -2
- package/src/responses/convert-to-openai-responses-input.ts +64 -35
- package/src/responses/openai-responses-language-model-options.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 4.0.0-canary.48
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d6c79e3: feat(openai): add GPT-5.5 chat model IDs
|
|
8
|
+
|
|
9
|
+
## 4.0.0-canary.47
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 5463d0d: feat(provider): align tool result output content file part types with top-level message file part types
|
|
14
|
+
- Updated dependencies [5463d0d]
|
|
15
|
+
- @ai-sdk/provider-utils@5.0.0-canary.32
|
|
16
|
+
- @ai-sdk/provider@4.0.0-canary.16
|
|
17
|
+
|
|
3
18
|
## 4.0.0-canary.46
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { JSONValue, ProviderV4, LanguageModelV4, EmbeddingModelV4, ImageModelV4,
|
|
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
4
|
import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
|
|
5
5
|
|
|
6
|
-
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | (string & {});
|
|
6
|
+
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | (string & {});
|
|
7
7
|
declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
8
8
|
logitBias?: Record<number, number> | undefined;
|
|
9
9
|
logprobs?: number | boolean | undefined;
|
|
@@ -1040,7 +1040,7 @@ declare const openaiTools: {
|
|
|
1040
1040
|
}, {}>;
|
|
1041
1041
|
};
|
|
1042
1042
|
|
|
1043
|
-
type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
1043
|
+
type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
1044
1044
|
declare const openaiLanguageModelResponsesOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
1045
1045
|
conversation?: string | null | undefined;
|
|
1046
1046
|
include?: ("file_search_call.results" | "message.output_text.logprobs" | "reasoning.encrypted_content")[] | null | undefined;
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
45
45
|
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
46
46
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") && !modelId.startsWith("gpt-5.4-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
47
47
|
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
48
|
-
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
|
|
48
|
+
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4") || modelId.startsWith("gpt-5.5");
|
|
49
49
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
50
50
|
return {
|
|
51
51
|
supportsFlexProcessing,
|
|
@@ -3471,29 +3471,42 @@ async function convertToOpenAIResponsesInput({
|
|
|
3471
3471
|
switch (item.type) {
|
|
3472
3472
|
case "text":
|
|
3473
3473
|
return { type: "input_text", text: item.text };
|
|
3474
|
-
case "file
|
|
3475
|
-
|
|
3474
|
+
case "file": {
|
|
3475
|
+
const topLevel = getTopLevelMediaType2(item.mediaType);
|
|
3476
|
+
if (item.data.type === "data") {
|
|
3477
|
+
const fullMediaType = resolveFullMediaType2({
|
|
3478
|
+
part: item
|
|
3479
|
+
});
|
|
3480
|
+
if (topLevel === "image") {
|
|
3481
|
+
return {
|
|
3482
|
+
type: "input_image",
|
|
3483
|
+
image_url: `data:${fullMediaType};base64,${convertToBase642(item.data.data)}`
|
|
3484
|
+
};
|
|
3485
|
+
}
|
|
3476
3486
|
return {
|
|
3477
|
-
type: "
|
|
3478
|
-
|
|
3487
|
+
type: "input_file",
|
|
3488
|
+
filename: (_a2 = item.filename) != null ? _a2 : "data",
|
|
3489
|
+
file_data: `data:${fullMediaType};base64,${convertToBase642(item.data.data)}`
|
|
3479
3490
|
};
|
|
3480
3491
|
}
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3492
|
+
if (item.data.type === "url") {
|
|
3493
|
+
if (topLevel === "image") {
|
|
3494
|
+
return {
|
|
3495
|
+
type: "input_image",
|
|
3496
|
+
image_url: item.data.url.toString()
|
|
3497
|
+
};
|
|
3498
|
+
}
|
|
3488
3499
|
return {
|
|
3489
|
-
type: "
|
|
3490
|
-
|
|
3500
|
+
type: "input_file",
|
|
3501
|
+
file_url: item.data.url.toString()
|
|
3491
3502
|
};
|
|
3492
3503
|
}
|
|
3493
|
-
|
|
3494
|
-
type: "
|
|
3495
|
-
|
|
3496
|
-
};
|
|
3504
|
+
warnings.push({
|
|
3505
|
+
type: "other",
|
|
3506
|
+
message: `unsupported custom tool content part type: ${item.type} with data type: ${item.data.type}`
|
|
3507
|
+
});
|
|
3508
|
+
return void 0;
|
|
3509
|
+
}
|
|
3497
3510
|
default:
|
|
3498
3511
|
warnings.push({
|
|
3499
3512
|
type: "other",
|
|
@@ -3533,30 +3546,41 @@ async function convertToOpenAIResponsesInput({
|
|
|
3533
3546
|
case "text": {
|
|
3534
3547
|
return { type: "input_text", text: item.text };
|
|
3535
3548
|
}
|
|
3536
|
-
case "file
|
|
3537
|
-
|
|
3549
|
+
case "file": {
|
|
3550
|
+
const topLevel = getTopLevelMediaType2(item.mediaType);
|
|
3551
|
+
if (item.data.type === "data") {
|
|
3552
|
+
const fullMediaType = resolveFullMediaType2({
|
|
3553
|
+
part: item
|
|
3554
|
+
});
|
|
3555
|
+
if (topLevel === "image") {
|
|
3556
|
+
return {
|
|
3557
|
+
type: "input_image",
|
|
3558
|
+
image_url: `data:${fullMediaType};base64,${convertToBase642(item.data.data)}`
|
|
3559
|
+
};
|
|
3560
|
+
}
|
|
3538
3561
|
return {
|
|
3539
|
-
type: "
|
|
3540
|
-
|
|
3562
|
+
type: "input_file",
|
|
3563
|
+
filename: (_a2 = item.filename) != null ? _a2 : "data",
|
|
3564
|
+
file_data: `data:${fullMediaType};base64,${convertToBase642(item.data.data)}`
|
|
3541
3565
|
};
|
|
3542
3566
|
}
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
if (item.mediaType.startsWith("image/")) {
|
|
3567
|
+
if (item.data.type === "url") {
|
|
3568
|
+
if (topLevel === "image") {
|
|
3569
|
+
return {
|
|
3570
|
+
type: "input_image",
|
|
3571
|
+
image_url: item.data.url.toString()
|
|
3572
|
+
};
|
|
3573
|
+
}
|
|
3551
3574
|
return {
|
|
3552
|
-
type: "
|
|
3553
|
-
|
|
3575
|
+
type: "input_file",
|
|
3576
|
+
file_url: item.data.url.toString()
|
|
3554
3577
|
};
|
|
3555
3578
|
}
|
|
3556
|
-
|
|
3557
|
-
type: "
|
|
3558
|
-
|
|
3559
|
-
};
|
|
3579
|
+
warnings.push({
|
|
3580
|
+
type: "other",
|
|
3581
|
+
message: `unsupported tool content part type: ${item.type} with data type: ${item.data.type}`
|
|
3582
|
+
});
|
|
3583
|
+
return void 0;
|
|
3560
3584
|
}
|
|
3561
3585
|
default: {
|
|
3562
3586
|
warnings.push({
|
|
@@ -4528,7 +4552,9 @@ var openaiResponsesReasoningModelIds = [
|
|
|
4528
4552
|
"gpt-5.4-nano",
|
|
4529
4553
|
"gpt-5.4-nano-2026-03-17",
|
|
4530
4554
|
"gpt-5.4-pro",
|
|
4531
|
-
"gpt-5.4-pro-2026-03-05"
|
|
4555
|
+
"gpt-5.4-pro-2026-03-05",
|
|
4556
|
+
"gpt-5.5",
|
|
4557
|
+
"gpt-5.5-2026-04-23"
|
|
4532
4558
|
];
|
|
4533
4559
|
var openaiResponsesModelIds = [
|
|
4534
4560
|
"gpt-4.1",
|
|
@@ -7227,7 +7253,7 @@ var OpenAISkills = class {
|
|
|
7227
7253
|
};
|
|
7228
7254
|
|
|
7229
7255
|
// src/version.ts
|
|
7230
|
-
var VERSION = true ? "4.0.0-canary.
|
|
7256
|
+
var VERSION = true ? "4.0.0-canary.48" : "0.0.0-test";
|
|
7231
7257
|
|
|
7232
7258
|
// src/openai-provider.ts
|
|
7233
7259
|
function createOpenAI(options = {}) {
|