@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 3.0.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0c9395b: feat(provider/openai): add `gpt-5.3-codex`
|
|
8
|
+
|
|
9
|
+
## 3.0.31
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- d5f7312: fix(openai): change web search tool action to be optional
|
|
14
|
+
|
|
3
15
|
## 3.0.30
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -49,7 +49,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
49
49
|
* An object describing the specific action taken in this web search call.
|
|
50
50
|
* Includes details on how the model used the web (search, open_page, find_in_page).
|
|
51
51
|
*/
|
|
52
|
-
action
|
|
52
|
+
action?: {
|
|
53
53
|
/**
|
|
54
54
|
* Action type "search" - Performs a web search query.
|
|
55
55
|
*/
|
|
@@ -346,7 +346,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
346
346
|
type: "web_search_call";
|
|
347
347
|
id: string;
|
|
348
348
|
status: string;
|
|
349
|
-
action
|
|
349
|
+
action?: {
|
|
350
350
|
type: "search";
|
|
351
351
|
query?: string | null | undefined;
|
|
352
352
|
sources?: ({
|
|
@@ -363,7 +363,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
363
363
|
type: "find_in_page";
|
|
364
364
|
url?: string | null | undefined;
|
|
365
365
|
pattern?: string | null | undefined;
|
|
366
|
-
};
|
|
366
|
+
} | null | undefined;
|
|
367
367
|
} | {
|
|
368
368
|
type: "file_search_call";
|
|
369
369
|
id: string;
|
|
@@ -780,7 +780,7 @@ declare const openaiTools: {
|
|
|
780
780
|
* @param userLocation - The user location to use for the web search.
|
|
781
781
|
*/
|
|
782
782
|
webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
783
|
-
action
|
|
783
|
+
action?: {
|
|
784
784
|
type: "search";
|
|
785
785
|
query?: string;
|
|
786
786
|
} | {
|
|
@@ -810,7 +810,7 @@ declare const openaiTools: {
|
|
|
810
810
|
* @param userLocation - The user location to use for the web search.
|
|
811
811
|
*/
|
|
812
812
|
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
813
|
-
action
|
|
813
|
+
action?: {
|
|
814
814
|
type: "search";
|
|
815
815
|
query?: string;
|
|
816
816
|
} | {
|
|
@@ -868,7 +868,7 @@ declare const openaiTools: {
|
|
|
868
868
|
}>;
|
|
869
869
|
};
|
|
870
870
|
|
|
871
|
-
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 & {});
|
|
871
|
+
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 & {});
|
|
872
872
|
declare const openaiLanguageModelResponsesOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
873
873
|
conversation?: string | null | undefined;
|
|
874
874
|
include?: ("file_search_call.results" | "message.output_text.logprobs" | "reasoning.encrypted_content")[] | null | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
49
49
|
* An object describing the specific action taken in this web search call.
|
|
50
50
|
* Includes details on how the model used the web (search, open_page, find_in_page).
|
|
51
51
|
*/
|
|
52
|
-
action
|
|
52
|
+
action?: {
|
|
53
53
|
/**
|
|
54
54
|
* Action type "search" - Performs a web search query.
|
|
55
55
|
*/
|
|
@@ -346,7 +346,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
346
346
|
type: "web_search_call";
|
|
347
347
|
id: string;
|
|
348
348
|
status: string;
|
|
349
|
-
action
|
|
349
|
+
action?: {
|
|
350
350
|
type: "search";
|
|
351
351
|
query?: string | null | undefined;
|
|
352
352
|
sources?: ({
|
|
@@ -363,7 +363,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
363
363
|
type: "find_in_page";
|
|
364
364
|
url?: string | null | undefined;
|
|
365
365
|
pattern?: string | null | undefined;
|
|
366
|
-
};
|
|
366
|
+
} | null | undefined;
|
|
367
367
|
} | {
|
|
368
368
|
type: "file_search_call";
|
|
369
369
|
id: string;
|
|
@@ -780,7 +780,7 @@ declare const openaiTools: {
|
|
|
780
780
|
* @param userLocation - The user location to use for the web search.
|
|
781
781
|
*/
|
|
782
782
|
webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
|
|
783
|
-
action
|
|
783
|
+
action?: {
|
|
784
784
|
type: "search";
|
|
785
785
|
query?: string;
|
|
786
786
|
} | {
|
|
@@ -810,7 +810,7 @@ declare const openaiTools: {
|
|
|
810
810
|
* @param userLocation - The user location to use for the web search.
|
|
811
811
|
*/
|
|
812
812
|
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
813
|
-
action
|
|
813
|
+
action?: {
|
|
814
814
|
type: "search";
|
|
815
815
|
query?: string;
|
|
816
816
|
} | {
|
|
@@ -868,7 +868,7 @@ declare const openaiTools: {
|
|
|
868
868
|
}>;
|
|
869
869
|
};
|
|
870
870
|
|
|
871
|
-
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 & {});
|
|
871
|
+
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 & {});
|
|
872
872
|
declare const openaiLanguageModelResponsesOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
873
873
|
conversation?: string | null | undefined;
|
|
874
874
|
include?: ("file_search_call.results" | "message.output_text.logprobs" | "reasoning.encrypted_content")[] | null | undefined;
|
package/dist/index.js
CHANGED
|
@@ -2285,7 +2285,7 @@ var webSearchOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
2285
2285
|
url: import_v415.z.string().nullish(),
|
|
2286
2286
|
pattern: import_v415.z.string().nullish()
|
|
2287
2287
|
})
|
|
2288
|
-
]),
|
|
2288
|
+
]).optional(),
|
|
2289
2289
|
sources: import_v415.z.array(
|
|
2290
2290
|
import_v415.z.discriminatedUnion("type", [
|
|
2291
2291
|
import_v415.z.object({ type: import_v415.z.literal("url"), url: import_v415.z.string() }),
|
|
@@ -2339,7 +2339,7 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2339
2339
|
url: import_v416.z.string().nullish(),
|
|
2340
2340
|
pattern: import_v416.z.string().nullish()
|
|
2341
2341
|
})
|
|
2342
|
-
])
|
|
2342
|
+
]).optional()
|
|
2343
2343
|
})
|
|
2344
2344
|
)
|
|
2345
2345
|
);
|
|
@@ -3240,7 +3240,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3240
3240
|
url: import_v419.z.string().nullish(),
|
|
3241
3241
|
pattern: import_v419.z.string().nullish()
|
|
3242
3242
|
})
|
|
3243
|
-
])
|
|
3243
|
+
]).nullish()
|
|
3244
3244
|
}),
|
|
3245
3245
|
import_v419.z.object({
|
|
3246
3246
|
type: import_v419.z.literal("file_search_call"),
|
|
@@ -3556,7 +3556,10 @@ var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3556
3556
|
sources: import_v419.z.array(
|
|
3557
3557
|
import_v419.z.discriminatedUnion("type", [
|
|
3558
3558
|
import_v419.z.object({ type: import_v419.z.literal("url"), url: import_v419.z.string() }),
|
|
3559
|
-
import_v419.z.object({
|
|
3559
|
+
import_v419.z.object({
|
|
3560
|
+
type: import_v419.z.literal("api"),
|
|
3561
|
+
name: import_v419.z.string()
|
|
3562
|
+
})
|
|
3560
3563
|
])
|
|
3561
3564
|
).nullish()
|
|
3562
3565
|
}),
|
|
@@ -3569,7 +3572,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3569
3572
|
url: import_v419.z.string().nullish(),
|
|
3570
3573
|
pattern: import_v419.z.string().nullish()
|
|
3571
3574
|
})
|
|
3572
|
-
])
|
|
3575
|
+
]).nullish()
|
|
3573
3576
|
}),
|
|
3574
3577
|
import_v419.z.object({
|
|
3575
3578
|
type: import_v419.z.literal("file_search_call"),
|
|
@@ -3787,7 +3790,9 @@ var openaiResponsesReasoningModelIds = [
|
|
|
3787
3790
|
"gpt-5.1-codex-max",
|
|
3788
3791
|
"gpt-5.2",
|
|
3789
3792
|
"gpt-5.2-chat-latest",
|
|
3790
|
-
"gpt-5.2-pro"
|
|
3793
|
+
"gpt-5.2-pro",
|
|
3794
|
+
"gpt-5.2-codex",
|
|
3795
|
+
"gpt-5.3-codex"
|
|
3791
3796
|
];
|
|
3792
3797
|
var openaiResponsesModelIds = [
|
|
3793
3798
|
"gpt-4.1",
|
|
@@ -5680,6 +5685,9 @@ function isErrorChunk(chunk) {
|
|
|
5680
5685
|
}
|
|
5681
5686
|
function mapWebSearchOutput(action) {
|
|
5682
5687
|
var _a;
|
|
5688
|
+
if (action == null) {
|
|
5689
|
+
return {};
|
|
5690
|
+
}
|
|
5683
5691
|
switch (action.type) {
|
|
5684
5692
|
case "search":
|
|
5685
5693
|
return {
|
|
@@ -6056,7 +6064,7 @@ var OpenAITranscriptionModel = class {
|
|
|
6056
6064
|
};
|
|
6057
6065
|
|
|
6058
6066
|
// src/version.ts
|
|
6059
|
-
var VERSION = true ? "3.0.
|
|
6067
|
+
var VERSION = true ? "3.0.32" : "0.0.0-test";
|
|
6060
6068
|
|
|
6061
6069
|
// src/openai-provider.ts
|
|
6062
6070
|
function createOpenAI(options = {}) {
|