@ai-sdk/openai 2.0.25 → 2.0.27
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 +13 -0
- package/dist/index.d.mts +114 -1
- package/dist/index.d.ts +114 -1
- package/dist/index.js +413 -332
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +382 -301
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +310 -275
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +298 -263
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.0.27
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2338c79: feat (provider/openai): add jsdoc for openai tools
|
|
8
|
+
|
|
9
|
+
## 2.0.26
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 5819aec: fix (provider/openai): only send tool calls finish reason for tools that are not provider-executed
|
|
14
|
+
- af8c6bb: feat (provider/openai): add web_search tool
|
|
15
|
+
|
|
3
16
|
## 2.0.25
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -11,12 +11,103 @@ type OpenAIEmbeddingModelId = 'text-embedding-3-small' | 'text-embedding-3-large
|
|
|
11
11
|
|
|
12
12
|
type OpenAIImageModelId = 'gpt-image-1' | 'dall-e-3' | 'dall-e-2' | (string & {});
|
|
13
13
|
|
|
14
|
+
declare const factory: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
15
|
+
/**
|
|
16
|
+
* Filters for the search.
|
|
17
|
+
*/
|
|
18
|
+
filters?: {
|
|
19
|
+
/**
|
|
20
|
+
* Allowed domains for the search.
|
|
21
|
+
* If not provided, all domains are allowed.
|
|
22
|
+
* Subdomains of the provided domains are allowed as well.
|
|
23
|
+
*/
|
|
24
|
+
allowedDomains?: string[];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Search context size to use for the web search.
|
|
28
|
+
* - high: Most comprehensive context, highest cost, slower response
|
|
29
|
+
* - medium: Balanced context, cost, and latency (default)
|
|
30
|
+
* - low: Least context, lowest cost, fastest response
|
|
31
|
+
*/
|
|
32
|
+
searchContextSize?: "low" | "medium" | "high";
|
|
33
|
+
/**
|
|
34
|
+
* User location information to provide geographically relevant search results.
|
|
35
|
+
*/
|
|
36
|
+
userLocation?: {
|
|
37
|
+
/**
|
|
38
|
+
* Type of location (always 'approximate')
|
|
39
|
+
*/
|
|
40
|
+
type: "approximate";
|
|
41
|
+
/**
|
|
42
|
+
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
43
|
+
*/
|
|
44
|
+
country?: string;
|
|
45
|
+
/**
|
|
46
|
+
* City name (free text, e.g., 'Minneapolis')
|
|
47
|
+
*/
|
|
48
|
+
city?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Region name (free text, e.g., 'Minnesota')
|
|
51
|
+
*/
|
|
52
|
+
region?: string;
|
|
53
|
+
/**
|
|
54
|
+
* IANA timezone (e.g., 'America/Chicago')
|
|
55
|
+
*/
|
|
56
|
+
timezone?: string;
|
|
57
|
+
};
|
|
58
|
+
}>;
|
|
59
|
+
|
|
14
60
|
declare const openaiTools: {
|
|
61
|
+
/**
|
|
62
|
+
* The Code Interpreter tool allows models to write and run Python code in a
|
|
63
|
+
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
64
|
+
* coding, and math.
|
|
65
|
+
*
|
|
66
|
+
* @param container - The container to use for the code interpreter.
|
|
67
|
+
*
|
|
68
|
+
* Must have name `code_interpreter`.
|
|
69
|
+
*/
|
|
15
70
|
codeInterpreter: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
16
71
|
container?: string | {
|
|
17
|
-
fileIds
|
|
72
|
+
fileIds
|
|
73
|
+
/**
|
|
74
|
+
* File search is a tool available in the Responses API. It enables models to
|
|
75
|
+
* retrieve information in a knowledge base of previously uploaded files through
|
|
76
|
+
* semantic and keyword search.
|
|
77
|
+
*
|
|
78
|
+
* Must have name `file_search`.
|
|
79
|
+
*
|
|
80
|
+
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
81
|
+
* @param maxNumResults - The maximum number of results to return.
|
|
82
|
+
* @param ranking - The ranking options to use for the file search.
|
|
83
|
+
* @param filters - The filters to use for the file search.
|
|
84
|
+
*/
|
|
85
|
+
? /**
|
|
86
|
+
* File search is a tool available in the Responses API. It enables models to
|
|
87
|
+
* retrieve information in a knowledge base of previously uploaded files through
|
|
88
|
+
* semantic and keyword search.
|
|
89
|
+
*
|
|
90
|
+
* Must have name `file_search`.
|
|
91
|
+
*
|
|
92
|
+
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
93
|
+
* @param maxNumResults - The maximum number of results to return.
|
|
94
|
+
* @param ranking - The ranking options to use for the file search.
|
|
95
|
+
* @param filters - The filters to use for the file search.
|
|
96
|
+
*/: string[];
|
|
18
97
|
};
|
|
19
98
|
}>;
|
|
99
|
+
/**
|
|
100
|
+
* File search is a tool available in the Responses API. It enables models to
|
|
101
|
+
* retrieve information in a knowledge base of previously uploaded files through
|
|
102
|
+
* semantic and keyword search.
|
|
103
|
+
*
|
|
104
|
+
* Must have name `file_search`.
|
|
105
|
+
*
|
|
106
|
+
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
107
|
+
* @param maxNumResults - The maximum number of results to return.
|
|
108
|
+
* @param ranking - The ranking options to use for the file search.
|
|
109
|
+
* @param filters - The filters to use for the file search.
|
|
110
|
+
*/
|
|
20
111
|
fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
21
112
|
query: string;
|
|
22
113
|
}, {
|
|
@@ -34,6 +125,17 @@ declare const openaiTools: {
|
|
|
34
125
|
filters: any[];
|
|
35
126
|
};
|
|
36
127
|
}>;
|
|
128
|
+
/**
|
|
129
|
+
* Web search allows models to access up-to-date information from the internet
|
|
130
|
+
* and provide answers with sourced citations.
|
|
131
|
+
*
|
|
132
|
+
* Must have name `web_search_preview`.
|
|
133
|
+
*
|
|
134
|
+
* @param searchContextSize - The search context size to use for the web search.
|
|
135
|
+
* @param userLocation - The user location to use for the web search.
|
|
136
|
+
*
|
|
137
|
+
* @deprecated Use `webSearch` instead.
|
|
138
|
+
*/
|
|
37
139
|
webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
38
140
|
searchContextSize?: "low" | "medium" | "high";
|
|
39
141
|
userLocation?: {
|
|
@@ -44,6 +146,17 @@ declare const openaiTools: {
|
|
|
44
146
|
timezone?: string;
|
|
45
147
|
};
|
|
46
148
|
}>;
|
|
149
|
+
/**
|
|
150
|
+
* Web search allows models to access up-to-date information from the internet
|
|
151
|
+
* and provide answers with sourced citations.
|
|
152
|
+
*
|
|
153
|
+
* Must have name `web_search`.
|
|
154
|
+
*
|
|
155
|
+
* @param filters - The filters to use for the web search.
|
|
156
|
+
* @param searchContextSize - The search context size to use for the web search.
|
|
157
|
+
* @param userLocation - The user location to use for the web search.
|
|
158
|
+
*/
|
|
159
|
+
webSearch: (args?: Parameters<typeof factory>[0]) => _ai_sdk_provider_utils.Tool<{}, unknown>;
|
|
47
160
|
};
|
|
48
161
|
|
|
49
162
|
type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | '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-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-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {});
|
package/dist/index.d.ts
CHANGED
|
@@ -11,12 +11,103 @@ type OpenAIEmbeddingModelId = 'text-embedding-3-small' | 'text-embedding-3-large
|
|
|
11
11
|
|
|
12
12
|
type OpenAIImageModelId = 'gpt-image-1' | 'dall-e-3' | 'dall-e-2' | (string & {});
|
|
13
13
|
|
|
14
|
+
declare const factory: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
15
|
+
/**
|
|
16
|
+
* Filters for the search.
|
|
17
|
+
*/
|
|
18
|
+
filters?: {
|
|
19
|
+
/**
|
|
20
|
+
* Allowed domains for the search.
|
|
21
|
+
* If not provided, all domains are allowed.
|
|
22
|
+
* Subdomains of the provided domains are allowed as well.
|
|
23
|
+
*/
|
|
24
|
+
allowedDomains?: string[];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Search context size to use for the web search.
|
|
28
|
+
* - high: Most comprehensive context, highest cost, slower response
|
|
29
|
+
* - medium: Balanced context, cost, and latency (default)
|
|
30
|
+
* - low: Least context, lowest cost, fastest response
|
|
31
|
+
*/
|
|
32
|
+
searchContextSize?: "low" | "medium" | "high";
|
|
33
|
+
/**
|
|
34
|
+
* User location information to provide geographically relevant search results.
|
|
35
|
+
*/
|
|
36
|
+
userLocation?: {
|
|
37
|
+
/**
|
|
38
|
+
* Type of location (always 'approximate')
|
|
39
|
+
*/
|
|
40
|
+
type: "approximate";
|
|
41
|
+
/**
|
|
42
|
+
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
43
|
+
*/
|
|
44
|
+
country?: string;
|
|
45
|
+
/**
|
|
46
|
+
* City name (free text, e.g., 'Minneapolis')
|
|
47
|
+
*/
|
|
48
|
+
city?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Region name (free text, e.g., 'Minnesota')
|
|
51
|
+
*/
|
|
52
|
+
region?: string;
|
|
53
|
+
/**
|
|
54
|
+
* IANA timezone (e.g., 'America/Chicago')
|
|
55
|
+
*/
|
|
56
|
+
timezone?: string;
|
|
57
|
+
};
|
|
58
|
+
}>;
|
|
59
|
+
|
|
14
60
|
declare const openaiTools: {
|
|
61
|
+
/**
|
|
62
|
+
* The Code Interpreter tool allows models to write and run Python code in a
|
|
63
|
+
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
64
|
+
* coding, and math.
|
|
65
|
+
*
|
|
66
|
+
* @param container - The container to use for the code interpreter.
|
|
67
|
+
*
|
|
68
|
+
* Must have name `code_interpreter`.
|
|
69
|
+
*/
|
|
15
70
|
codeInterpreter: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
16
71
|
container?: string | {
|
|
17
|
-
fileIds
|
|
72
|
+
fileIds
|
|
73
|
+
/**
|
|
74
|
+
* File search is a tool available in the Responses API. It enables models to
|
|
75
|
+
* retrieve information in a knowledge base of previously uploaded files through
|
|
76
|
+
* semantic and keyword search.
|
|
77
|
+
*
|
|
78
|
+
* Must have name `file_search`.
|
|
79
|
+
*
|
|
80
|
+
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
81
|
+
* @param maxNumResults - The maximum number of results to return.
|
|
82
|
+
* @param ranking - The ranking options to use for the file search.
|
|
83
|
+
* @param filters - The filters to use for the file search.
|
|
84
|
+
*/
|
|
85
|
+
? /**
|
|
86
|
+
* File search is a tool available in the Responses API. It enables models to
|
|
87
|
+
* retrieve information in a knowledge base of previously uploaded files through
|
|
88
|
+
* semantic and keyword search.
|
|
89
|
+
*
|
|
90
|
+
* Must have name `file_search`.
|
|
91
|
+
*
|
|
92
|
+
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
93
|
+
* @param maxNumResults - The maximum number of results to return.
|
|
94
|
+
* @param ranking - The ranking options to use for the file search.
|
|
95
|
+
* @param filters - The filters to use for the file search.
|
|
96
|
+
*/: string[];
|
|
18
97
|
};
|
|
19
98
|
}>;
|
|
99
|
+
/**
|
|
100
|
+
* File search is a tool available in the Responses API. It enables models to
|
|
101
|
+
* retrieve information in a knowledge base of previously uploaded files through
|
|
102
|
+
* semantic and keyword search.
|
|
103
|
+
*
|
|
104
|
+
* Must have name `file_search`.
|
|
105
|
+
*
|
|
106
|
+
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
107
|
+
* @param maxNumResults - The maximum number of results to return.
|
|
108
|
+
* @param ranking - The ranking options to use for the file search.
|
|
109
|
+
* @param filters - The filters to use for the file search.
|
|
110
|
+
*/
|
|
20
111
|
fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
21
112
|
query: string;
|
|
22
113
|
}, {
|
|
@@ -34,6 +125,17 @@ declare const openaiTools: {
|
|
|
34
125
|
filters: any[];
|
|
35
126
|
};
|
|
36
127
|
}>;
|
|
128
|
+
/**
|
|
129
|
+
* Web search allows models to access up-to-date information from the internet
|
|
130
|
+
* and provide answers with sourced citations.
|
|
131
|
+
*
|
|
132
|
+
* Must have name `web_search_preview`.
|
|
133
|
+
*
|
|
134
|
+
* @param searchContextSize - The search context size to use for the web search.
|
|
135
|
+
* @param userLocation - The user location to use for the web search.
|
|
136
|
+
*
|
|
137
|
+
* @deprecated Use `webSearch` instead.
|
|
138
|
+
*/
|
|
37
139
|
webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
38
140
|
searchContextSize?: "low" | "medium" | "high";
|
|
39
141
|
userLocation?: {
|
|
@@ -44,6 +146,17 @@ declare const openaiTools: {
|
|
|
44
146
|
timezone?: string;
|
|
45
147
|
};
|
|
46
148
|
}>;
|
|
149
|
+
/**
|
|
150
|
+
* Web search allows models to access up-to-date information from the internet
|
|
151
|
+
* and provide answers with sourced citations.
|
|
152
|
+
*
|
|
153
|
+
* Must have name `web_search`.
|
|
154
|
+
*
|
|
155
|
+
* @param filters - The filters to use for the web search.
|
|
156
|
+
* @param searchContextSize - The search context size to use for the web search.
|
|
157
|
+
* @param userLocation - The user location to use for the web search.
|
|
158
|
+
*/
|
|
159
|
+
webSearch: (args?: Parameters<typeof factory>[0]) => _ai_sdk_provider_utils.Tool<{}, unknown>;
|
|
47
160
|
};
|
|
48
161
|
|
|
49
162
|
type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | '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-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-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {});
|