@ai-sdk/openai 3.0.0-beta.26 → 3.0.0-beta.28
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 +64 -3
- package/dist/index.d.ts +64 -3
- package/dist/index.js +65 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -70
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +63 -64
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +67 -68
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.28
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 401f561: fix(provider/openai): fix web search tool input types
|
|
8
|
+
|
|
9
|
+
## 3.0.0-beta.27
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- f1277fe: feat(provider/openai): send assistant text and tool call parts as reference ids when store: true
|
|
14
|
+
|
|
3
15
|
## 3.0.0-beta.26
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -28,7 +28,44 @@ type OpenAIEmbeddingModelId = 'text-embedding-3-small' | 'text-embedding-3-large
|
|
|
28
28
|
|
|
29
29
|
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | (string & {});
|
|
30
30
|
|
|
31
|
-
declare const webSearchToolFactory: _ai_sdk_provider_utils.
|
|
31
|
+
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
32
|
+
/**
|
|
33
|
+
* An object describing the specific action taken in this web search call.
|
|
34
|
+
* Includes details on how the model used the web (search, open_page, find).
|
|
35
|
+
*/
|
|
36
|
+
action: {
|
|
37
|
+
/**
|
|
38
|
+
* Action type "search" - Performs a web search query.
|
|
39
|
+
*/
|
|
40
|
+
type: "search";
|
|
41
|
+
/**
|
|
42
|
+
* The search query.
|
|
43
|
+
*/
|
|
44
|
+
query?: string;
|
|
45
|
+
} | {
|
|
46
|
+
/**
|
|
47
|
+
* Action type "openPage" - Opens a specific URL from search results.
|
|
48
|
+
*/
|
|
49
|
+
type: "openPage";
|
|
50
|
+
/**
|
|
51
|
+
* The URL opened by the model.
|
|
52
|
+
*/
|
|
53
|
+
url: string;
|
|
54
|
+
} | {
|
|
55
|
+
/**
|
|
56
|
+
* Action type "find": Searches for a pattern within a loaded page.
|
|
57
|
+
*/
|
|
58
|
+
type: "find";
|
|
59
|
+
/**
|
|
60
|
+
* The URL of the page searched for the pattern.
|
|
61
|
+
*/
|
|
62
|
+
url: string;
|
|
63
|
+
/**
|
|
64
|
+
* The pattern or text to search for within the page.
|
|
65
|
+
*/
|
|
66
|
+
pattern: string;
|
|
67
|
+
};
|
|
68
|
+
}, {
|
|
32
69
|
/**
|
|
33
70
|
* Filters for the search.
|
|
34
71
|
*/
|
|
@@ -227,7 +264,19 @@ declare const openaiTools: {
|
|
|
227
264
|
*
|
|
228
265
|
* @deprecated Use `webSearch` instead.
|
|
229
266
|
*/
|
|
230
|
-
webSearchPreview: _ai_sdk_provider_utils.
|
|
267
|
+
webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
268
|
+
action: {
|
|
269
|
+
type: "search";
|
|
270
|
+
query?: string;
|
|
271
|
+
} | {
|
|
272
|
+
type: "openPage";
|
|
273
|
+
url: string;
|
|
274
|
+
} | {
|
|
275
|
+
type: "find";
|
|
276
|
+
url: string;
|
|
277
|
+
pattern: string;
|
|
278
|
+
};
|
|
279
|
+
}, {
|
|
231
280
|
searchContextSize?: "low" | "medium" | "high";
|
|
232
281
|
userLocation?: {
|
|
233
282
|
type: "approximate";
|
|
@@ -247,7 +296,19 @@ declare const openaiTools: {
|
|
|
247
296
|
* @param searchContextSize - The search context size to use for the web search.
|
|
248
297
|
* @param userLocation - The user location to use for the web search.
|
|
249
298
|
*/
|
|
250
|
-
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{},
|
|
299
|
+
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
300
|
+
action: {
|
|
301
|
+
type: "search";
|
|
302
|
+
query?: string;
|
|
303
|
+
} | {
|
|
304
|
+
type: "openPage";
|
|
305
|
+
url: string;
|
|
306
|
+
} | {
|
|
307
|
+
type: "find";
|
|
308
|
+
url: string;
|
|
309
|
+
pattern: string;
|
|
310
|
+
};
|
|
311
|
+
}>;
|
|
251
312
|
};
|
|
252
313
|
|
|
253
314
|
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-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 & {});
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,44 @@ type OpenAIEmbeddingModelId = 'text-embedding-3-small' | 'text-embedding-3-large
|
|
|
28
28
|
|
|
29
29
|
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | (string & {});
|
|
30
30
|
|
|
31
|
-
declare const webSearchToolFactory: _ai_sdk_provider_utils.
|
|
31
|
+
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
32
|
+
/**
|
|
33
|
+
* An object describing the specific action taken in this web search call.
|
|
34
|
+
* Includes details on how the model used the web (search, open_page, find).
|
|
35
|
+
*/
|
|
36
|
+
action: {
|
|
37
|
+
/**
|
|
38
|
+
* Action type "search" - Performs a web search query.
|
|
39
|
+
*/
|
|
40
|
+
type: "search";
|
|
41
|
+
/**
|
|
42
|
+
* The search query.
|
|
43
|
+
*/
|
|
44
|
+
query?: string;
|
|
45
|
+
} | {
|
|
46
|
+
/**
|
|
47
|
+
* Action type "openPage" - Opens a specific URL from search results.
|
|
48
|
+
*/
|
|
49
|
+
type: "openPage";
|
|
50
|
+
/**
|
|
51
|
+
* The URL opened by the model.
|
|
52
|
+
*/
|
|
53
|
+
url: string;
|
|
54
|
+
} | {
|
|
55
|
+
/**
|
|
56
|
+
* Action type "find": Searches for a pattern within a loaded page.
|
|
57
|
+
*/
|
|
58
|
+
type: "find";
|
|
59
|
+
/**
|
|
60
|
+
* The URL of the page searched for the pattern.
|
|
61
|
+
*/
|
|
62
|
+
url: string;
|
|
63
|
+
/**
|
|
64
|
+
* The pattern or text to search for within the page.
|
|
65
|
+
*/
|
|
66
|
+
pattern: string;
|
|
67
|
+
};
|
|
68
|
+
}, {
|
|
32
69
|
/**
|
|
33
70
|
* Filters for the search.
|
|
34
71
|
*/
|
|
@@ -227,7 +264,19 @@ declare const openaiTools: {
|
|
|
227
264
|
*
|
|
228
265
|
* @deprecated Use `webSearch` instead.
|
|
229
266
|
*/
|
|
230
|
-
webSearchPreview: _ai_sdk_provider_utils.
|
|
267
|
+
webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
268
|
+
action: {
|
|
269
|
+
type: "search";
|
|
270
|
+
query?: string;
|
|
271
|
+
} | {
|
|
272
|
+
type: "openPage";
|
|
273
|
+
url: string;
|
|
274
|
+
} | {
|
|
275
|
+
type: "find";
|
|
276
|
+
url: string;
|
|
277
|
+
pattern: string;
|
|
278
|
+
};
|
|
279
|
+
}, {
|
|
231
280
|
searchContextSize?: "low" | "medium" | "high";
|
|
232
281
|
userLocation?: {
|
|
233
282
|
type: "approximate";
|
|
@@ -247,7 +296,19 @@ declare const openaiTools: {
|
|
|
247
296
|
* @param searchContextSize - The search context size to use for the web search.
|
|
248
297
|
* @param userLocation - The user location to use for the web search.
|
|
249
298
|
*/
|
|
250
|
-
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{},
|
|
299
|
+
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
|
|
300
|
+
action: {
|
|
301
|
+
type: "search";
|
|
302
|
+
query?: string;
|
|
303
|
+
} | {
|
|
304
|
+
type: "openPage";
|
|
305
|
+
url: string;
|
|
306
|
+
} | {
|
|
307
|
+
type: "find";
|
|
308
|
+
url: string;
|
|
309
|
+
pattern: string;
|
|
310
|
+
};
|
|
311
|
+
}>;
|
|
251
312
|
};
|
|
252
313
|
|
|
253
314
|
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-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 & {});
|
package/dist/index.js
CHANGED
|
@@ -1920,9 +1920,7 @@ var import_v413 = require("zod/v4");
|
|
|
1920
1920
|
var webSearchArgsSchema = (0, import_provider_utils18.lazySchema)(
|
|
1921
1921
|
() => (0, import_provider_utils18.zodSchema)(
|
|
1922
1922
|
import_v413.z.object({
|
|
1923
|
-
filters: import_v413.z.object({
|
|
1924
|
-
allowedDomains: import_v413.z.array(import_v413.z.string()).optional()
|
|
1925
|
-
}).optional(),
|
|
1923
|
+
filters: import_v413.z.object({ allowedDomains: import_v413.z.array(import_v413.z.string()).optional() }).optional(),
|
|
1926
1924
|
searchContextSize: import_v413.z.enum(["low", "medium", "high"]).optional(),
|
|
1927
1925
|
userLocation: import_v413.z.object({
|
|
1928
1926
|
type: import_v413.z.literal("approximate"),
|
|
@@ -1934,16 +1932,17 @@ var webSearchArgsSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
1934
1932
|
})
|
|
1935
1933
|
)
|
|
1936
1934
|
);
|
|
1937
|
-
var webSearchInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
1935
|
+
var webSearchInputSchema = (0, import_provider_utils18.lazySchema)(() => (0, import_provider_utils18.zodSchema)(import_v413.z.object({})));
|
|
1936
|
+
var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
1938
1937
|
() => (0, import_provider_utils18.zodSchema)(
|
|
1939
1938
|
import_v413.z.object({
|
|
1940
1939
|
action: import_v413.z.discriminatedUnion("type", [
|
|
1941
1940
|
import_v413.z.object({
|
|
1942
1941
|
type: import_v413.z.literal("search"),
|
|
1943
|
-
query: import_v413.z.string().
|
|
1942
|
+
query: import_v413.z.string().optional()
|
|
1944
1943
|
}),
|
|
1945
1944
|
import_v413.z.object({
|
|
1946
|
-
type: import_v413.z.literal("
|
|
1945
|
+
type: import_v413.z.literal("openPage"),
|
|
1947
1946
|
url: import_v413.z.string()
|
|
1948
1947
|
}),
|
|
1949
1948
|
import_v413.z.object({
|
|
@@ -1951,18 +1950,17 @@ var webSearchInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
1951
1950
|
url: import_v413.z.string(),
|
|
1952
1951
|
pattern: import_v413.z.string()
|
|
1953
1952
|
})
|
|
1954
|
-
])
|
|
1953
|
+
])
|
|
1955
1954
|
})
|
|
1956
1955
|
)
|
|
1957
1956
|
);
|
|
1958
|
-
var webSearchToolFactory = (0, import_provider_utils18.
|
|
1957
|
+
var webSearchToolFactory = (0, import_provider_utils18.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1959
1958
|
id: "openai.web_search",
|
|
1960
1959
|
name: "web_search",
|
|
1961
|
-
inputSchema: webSearchInputSchema
|
|
1960
|
+
inputSchema: webSearchInputSchema,
|
|
1961
|
+
outputSchema: webSearchOutputSchema
|
|
1962
1962
|
});
|
|
1963
|
-
var webSearch = (args = {}) =>
|
|
1964
|
-
return webSearchToolFactory(args);
|
|
1965
|
-
};
|
|
1963
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
1966
1964
|
|
|
1967
1965
|
// src/tool/web-search-preview.ts
|
|
1968
1966
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
@@ -1970,51 +1968,30 @@ var import_v414 = require("zod/v4");
|
|
|
1970
1968
|
var webSearchPreviewArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
1971
1969
|
() => (0, import_provider_utils19.zodSchema)(
|
|
1972
1970
|
import_v414.z.object({
|
|
1973
|
-
/**
|
|
1974
|
-
* Search context size to use for the web search.
|
|
1975
|
-
* - high: Most comprehensive context, highest cost, slower response
|
|
1976
|
-
* - medium: Balanced context, cost, and latency (default)
|
|
1977
|
-
* - low: Least context, lowest cost, fastest response
|
|
1978
|
-
*/
|
|
1979
1971
|
searchContextSize: import_v414.z.enum(["low", "medium", "high"]).optional(),
|
|
1980
|
-
/**
|
|
1981
|
-
* User location information to provide geographically relevant search results.
|
|
1982
|
-
*/
|
|
1983
1972
|
userLocation: import_v414.z.object({
|
|
1984
|
-
/**
|
|
1985
|
-
* Type of location (always 'approximate')
|
|
1986
|
-
*/
|
|
1987
1973
|
type: import_v414.z.literal("approximate"),
|
|
1988
|
-
/**
|
|
1989
|
-
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
1990
|
-
*/
|
|
1991
1974
|
country: import_v414.z.string().optional(),
|
|
1992
|
-
/**
|
|
1993
|
-
* City name (free text, e.g., 'Minneapolis')
|
|
1994
|
-
*/
|
|
1995
1975
|
city: import_v414.z.string().optional(),
|
|
1996
|
-
/**
|
|
1997
|
-
* Region name (free text, e.g., 'Minnesota')
|
|
1998
|
-
*/
|
|
1999
1976
|
region: import_v414.z.string().optional(),
|
|
2000
|
-
/**
|
|
2001
|
-
* IANA timezone (e.g., 'America/Chicago')
|
|
2002
|
-
*/
|
|
2003
1977
|
timezone: import_v414.z.string().optional()
|
|
2004
1978
|
}).optional()
|
|
2005
1979
|
})
|
|
2006
1980
|
)
|
|
2007
1981
|
);
|
|
2008
1982
|
var webSearchPreviewInputSchema = (0, import_provider_utils19.lazySchema)(
|
|
1983
|
+
() => (0, import_provider_utils19.zodSchema)(import_v414.z.object({}))
|
|
1984
|
+
);
|
|
1985
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2009
1986
|
() => (0, import_provider_utils19.zodSchema)(
|
|
2010
1987
|
import_v414.z.object({
|
|
2011
1988
|
action: import_v414.z.discriminatedUnion("type", [
|
|
2012
1989
|
import_v414.z.object({
|
|
2013
1990
|
type: import_v414.z.literal("search"),
|
|
2014
|
-
query: import_v414.z.string().
|
|
1991
|
+
query: import_v414.z.string().optional()
|
|
2015
1992
|
}),
|
|
2016
1993
|
import_v414.z.object({
|
|
2017
|
-
type: import_v414.z.literal("
|
|
1994
|
+
type: import_v414.z.literal("openPage"),
|
|
2018
1995
|
url: import_v414.z.string()
|
|
2019
1996
|
}),
|
|
2020
1997
|
import_v414.z.object({
|
|
@@ -2022,14 +1999,15 @@ var webSearchPreviewInputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
2022
1999
|
url: import_v414.z.string(),
|
|
2023
2000
|
pattern: import_v414.z.string()
|
|
2024
2001
|
})
|
|
2025
|
-
])
|
|
2002
|
+
])
|
|
2026
2003
|
})
|
|
2027
2004
|
)
|
|
2028
2005
|
);
|
|
2029
|
-
var webSearchPreview = (0, import_provider_utils19.
|
|
2006
|
+
var webSearchPreview = (0, import_provider_utils19.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2030
2007
|
id: "openai.web_search_preview",
|
|
2031
2008
|
name: "web_search_preview",
|
|
2032
|
-
inputSchema: webSearchPreviewInputSchema
|
|
2009
|
+
inputSchema: webSearchPreviewInputSchema,
|
|
2010
|
+
outputSchema: webSearchPreviewOutputSchema
|
|
2033
2011
|
});
|
|
2034
2012
|
|
|
2035
2013
|
// src/openai-tools.ts
|
|
@@ -2129,7 +2107,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2129
2107
|
store,
|
|
2130
2108
|
hasLocalShellTool = false
|
|
2131
2109
|
}) {
|
|
2132
|
-
var _a, _b, _c, _d, _e
|
|
2110
|
+
var _a, _b, _c, _d, _e;
|
|
2133
2111
|
const input = [];
|
|
2134
2112
|
const warnings = [];
|
|
2135
2113
|
for (const { role, content } of prompt) {
|
|
@@ -2210,10 +2188,15 @@ async function convertToOpenAIResponsesInput({
|
|
|
2210
2188
|
for (const part of content) {
|
|
2211
2189
|
switch (part.type) {
|
|
2212
2190
|
case "text": {
|
|
2191
|
+
const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId;
|
|
2192
|
+
if (store && id != null) {
|
|
2193
|
+
input.push({ type: "item_reference", id });
|
|
2194
|
+
break;
|
|
2195
|
+
}
|
|
2213
2196
|
input.push({
|
|
2214
2197
|
role: "assistant",
|
|
2215
2198
|
content: [{ type: "output_text", text: part.text }],
|
|
2216
|
-
id
|
|
2199
|
+
id
|
|
2217
2200
|
});
|
|
2218
2201
|
break;
|
|
2219
2202
|
}
|
|
@@ -2222,6 +2205,11 @@ async function convertToOpenAIResponsesInput({
|
|
|
2222
2205
|
if (part.providerExecuted) {
|
|
2223
2206
|
break;
|
|
2224
2207
|
}
|
|
2208
|
+
const id = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.itemId;
|
|
2209
|
+
if (store && id != null) {
|
|
2210
|
+
input.push({ type: "item_reference", id });
|
|
2211
|
+
break;
|
|
2212
|
+
}
|
|
2225
2213
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2226
2214
|
const parsedInput = await (0, import_provider_utils20.validateTypes)({
|
|
2227
2215
|
value: part.input,
|
|
@@ -2230,7 +2218,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2230
2218
|
input.push({
|
|
2231
2219
|
type: "local_shell_call",
|
|
2232
2220
|
call_id: part.toolCallId,
|
|
2233
|
-
id
|
|
2221
|
+
id,
|
|
2234
2222
|
action: {
|
|
2235
2223
|
type: "exec",
|
|
2236
2224
|
command: parsedInput.action.command,
|
|
@@ -2247,7 +2235,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2247
2235
|
call_id: part.toolCallId,
|
|
2248
2236
|
name: part.toolName,
|
|
2249
2237
|
arguments: JSON.stringify(part.input),
|
|
2250
|
-
id
|
|
2238
|
+
id
|
|
2251
2239
|
});
|
|
2252
2240
|
break;
|
|
2253
2241
|
}
|
|
@@ -2340,7 +2328,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2340
2328
|
contentValue = output.value;
|
|
2341
2329
|
break;
|
|
2342
2330
|
case "execution-denied":
|
|
2343
|
-
contentValue = (
|
|
2331
|
+
contentValue = (_e = output.reason) != null ? _e : "Tool execution denied.";
|
|
2344
2332
|
break;
|
|
2345
2333
|
case "json":
|
|
2346
2334
|
case "error-json":
|
|
@@ -2473,11 +2461,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2473
2461
|
import_v416.z.object({
|
|
2474
2462
|
type: import_v416.z.literal("web_search_call"),
|
|
2475
2463
|
id: import_v416.z.string(),
|
|
2476
|
-
status: import_v416.z.string()
|
|
2477
|
-
action: import_v416.z.object({
|
|
2478
|
-
type: import_v416.z.literal("search"),
|
|
2479
|
-
query: import_v416.z.string().optional()
|
|
2480
|
-
}).nullish()
|
|
2464
|
+
status: import_v416.z.string()
|
|
2481
2465
|
}),
|
|
2482
2466
|
import_v416.z.object({
|
|
2483
2467
|
type: import_v416.z.literal("computer_call"),
|
|
@@ -2563,7 +2547,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2563
2547
|
url: import_v416.z.string(),
|
|
2564
2548
|
pattern: import_v416.z.string()
|
|
2565
2549
|
})
|
|
2566
|
-
])
|
|
2550
|
+
])
|
|
2567
2551
|
}),
|
|
2568
2552
|
import_v416.z.object({
|
|
2569
2553
|
type: import_v416.z.literal("file_search_call"),
|
|
@@ -2744,7 +2728,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2744
2728
|
url: import_v416.z.string(),
|
|
2745
2729
|
pattern: import_v416.z.string()
|
|
2746
2730
|
})
|
|
2747
|
-
])
|
|
2731
|
+
])
|
|
2748
2732
|
}),
|
|
2749
2733
|
import_v416.z.object({
|
|
2750
2734
|
type: import_v416.z.literal("file_search_call"),
|
|
@@ -3443,14 +3427,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3443
3427
|
type: "tool-call",
|
|
3444
3428
|
toolCallId: part.id,
|
|
3445
3429
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3446
|
-
input: JSON.stringify({
|
|
3430
|
+
input: JSON.stringify({}),
|
|
3447
3431
|
providerExecuted: true
|
|
3448
3432
|
});
|
|
3449
3433
|
content.push({
|
|
3450
3434
|
type: "tool-result",
|
|
3451
3435
|
toolCallId: part.id,
|
|
3452
3436
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3453
|
-
result:
|
|
3437
|
+
result: mapWebSearchOutput(part.action),
|
|
3454
3438
|
providerExecuted: true
|
|
3455
3439
|
});
|
|
3456
3440
|
break;
|
|
@@ -3634,6 +3618,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3634
3618
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3635
3619
|
providerExecuted: true
|
|
3636
3620
|
});
|
|
3621
|
+
controller.enqueue({
|
|
3622
|
+
type: "tool-input-end",
|
|
3623
|
+
id: value.item.id
|
|
3624
|
+
});
|
|
3625
|
+
controller.enqueue({
|
|
3626
|
+
type: "tool-call",
|
|
3627
|
+
toolCallId: value.item.id,
|
|
3628
|
+
toolName: "web_search",
|
|
3629
|
+
input: JSON.stringify({}),
|
|
3630
|
+
providerExecuted: true
|
|
3631
|
+
});
|
|
3637
3632
|
} else if (value.item.type === "computer_call") {
|
|
3638
3633
|
ongoingToolCalls[value.output_index] = {
|
|
3639
3634
|
toolName: "computer_use",
|
|
@@ -3727,22 +3722,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3727
3722
|
});
|
|
3728
3723
|
} else if (value.item.type === "web_search_call") {
|
|
3729
3724
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3730
|
-
controller.enqueue({
|
|
3731
|
-
type: "tool-input-end",
|
|
3732
|
-
id: value.item.id
|
|
3733
|
-
});
|
|
3734
|
-
controller.enqueue({
|
|
3735
|
-
type: "tool-call",
|
|
3736
|
-
toolCallId: value.item.id,
|
|
3737
|
-
toolName: "web_search",
|
|
3738
|
-
input: JSON.stringify({ action: value.item.action }),
|
|
3739
|
-
providerExecuted: true
|
|
3740
|
-
});
|
|
3741
3725
|
controller.enqueue({
|
|
3742
3726
|
type: "tool-result",
|
|
3743
3727
|
toolCallId: value.item.id,
|
|
3744
3728
|
toolName: "web_search",
|
|
3745
|
-
result:
|
|
3729
|
+
result: mapWebSearchOutput(value.item.action),
|
|
3746
3730
|
providerExecuted: true
|
|
3747
3731
|
});
|
|
3748
3732
|
} else if (value.item.type === "computer_call") {
|
|
@@ -4087,6 +4071,19 @@ function getResponsesModelConfig(modelId) {
|
|
|
4087
4071
|
isReasoningModel: false
|
|
4088
4072
|
};
|
|
4089
4073
|
}
|
|
4074
|
+
function mapWebSearchOutput(action) {
|
|
4075
|
+
var _a;
|
|
4076
|
+
switch (action.type) {
|
|
4077
|
+
case "search":
|
|
4078
|
+
return { action: { type: "search", query: (_a = action.query) != null ? _a : void 0 } };
|
|
4079
|
+
case "open_page":
|
|
4080
|
+
return { action: { type: "openPage", url: action.url } };
|
|
4081
|
+
case "find":
|
|
4082
|
+
return {
|
|
4083
|
+
action: { type: "find", url: action.url, pattern: action.pattern }
|
|
4084
|
+
};
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4090
4087
|
|
|
4091
4088
|
// src/speech/openai-speech-model.ts
|
|
4092
4089
|
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
@@ -4441,7 +4438,7 @@ var OpenAITranscriptionModel = class {
|
|
|
4441
4438
|
};
|
|
4442
4439
|
|
|
4443
4440
|
// src/version.ts
|
|
4444
|
-
var VERSION = true ? "3.0.0-beta.
|
|
4441
|
+
var VERSION = true ? "3.0.0-beta.28" : "0.0.0-test";
|
|
4445
4442
|
|
|
4446
4443
|
// src/openai-provider.ts
|
|
4447
4444
|
function createOpenAI(options = {}) {
|