@ai-sdk/openai 3.0.30 → 3.0.32
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 +12 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +4 -4
- package/dist/internal/index.d.ts +4 -4
- package/dist/internal/index.js +14 -6
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -6
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +91 -38
- package/package.json +3 -3
- package/src/responses/openai-responses-api.ts +53 -46
- package/src/responses/openai-responses-language-model.ts +5 -1
- package/src/responses/openai-responses-options.ts +4 -0
- package/src/tool/web-search-preview.ts +18 -16
- package/src/tool/web-search.ts +18 -16
|
@@ -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 = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-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-4' | '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-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | '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' | (string & {});
|
|
191
|
+
type OpenAIResponsesModelId = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-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-4' | '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-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-codex' | 'gpt-5.3-codex' | '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' | (string & {});
|
|
192
192
|
|
|
193
193
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
|
|
194
194
|
readonly specificationVersion = "v3";
|
|
@@ -405,7 +405,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
405
405
|
type: "web_search_call";
|
|
406
406
|
id: string;
|
|
407
407
|
status: string;
|
|
408
|
-
action
|
|
408
|
+
action?: {
|
|
409
409
|
type: "search";
|
|
410
410
|
query?: string | null | undefined;
|
|
411
411
|
sources?: ({
|
|
@@ -422,7 +422,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
422
422
|
type: "find_in_page";
|
|
423
423
|
url?: string | null | undefined;
|
|
424
424
|
pattern?: string | null | undefined;
|
|
425
|
-
};
|
|
425
|
+
} | null | undefined;
|
|
426
426
|
} | {
|
|
427
427
|
type: "file_search_call";
|
|
428
428
|
id: string;
|
|
@@ -1046,7 +1046,7 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOu
|
|
|
1046
1046
|
* An object describing the specific action taken in this web search call.
|
|
1047
1047
|
* Includes details on how the model used the web (search, open_page, find_in_page).
|
|
1048
1048
|
*/
|
|
1049
|
-
action
|
|
1049
|
+
action?: {
|
|
1050
1050
|
/**
|
|
1051
1051
|
* Action type "search" - Performs a web search query.
|
|
1052
1052
|
*/
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -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 = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-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-4' | '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-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | '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' | (string & {});
|
|
191
|
+
type OpenAIResponsesModelId = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-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-4' | '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-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-codex' | 'gpt-5.3-codex' | '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' | (string & {});
|
|
192
192
|
|
|
193
193
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
|
|
194
194
|
readonly specificationVersion = "v3";
|
|
@@ -405,7 +405,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
405
405
|
type: "web_search_call";
|
|
406
406
|
id: string;
|
|
407
407
|
status: string;
|
|
408
|
-
action
|
|
408
|
+
action?: {
|
|
409
409
|
type: "search";
|
|
410
410
|
query?: string | null | undefined;
|
|
411
411
|
sources?: ({
|
|
@@ -422,7 +422,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
422
422
|
type: "find_in_page";
|
|
423
423
|
url?: string | null | undefined;
|
|
424
424
|
pattern?: string | null | undefined;
|
|
425
|
-
};
|
|
425
|
+
} | null | undefined;
|
|
426
426
|
} | {
|
|
427
427
|
type: "file_search_call";
|
|
428
428
|
id: string;
|
|
@@ -1046,7 +1046,7 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOu
|
|
|
1046
1046
|
* An object describing the specific action taken in this web search call.
|
|
1047
1047
|
* Includes details on how the model used the web (search, open_page, find_in_page).
|
|
1048
1048
|
*/
|
|
1049
|
-
action
|
|
1049
|
+
action?: {
|
|
1050
1050
|
/**
|
|
1051
1051
|
* Action type "search" - Performs a web search query.
|
|
1052
1052
|
*/
|
package/dist/internal/index.js
CHANGED
|
@@ -3231,7 +3231,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
3231
3231
|
url: import_v416.z.string().nullish(),
|
|
3232
3232
|
pattern: import_v416.z.string().nullish()
|
|
3233
3233
|
})
|
|
3234
|
-
])
|
|
3234
|
+
]).nullish()
|
|
3235
3235
|
}),
|
|
3236
3236
|
import_v416.z.object({
|
|
3237
3237
|
type: import_v416.z.literal("file_search_call"),
|
|
@@ -3547,7 +3547,10 @@ var openaiResponsesResponseSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
3547
3547
|
sources: import_v416.z.array(
|
|
3548
3548
|
import_v416.z.discriminatedUnion("type", [
|
|
3549
3549
|
import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
|
|
3550
|
-
import_v416.z.object({
|
|
3550
|
+
import_v416.z.object({
|
|
3551
|
+
type: import_v416.z.literal("api"),
|
|
3552
|
+
name: import_v416.z.string()
|
|
3553
|
+
})
|
|
3551
3554
|
])
|
|
3552
3555
|
).nullish()
|
|
3553
3556
|
}),
|
|
@@ -3560,7 +3563,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
3560
3563
|
url: import_v416.z.string().nullish(),
|
|
3561
3564
|
pattern: import_v416.z.string().nullish()
|
|
3562
3565
|
})
|
|
3563
|
-
])
|
|
3566
|
+
]).nullish()
|
|
3564
3567
|
}),
|
|
3565
3568
|
import_v416.z.object({
|
|
3566
3569
|
type: import_v416.z.literal("file_search_call"),
|
|
@@ -3778,7 +3781,9 @@ var openaiResponsesReasoningModelIds = [
|
|
|
3778
3781
|
"gpt-5.1-codex-max",
|
|
3779
3782
|
"gpt-5.2",
|
|
3780
3783
|
"gpt-5.2-chat-latest",
|
|
3781
|
-
"gpt-5.2-pro"
|
|
3784
|
+
"gpt-5.2-pro",
|
|
3785
|
+
"gpt-5.2-codex",
|
|
3786
|
+
"gpt-5.3-codex"
|
|
3782
3787
|
];
|
|
3783
3788
|
var openaiResponsesModelIds = [
|
|
3784
3789
|
"gpt-4.1",
|
|
@@ -4202,7 +4207,7 @@ var webSearchOutputSchema = (0, import_provider_utils29.lazySchema)(
|
|
|
4202
4207
|
url: import_v422.z.string().nullish(),
|
|
4203
4208
|
pattern: import_v422.z.string().nullish()
|
|
4204
4209
|
})
|
|
4205
|
-
]),
|
|
4210
|
+
]).optional(),
|
|
4206
4211
|
sources: import_v422.z.array(
|
|
4207
4212
|
import_v422.z.discriminatedUnion("type", [
|
|
4208
4213
|
import_v422.z.object({ type: import_v422.z.literal("url"), url: import_v422.z.string() }),
|
|
@@ -4255,7 +4260,7 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils30.lazySchema)(
|
|
|
4255
4260
|
url: import_v423.z.string().nullish(),
|
|
4256
4261
|
pattern: import_v423.z.string().nullish()
|
|
4257
4262
|
})
|
|
4258
|
-
])
|
|
4263
|
+
]).optional()
|
|
4259
4264
|
})
|
|
4260
4265
|
)
|
|
4261
4266
|
);
|
|
@@ -5963,6 +5968,9 @@ function isErrorChunk(chunk) {
|
|
|
5963
5968
|
}
|
|
5964
5969
|
function mapWebSearchOutput(action) {
|
|
5965
5970
|
var _a;
|
|
5971
|
+
if (action == null) {
|
|
5972
|
+
return {};
|
|
5973
|
+
}
|
|
5966
5974
|
switch (action.type) {
|
|
5967
5975
|
case "search":
|
|
5968
5976
|
return {
|