@ai-sdk/openai 3.0.47 → 3.0.49
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 +37 -22
- package/dist/index.d.mts +24 -2
- package/dist/index.d.ts +24 -2
- package/dist/index.js +52 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +24 -2
- package/dist/internal/index.d.ts +24 -2
- package/dist/internal/index.js +51 -6
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +51 -6
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +2 -0
- package/package.json +3 -5
- package/src/chat/openai-chat-options.ts +4 -0
- package/src/openai-language-model-capabilities.ts +2 -2
- package/src/responses/convert-to-openai-responses-input.ts +12 -0
- package/src/responses/openai-responses-api.ts +26 -0
- package/src/responses/openai-responses-language-model.ts +19 -0
- package/src/responses/openai-responses-options.ts +8 -0
|
@@ -2,7 +2,7 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
|
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
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-pro' | 'gpt-5.4-pro-2026-03-05' | (string & {});
|
|
5
|
+
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
6
|
declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
7
7
|
logitBias?: Record<number, number> | undefined;
|
|
8
8
|
logprobs?: number | boolean | undefined;
|
|
@@ -188,7 +188,7 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
|
|
|
188
188
|
doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
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-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 & {});
|
|
191
|
+
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 & {});
|
|
192
192
|
|
|
193
193
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
|
|
194
194
|
readonly specificationVersion = "v3";
|
|
@@ -265,6 +265,28 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
265
265
|
} | null | undefined;
|
|
266
266
|
service_tier?: string | null | undefined;
|
|
267
267
|
};
|
|
268
|
+
} | {
|
|
269
|
+
type: "response.failed";
|
|
270
|
+
response: {
|
|
271
|
+
error?: {
|
|
272
|
+
message: string;
|
|
273
|
+
code?: string | null | undefined;
|
|
274
|
+
} | null | undefined;
|
|
275
|
+
incomplete_details?: {
|
|
276
|
+
reason: string;
|
|
277
|
+
} | null | undefined;
|
|
278
|
+
usage?: {
|
|
279
|
+
input_tokens: number;
|
|
280
|
+
output_tokens: number;
|
|
281
|
+
input_tokens_details?: {
|
|
282
|
+
cached_tokens?: number | null | undefined;
|
|
283
|
+
} | null | undefined;
|
|
284
|
+
output_tokens_details?: {
|
|
285
|
+
reasoning_tokens?: number | null | undefined;
|
|
286
|
+
} | null | undefined;
|
|
287
|
+
} | null | undefined;
|
|
288
|
+
service_tier?: string | null | undefined;
|
|
289
|
+
};
|
|
268
290
|
} | {
|
|
269
291
|
type: "response.created";
|
|
270
292
|
response: {
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
|
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
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-pro' | 'gpt-5.4-pro-2026-03-05' | (string & {});
|
|
5
|
+
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
6
|
declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
7
7
|
logitBias?: Record<number, number> | undefined;
|
|
8
8
|
logprobs?: number | boolean | undefined;
|
|
@@ -188,7 +188,7 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
|
|
|
188
188
|
doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
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-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 & {});
|
|
191
|
+
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 & {});
|
|
192
192
|
|
|
193
193
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
|
|
194
194
|
readonly specificationVersion = "v3";
|
|
@@ -265,6 +265,28 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
265
265
|
} | null | undefined;
|
|
266
266
|
service_tier?: string | null | undefined;
|
|
267
267
|
};
|
|
268
|
+
} | {
|
|
269
|
+
type: "response.failed";
|
|
270
|
+
response: {
|
|
271
|
+
error?: {
|
|
272
|
+
message: string;
|
|
273
|
+
code?: string | null | undefined;
|
|
274
|
+
} | null | undefined;
|
|
275
|
+
incomplete_details?: {
|
|
276
|
+
reason: string;
|
|
277
|
+
} | null | undefined;
|
|
278
|
+
usage?: {
|
|
279
|
+
input_tokens: number;
|
|
280
|
+
output_tokens: number;
|
|
281
|
+
input_tokens_details?: {
|
|
282
|
+
cached_tokens?: number | null | undefined;
|
|
283
|
+
} | null | undefined;
|
|
284
|
+
output_tokens_details?: {
|
|
285
|
+
reasoning_tokens?: number | null | undefined;
|
|
286
|
+
} | null | undefined;
|
|
287
|
+
} | null | undefined;
|
|
288
|
+
service_tier?: string | null | undefined;
|
|
289
|
+
};
|
|
268
290
|
} | {
|
|
269
291
|
type: "response.created";
|
|
270
292
|
response: {
|
package/dist/internal/index.js
CHANGED
|
@@ -82,7 +82,7 @@ var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
|
|
|
82
82
|
// src/openai-language-model-capabilities.ts
|
|
83
83
|
function getOpenAILanguageModelCapabilities(modelId) {
|
|
84
84
|
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
85
|
-
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5
|
|
85
|
+
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");
|
|
86
86
|
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
87
87
|
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
|
|
88
88
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
@@ -3076,6 +3076,11 @@ async function convertToOpenAIResponsesInput({
|
|
|
3076
3076
|
filename: (_a2 = item.filename) != null ? _a2 : "data",
|
|
3077
3077
|
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3078
3078
|
};
|
|
3079
|
+
case "file-url":
|
|
3080
|
+
return {
|
|
3081
|
+
type: "input_file",
|
|
3082
|
+
file_url: item.url
|
|
3083
|
+
};
|
|
3079
3084
|
default:
|
|
3080
3085
|
warnings.push({
|
|
3081
3086
|
type: "other",
|
|
@@ -3134,6 +3139,12 @@ async function convertToOpenAIResponsesInput({
|
|
|
3134
3139
|
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3135
3140
|
};
|
|
3136
3141
|
}
|
|
3142
|
+
case "file-url": {
|
|
3143
|
+
return {
|
|
3144
|
+
type: "input_file",
|
|
3145
|
+
file_url: item.url
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3137
3148
|
default: {
|
|
3138
3149
|
warnings.push({
|
|
3139
3150
|
type: "other",
|
|
@@ -3241,6 +3252,23 @@ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3241
3252
|
service_tier: import_v417.z.string().nullish()
|
|
3242
3253
|
})
|
|
3243
3254
|
}),
|
|
3255
|
+
import_v417.z.object({
|
|
3256
|
+
type: import_v417.z.literal("response.failed"),
|
|
3257
|
+
response: import_v417.z.object({
|
|
3258
|
+
error: import_v417.z.object({
|
|
3259
|
+
code: import_v417.z.string().nullish(),
|
|
3260
|
+
message: import_v417.z.string()
|
|
3261
|
+
}).nullish(),
|
|
3262
|
+
incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
|
|
3263
|
+
usage: import_v417.z.object({
|
|
3264
|
+
input_tokens: import_v417.z.number(),
|
|
3265
|
+
input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
|
|
3266
|
+
output_tokens: import_v417.z.number(),
|
|
3267
|
+
output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
|
|
3268
|
+
}).nullish(),
|
|
3269
|
+
service_tier: import_v417.z.string().nullish()
|
|
3270
|
+
})
|
|
3271
|
+
}),
|
|
3244
3272
|
import_v417.z.object({
|
|
3245
3273
|
type: import_v417.z.literal("response.created"),
|
|
3246
3274
|
response: import_v417.z.object({
|
|
@@ -4058,6 +4086,10 @@ var openaiResponsesReasoningModelIds = [
|
|
|
4058
4086
|
"gpt-5.3-codex",
|
|
4059
4087
|
"gpt-5.4",
|
|
4060
4088
|
"gpt-5.4-2026-03-05",
|
|
4089
|
+
"gpt-5.4-mini",
|
|
4090
|
+
"gpt-5.4-mini-2026-03-17",
|
|
4091
|
+
"gpt-5.4-nano",
|
|
4092
|
+
"gpt-5.4-nano-2026-03-17",
|
|
4061
4093
|
"gpt-5.4-pro",
|
|
4062
4094
|
"gpt-5.4-pro-2026-03-05"
|
|
4063
4095
|
];
|
|
@@ -5630,7 +5662,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5630
5662
|
controller.enqueue({ type: "stream-start", warnings });
|
|
5631
5663
|
},
|
|
5632
5664
|
transform(chunk, controller) {
|
|
5633
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J;
|
|
5665
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
|
|
5634
5666
|
if (options.includeRawChunks) {
|
|
5635
5667
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
5636
5668
|
}
|
|
@@ -6355,13 +6387,23 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6355
6387
|
if (typeof value.response.service_tier === "string") {
|
|
6356
6388
|
serviceTier = value.response.service_tier;
|
|
6357
6389
|
}
|
|
6390
|
+
} else if (isResponseFailedChunk(value)) {
|
|
6391
|
+
const incompleteReason = (_y = value.response.incomplete_details) == null ? void 0 : _y.reason;
|
|
6392
|
+
finishReason = {
|
|
6393
|
+
unified: incompleteReason ? mapOpenAIResponseFinishReason({
|
|
6394
|
+
finishReason: incompleteReason,
|
|
6395
|
+
hasFunctionCall
|
|
6396
|
+
}) : "error",
|
|
6397
|
+
raw: incompleteReason != null ? incompleteReason : "error"
|
|
6398
|
+
};
|
|
6399
|
+
usage = (_z = value.response.usage) != null ? _z : void 0;
|
|
6358
6400
|
} else if (isResponseAnnotationAddedChunk(value)) {
|
|
6359
6401
|
ongoingAnnotations.push(value.annotation);
|
|
6360
6402
|
if (value.annotation.type === "url_citation") {
|
|
6361
6403
|
controller.enqueue({
|
|
6362
6404
|
type: "source",
|
|
6363
6405
|
sourceType: "url",
|
|
6364
|
-
id: (
|
|
6406
|
+
id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0, import_provider_utils34.generateId)(),
|
|
6365
6407
|
url: value.annotation.url,
|
|
6366
6408
|
title: value.annotation.title
|
|
6367
6409
|
});
|
|
@@ -6369,7 +6411,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6369
6411
|
controller.enqueue({
|
|
6370
6412
|
type: "source",
|
|
6371
6413
|
sourceType: "document",
|
|
6372
|
-
id: (
|
|
6414
|
+
id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0, import_provider_utils34.generateId)(),
|
|
6373
6415
|
mediaType: "text/plain",
|
|
6374
6416
|
title: value.annotation.filename,
|
|
6375
6417
|
filename: value.annotation.filename,
|
|
@@ -6385,7 +6427,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6385
6427
|
controller.enqueue({
|
|
6386
6428
|
type: "source",
|
|
6387
6429
|
sourceType: "document",
|
|
6388
|
-
id: (
|
|
6430
|
+
id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : (0, import_provider_utils34.generateId)(),
|
|
6389
6431
|
mediaType: "text/plain",
|
|
6390
6432
|
title: value.annotation.filename,
|
|
6391
6433
|
filename: value.annotation.filename,
|
|
@@ -6401,7 +6443,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6401
6443
|
controller.enqueue({
|
|
6402
6444
|
type: "source",
|
|
6403
6445
|
sourceType: "document",
|
|
6404
|
-
id: (
|
|
6446
|
+
id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : (0, import_provider_utils34.generateId)(),
|
|
6405
6447
|
mediaType: "application/octet-stream",
|
|
6406
6448
|
title: value.annotation.file_id,
|
|
6407
6449
|
filename: value.annotation.file_id,
|
|
@@ -6449,6 +6491,9 @@ function isResponseOutputItemDoneChunk(chunk) {
|
|
|
6449
6491
|
function isResponseFinishedChunk(chunk) {
|
|
6450
6492
|
return chunk.type === "response.completed" || chunk.type === "response.incomplete";
|
|
6451
6493
|
}
|
|
6494
|
+
function isResponseFailedChunk(chunk) {
|
|
6495
|
+
return chunk.type === "response.failed";
|
|
6496
|
+
}
|
|
6452
6497
|
function isResponseCreatedChunk(chunk) {
|
|
6453
6498
|
return chunk.type === "response.created";
|
|
6454
6499
|
}
|