@ai-sdk/openai 3.0.0-beta.80 → 3.0.0-beta.82
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 +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +873 -714
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +829 -666
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +890 -743
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +874 -723
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ __export(src_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(src_exports);
|
|
28
28
|
|
|
29
29
|
// src/openai-provider.ts
|
|
30
|
-
var
|
|
30
|
+
var import_provider_utils33 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/chat/openai-chat-language-model.ts
|
|
33
33
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -1942,66 +1942,50 @@ var localShell = (0, import_provider_utils18.createProviderToolFactoryWithOutput
|
|
|
1942
1942
|
outputSchema: localShellOutputSchema
|
|
1943
1943
|
});
|
|
1944
1944
|
|
|
1945
|
-
// src/tool/
|
|
1945
|
+
// src/tool/shell.ts
|
|
1946
1946
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
1947
1947
|
var import_v414 = require("zod/v4");
|
|
1948
|
-
var
|
|
1948
|
+
var shellInputSchema = (0, import_provider_utils19.lazySchema)(
|
|
1949
1949
|
() => (0, import_provider_utils19.zodSchema)(
|
|
1950
1950
|
import_v414.z.object({
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
country: import_v414.z.string().optional(),
|
|
1957
|
-
city: import_v414.z.string().optional(),
|
|
1958
|
-
region: import_v414.z.string().optional(),
|
|
1959
|
-
timezone: import_v414.z.string().optional()
|
|
1960
|
-
}).optional()
|
|
1951
|
+
action: import_v414.z.object({
|
|
1952
|
+
commands: import_v414.z.array(import_v414.z.string()),
|
|
1953
|
+
timeoutMs: import_v414.z.number().optional(),
|
|
1954
|
+
maxOutputLength: import_v414.z.number().optional()
|
|
1955
|
+
})
|
|
1961
1956
|
})
|
|
1962
1957
|
)
|
|
1963
1958
|
);
|
|
1964
|
-
var
|
|
1965
|
-
var webSearchOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
1959
|
+
var shellOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
1966
1960
|
() => (0, import_provider_utils19.zodSchema)(
|
|
1967
1961
|
import_v414.z.object({
|
|
1968
|
-
|
|
1969
|
-
import_v414.z.object({
|
|
1970
|
-
type: import_v414.z.literal("search"),
|
|
1971
|
-
query: import_v414.z.string().optional()
|
|
1972
|
-
}),
|
|
1962
|
+
output: import_v414.z.array(
|
|
1973
1963
|
import_v414.z.object({
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
pattern: import_v414.z.string().nullish()
|
|
1964
|
+
stdout: import_v414.z.string(),
|
|
1965
|
+
stderr: import_v414.z.string(),
|
|
1966
|
+
outcome: import_v414.z.discriminatedUnion("type", [
|
|
1967
|
+
import_v414.z.object({ type: import_v414.z.literal("timeout") }),
|
|
1968
|
+
import_v414.z.object({ type: import_v414.z.literal("exit"), exitCode: import_v414.z.number() })
|
|
1969
|
+
])
|
|
1981
1970
|
})
|
|
1982
|
-
|
|
1983
|
-
sources: import_v414.z.array(
|
|
1984
|
-
import_v414.z.discriminatedUnion("type", [
|
|
1985
|
-
import_v414.z.object({ type: import_v414.z.literal("url"), url: import_v414.z.string() }),
|
|
1986
|
-
import_v414.z.object({ type: import_v414.z.literal("api"), name: import_v414.z.string() })
|
|
1987
|
-
])
|
|
1988
|
-
).optional()
|
|
1971
|
+
)
|
|
1989
1972
|
})
|
|
1990
1973
|
)
|
|
1991
1974
|
);
|
|
1992
|
-
var
|
|
1993
|
-
id: "openai.
|
|
1994
|
-
inputSchema:
|
|
1995
|
-
outputSchema:
|
|
1975
|
+
var shell = (0, import_provider_utils19.createProviderToolFactoryWithOutputSchema)({
|
|
1976
|
+
id: "openai.shell",
|
|
1977
|
+
inputSchema: shellInputSchema,
|
|
1978
|
+
outputSchema: shellOutputSchema
|
|
1996
1979
|
});
|
|
1997
|
-
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
1998
1980
|
|
|
1999
|
-
// src/tool/web-search
|
|
1981
|
+
// src/tool/web-search.ts
|
|
2000
1982
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2001
1983
|
var import_v415 = require("zod/v4");
|
|
2002
|
-
var
|
|
1984
|
+
var webSearchArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
2003
1985
|
() => (0, import_provider_utils20.zodSchema)(
|
|
2004
1986
|
import_v415.z.object({
|
|
1987
|
+
externalWebAccess: import_v415.z.boolean().optional(),
|
|
1988
|
+
filters: import_v415.z.object({ allowedDomains: import_v415.z.array(import_v415.z.string()).optional() }).optional(),
|
|
2005
1989
|
searchContextSize: import_v415.z.enum(["low", "medium", "high"]).optional(),
|
|
2006
1990
|
userLocation: import_v415.z.object({
|
|
2007
1991
|
type: import_v415.z.literal("approximate"),
|
|
@@ -2013,10 +1997,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
2013
1997
|
})
|
|
2014
1998
|
)
|
|
2015
1999
|
);
|
|
2016
|
-
var
|
|
2017
|
-
|
|
2018
|
-
);
|
|
2019
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2000
|
+
var webSearchInputSchema = (0, import_provider_utils20.lazySchema)(() => (0, import_provider_utils20.zodSchema)(import_v415.z.object({})));
|
|
2001
|
+
var webSearchOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2020
2002
|
() => (0, import_provider_utils20.zodSchema)(
|
|
2021
2003
|
import_v415.z.object({
|
|
2022
2004
|
action: import_v415.z.discriminatedUnion("type", [
|
|
@@ -2033,43 +2015,97 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
2033
2015
|
url: import_v415.z.string().nullish(),
|
|
2034
2016
|
pattern: import_v415.z.string().nullish()
|
|
2035
2017
|
})
|
|
2018
|
+
]),
|
|
2019
|
+
sources: import_v415.z.array(
|
|
2020
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2021
|
+
import_v415.z.object({ type: import_v415.z.literal("url"), url: import_v415.z.string() }),
|
|
2022
|
+
import_v415.z.object({ type: import_v415.z.literal("api"), name: import_v415.z.string() })
|
|
2023
|
+
])
|
|
2024
|
+
).optional()
|
|
2025
|
+
})
|
|
2026
|
+
)
|
|
2027
|
+
);
|
|
2028
|
+
var webSearchToolFactory = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
|
|
2029
|
+
id: "openai.web_search",
|
|
2030
|
+
inputSchema: webSearchInputSchema,
|
|
2031
|
+
outputSchema: webSearchOutputSchema
|
|
2032
|
+
});
|
|
2033
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2034
|
+
|
|
2035
|
+
// src/tool/web-search-preview.ts
|
|
2036
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2037
|
+
var import_v416 = require("zod/v4");
|
|
2038
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils21.lazySchema)(
|
|
2039
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2040
|
+
import_v416.z.object({
|
|
2041
|
+
searchContextSize: import_v416.z.enum(["low", "medium", "high"]).optional(),
|
|
2042
|
+
userLocation: import_v416.z.object({
|
|
2043
|
+
type: import_v416.z.literal("approximate"),
|
|
2044
|
+
country: import_v416.z.string().optional(),
|
|
2045
|
+
city: import_v416.z.string().optional(),
|
|
2046
|
+
region: import_v416.z.string().optional(),
|
|
2047
|
+
timezone: import_v416.z.string().optional()
|
|
2048
|
+
}).optional()
|
|
2049
|
+
})
|
|
2050
|
+
)
|
|
2051
|
+
);
|
|
2052
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2053
|
+
() => (0, import_provider_utils21.zodSchema)(import_v416.z.object({}))
|
|
2054
|
+
);
|
|
2055
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2056
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2057
|
+
import_v416.z.object({
|
|
2058
|
+
action: import_v416.z.discriminatedUnion("type", [
|
|
2059
|
+
import_v416.z.object({
|
|
2060
|
+
type: import_v416.z.literal("search"),
|
|
2061
|
+
query: import_v416.z.string().optional()
|
|
2062
|
+
}),
|
|
2063
|
+
import_v416.z.object({
|
|
2064
|
+
type: import_v416.z.literal("openPage"),
|
|
2065
|
+
url: import_v416.z.string().nullish()
|
|
2066
|
+
}),
|
|
2067
|
+
import_v416.z.object({
|
|
2068
|
+
type: import_v416.z.literal("find"),
|
|
2069
|
+
url: import_v416.z.string().nullish(),
|
|
2070
|
+
pattern: import_v416.z.string().nullish()
|
|
2071
|
+
})
|
|
2036
2072
|
])
|
|
2037
2073
|
})
|
|
2038
2074
|
)
|
|
2039
2075
|
);
|
|
2040
|
-
var webSearchPreview = (0,
|
|
2076
|
+
var webSearchPreview = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
|
|
2041
2077
|
id: "openai.web_search_preview",
|
|
2042
2078
|
inputSchema: webSearchPreviewInputSchema,
|
|
2043
2079
|
outputSchema: webSearchPreviewOutputSchema
|
|
2044
2080
|
});
|
|
2045
2081
|
|
|
2046
2082
|
// src/tool/mcp.ts
|
|
2047
|
-
var
|
|
2048
|
-
var
|
|
2049
|
-
var jsonValueSchema =
|
|
2050
|
-
() =>
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2083
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2084
|
+
var import_v417 = require("zod/v4");
|
|
2085
|
+
var jsonValueSchema = import_v417.z.lazy(
|
|
2086
|
+
() => import_v417.z.union([
|
|
2087
|
+
import_v417.z.string(),
|
|
2088
|
+
import_v417.z.number(),
|
|
2089
|
+
import_v417.z.boolean(),
|
|
2090
|
+
import_v417.z.null(),
|
|
2091
|
+
import_v417.z.array(jsonValueSchema),
|
|
2092
|
+
import_v417.z.record(import_v417.z.string(), jsonValueSchema)
|
|
2057
2093
|
])
|
|
2058
2094
|
);
|
|
2059
|
-
var mcpArgsSchema = (0,
|
|
2060
|
-
() => (0,
|
|
2061
|
-
|
|
2062
|
-
serverLabel:
|
|
2063
|
-
allowedTools:
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
readOnly:
|
|
2067
|
-
toolNames:
|
|
2095
|
+
var mcpArgsSchema = (0, import_provider_utils22.lazySchema)(
|
|
2096
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2097
|
+
import_v417.z.object({
|
|
2098
|
+
serverLabel: import_v417.z.string(),
|
|
2099
|
+
allowedTools: import_v417.z.union([
|
|
2100
|
+
import_v417.z.array(import_v417.z.string()),
|
|
2101
|
+
import_v417.z.object({
|
|
2102
|
+
readOnly: import_v417.z.boolean().optional(),
|
|
2103
|
+
toolNames: import_v417.z.array(import_v417.z.string()).optional()
|
|
2068
2104
|
})
|
|
2069
2105
|
]).optional(),
|
|
2070
|
-
authorization:
|
|
2071
|
-
connectorId:
|
|
2072
|
-
headers:
|
|
2106
|
+
authorization: import_v417.z.string().optional(),
|
|
2107
|
+
connectorId: import_v417.z.string().optional(),
|
|
2108
|
+
headers: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional(),
|
|
2073
2109
|
// TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
|
|
2074
2110
|
// requireApproval: z
|
|
2075
2111
|
// .union([
|
|
@@ -2080,50 +2116,50 @@ var mcpArgsSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2080
2116
|
// }),
|
|
2081
2117
|
// ])
|
|
2082
2118
|
// .optional(),
|
|
2083
|
-
serverDescription:
|
|
2084
|
-
serverUrl:
|
|
2119
|
+
serverDescription: import_v417.z.string().optional(),
|
|
2120
|
+
serverUrl: import_v417.z.string().optional()
|
|
2085
2121
|
}).refine(
|
|
2086
2122
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2087
2123
|
"One of serverUrl or connectorId must be provided."
|
|
2088
2124
|
)
|
|
2089
2125
|
)
|
|
2090
2126
|
);
|
|
2091
|
-
var mcpInputSchema = (0,
|
|
2092
|
-
var mcpOutputSchema = (0,
|
|
2093
|
-
() => (0,
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
type:
|
|
2097
|
-
serverLabel:
|
|
2098
|
-
name:
|
|
2099
|
-
arguments:
|
|
2100
|
-
output:
|
|
2101
|
-
error:
|
|
2127
|
+
var mcpInputSchema = (0, import_provider_utils22.lazySchema)(() => (0, import_provider_utils22.zodSchema)(import_v417.z.object({})));
|
|
2128
|
+
var mcpOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2129
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2130
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2131
|
+
import_v417.z.object({
|
|
2132
|
+
type: import_v417.z.literal("call"),
|
|
2133
|
+
serverLabel: import_v417.z.string(),
|
|
2134
|
+
name: import_v417.z.string(),
|
|
2135
|
+
arguments: import_v417.z.string(),
|
|
2136
|
+
output: import_v417.z.string().nullable().optional(),
|
|
2137
|
+
error: import_v417.z.union([import_v417.z.string(), jsonValueSchema]).optional()
|
|
2102
2138
|
}),
|
|
2103
|
-
|
|
2104
|
-
type:
|
|
2105
|
-
serverLabel:
|
|
2106
|
-
tools:
|
|
2107
|
-
|
|
2108
|
-
name:
|
|
2109
|
-
description:
|
|
2139
|
+
import_v417.z.object({
|
|
2140
|
+
type: import_v417.z.literal("listTools"),
|
|
2141
|
+
serverLabel: import_v417.z.string(),
|
|
2142
|
+
tools: import_v417.z.array(
|
|
2143
|
+
import_v417.z.object({
|
|
2144
|
+
name: import_v417.z.string(),
|
|
2145
|
+
description: import_v417.z.string().optional(),
|
|
2110
2146
|
inputSchema: jsonValueSchema,
|
|
2111
|
-
annotations:
|
|
2147
|
+
annotations: import_v417.z.record(import_v417.z.string(), jsonValueSchema).optional()
|
|
2112
2148
|
})
|
|
2113
2149
|
),
|
|
2114
|
-
error:
|
|
2150
|
+
error: import_v417.z.union([import_v417.z.string(), jsonValueSchema]).optional()
|
|
2115
2151
|
}),
|
|
2116
|
-
|
|
2117
|
-
type:
|
|
2118
|
-
serverLabel:
|
|
2119
|
-
name:
|
|
2120
|
-
arguments:
|
|
2121
|
-
approvalRequestId:
|
|
2152
|
+
import_v417.z.object({
|
|
2153
|
+
type: import_v417.z.literal("approvalRequest"),
|
|
2154
|
+
serverLabel: import_v417.z.string(),
|
|
2155
|
+
name: import_v417.z.string(),
|
|
2156
|
+
arguments: import_v417.z.string(),
|
|
2157
|
+
approvalRequestId: import_v417.z.string()
|
|
2122
2158
|
})
|
|
2123
2159
|
])
|
|
2124
2160
|
)
|
|
2125
2161
|
);
|
|
2126
|
-
var mcpToolFactory = (0,
|
|
2162
|
+
var mcpToolFactory = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
|
|
2127
2163
|
id: "openai.mcp",
|
|
2128
2164
|
inputSchema: mcpInputSchema,
|
|
2129
2165
|
outputSchema: mcpOutputSchema
|
|
@@ -2183,6 +2219,18 @@ var openaiTools = {
|
|
|
2183
2219
|
* Supported models: `gpt-5-codex` and `codex-mini-latest`
|
|
2184
2220
|
*/
|
|
2185
2221
|
localShell,
|
|
2222
|
+
/**
|
|
2223
|
+
* The shell tool allows the model to interact with your local computer through
|
|
2224
|
+
* a controlled command-line interface. The model proposes shell commands; your
|
|
2225
|
+
* integration executes them and returns the outputs.
|
|
2226
|
+
*
|
|
2227
|
+
* Available through the Responses API for use with GPT-5.1.
|
|
2228
|
+
*
|
|
2229
|
+
* WARNING: Running arbitrary shell commands can be dangerous. Always sandbox
|
|
2230
|
+
* execution or add strict allow-/deny-lists before forwarding a command to
|
|
2231
|
+
* the system shell.
|
|
2232
|
+
*/
|
|
2233
|
+
shell,
|
|
2186
2234
|
/**
|
|
2187
2235
|
* Web search allows models to access up-to-date information from the internet
|
|
2188
2236
|
* and provide answers with sourced citations.
|
|
@@ -2218,12 +2266,12 @@ var openaiTools = {
|
|
|
2218
2266
|
|
|
2219
2267
|
// src/responses/openai-responses-language-model.ts
|
|
2220
2268
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2221
|
-
var
|
|
2269
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
2222
2270
|
|
|
2223
2271
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2224
2272
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2225
|
-
var
|
|
2226
|
-
var
|
|
2273
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2274
|
+
var import_v418 = require("zod/v4");
|
|
2227
2275
|
function isFileId(data, prefixes) {
|
|
2228
2276
|
if (!prefixes) return false;
|
|
2229
2277
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2235,6 +2283,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2235
2283
|
fileIdPrefixes,
|
|
2236
2284
|
store,
|
|
2237
2285
|
hasLocalShellTool = false,
|
|
2286
|
+
hasShellTool = false,
|
|
2238
2287
|
hasApplyPatchTool = false
|
|
2239
2288
|
}) {
|
|
2240
2289
|
var _a, _b, _c, _d, _e;
|
|
@@ -2283,7 +2332,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2283
2332
|
return {
|
|
2284
2333
|
type: "input_image",
|
|
2285
2334
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2286
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2335
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils23.convertToBase64)(part.data)}`
|
|
2287
2336
|
},
|
|
2288
2337
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2289
2338
|
};
|
|
@@ -2298,7 +2347,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2298
2347
|
type: "input_file",
|
|
2299
2348
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2300
2349
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2301
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2350
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils23.convertToBase64)(part.data)}`
|
|
2302
2351
|
}
|
|
2303
2352
|
};
|
|
2304
2353
|
} else {
|
|
@@ -2342,7 +2391,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2342
2391
|
part.toolName
|
|
2343
2392
|
);
|
|
2344
2393
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2345
|
-
const parsedInput = await (0,
|
|
2394
|
+
const parsedInput = await (0, import_provider_utils23.validateTypes)({
|
|
2346
2395
|
value: part.input,
|
|
2347
2396
|
schema: localShellInputSchema
|
|
2348
2397
|
});
|
|
@@ -2361,6 +2410,24 @@ async function convertToOpenAIResponsesInput({
|
|
|
2361
2410
|
});
|
|
2362
2411
|
break;
|
|
2363
2412
|
}
|
|
2413
|
+
if (hasShellTool && resolvedToolName === "shell") {
|
|
2414
|
+
const parsedInput = await (0, import_provider_utils23.validateTypes)({
|
|
2415
|
+
value: part.input,
|
|
2416
|
+
schema: shellInputSchema
|
|
2417
|
+
});
|
|
2418
|
+
input.push({
|
|
2419
|
+
type: "shell_call",
|
|
2420
|
+
call_id: part.toolCallId,
|
|
2421
|
+
id,
|
|
2422
|
+
status: "completed",
|
|
2423
|
+
action: {
|
|
2424
|
+
commands: parsedInput.action.commands,
|
|
2425
|
+
timeout_ms: parsedInput.action.timeoutMs,
|
|
2426
|
+
max_output_length: parsedInput.action.maxOutputLength
|
|
2427
|
+
}
|
|
2428
|
+
});
|
|
2429
|
+
break;
|
|
2430
|
+
}
|
|
2364
2431
|
input.push({
|
|
2365
2432
|
type: "function_call",
|
|
2366
2433
|
call_id: part.toolCallId,
|
|
@@ -2383,7 +2450,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2383
2450
|
break;
|
|
2384
2451
|
}
|
|
2385
2452
|
case "reasoning": {
|
|
2386
|
-
const providerOptions = await (0,
|
|
2453
|
+
const providerOptions = await (0, import_provider_utils23.parseProviderOptions)({
|
|
2387
2454
|
provider: "openai",
|
|
2388
2455
|
providerOptions: part.providerOptions,
|
|
2389
2456
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2447,7 +2514,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2447
2514
|
part.toolName
|
|
2448
2515
|
);
|
|
2449
2516
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2450
|
-
const parsedOutput = await (0,
|
|
2517
|
+
const parsedOutput = await (0, import_provider_utils23.validateTypes)({
|
|
2451
2518
|
value: output.value,
|
|
2452
2519
|
schema: localShellOutputSchema
|
|
2453
2520
|
});
|
|
@@ -2458,8 +2525,27 @@ async function convertToOpenAIResponsesInput({
|
|
|
2458
2525
|
});
|
|
2459
2526
|
break;
|
|
2460
2527
|
}
|
|
2528
|
+
if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
|
|
2529
|
+
const parsedOutput = await (0, import_provider_utils23.validateTypes)({
|
|
2530
|
+
value: output.value,
|
|
2531
|
+
schema: shellOutputSchema
|
|
2532
|
+
});
|
|
2533
|
+
input.push({
|
|
2534
|
+
type: "shell_call_output",
|
|
2535
|
+
call_id: part.toolCallId,
|
|
2536
|
+
output: parsedOutput.output.map((item) => ({
|
|
2537
|
+
stdout: item.stdout,
|
|
2538
|
+
stderr: item.stderr,
|
|
2539
|
+
outcome: item.outcome.type === "timeout" ? { type: "timeout" } : {
|
|
2540
|
+
type: "exit",
|
|
2541
|
+
exit_code: item.outcome.exitCode
|
|
2542
|
+
}
|
|
2543
|
+
}))
|
|
2544
|
+
});
|
|
2545
|
+
break;
|
|
2546
|
+
}
|
|
2461
2547
|
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
2462
|
-
const parsedOutput = await (0,
|
|
2548
|
+
const parsedOutput = await (0, import_provider_utils23.validateTypes)({
|
|
2463
2549
|
value: output.value,
|
|
2464
2550
|
schema: applyPatchOutputSchema
|
|
2465
2551
|
});
|
|
@@ -2512,7 +2598,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2512
2598
|
return void 0;
|
|
2513
2599
|
}
|
|
2514
2600
|
}
|
|
2515
|
-
}).filter(
|
|
2601
|
+
}).filter(import_provider_utils23.isNonNullable);
|
|
2516
2602
|
break;
|
|
2517
2603
|
}
|
|
2518
2604
|
input.push({
|
|
@@ -2531,9 +2617,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2531
2617
|
}
|
|
2532
2618
|
return { input, warnings };
|
|
2533
2619
|
}
|
|
2534
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2535
|
-
itemId:
|
|
2536
|
-
reasoningEncryptedContent:
|
|
2620
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v418.z.object({
|
|
2621
|
+
itemId: import_v418.z.string().nullish(),
|
|
2622
|
+
reasoningEncryptedContent: import_v418.z.string().nullish()
|
|
2537
2623
|
});
|
|
2538
2624
|
|
|
2539
2625
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2555,393 +2641,411 @@ function mapOpenAIResponseFinishReason({
|
|
|
2555
2641
|
}
|
|
2556
2642
|
|
|
2557
2643
|
// src/responses/openai-responses-api.ts
|
|
2558
|
-
var
|
|
2559
|
-
var
|
|
2560
|
-
var openaiResponsesChunkSchema = (0,
|
|
2561
|
-
() => (0,
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
type:
|
|
2565
|
-
item_id:
|
|
2566
|
-
delta:
|
|
2567
|
-
logprobs:
|
|
2568
|
-
|
|
2569
|
-
token:
|
|
2570
|
-
logprob:
|
|
2571
|
-
top_logprobs:
|
|
2572
|
-
|
|
2573
|
-
token:
|
|
2574
|
-
logprob:
|
|
2644
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
2645
|
+
var import_v419 = require("zod/v4");
|
|
2646
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
2647
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2648
|
+
import_v419.z.union([
|
|
2649
|
+
import_v419.z.object({
|
|
2650
|
+
type: import_v419.z.literal("response.output_text.delta"),
|
|
2651
|
+
item_id: import_v419.z.string(),
|
|
2652
|
+
delta: import_v419.z.string(),
|
|
2653
|
+
logprobs: import_v419.z.array(
|
|
2654
|
+
import_v419.z.object({
|
|
2655
|
+
token: import_v419.z.string(),
|
|
2656
|
+
logprob: import_v419.z.number(),
|
|
2657
|
+
top_logprobs: import_v419.z.array(
|
|
2658
|
+
import_v419.z.object({
|
|
2659
|
+
token: import_v419.z.string(),
|
|
2660
|
+
logprob: import_v419.z.number()
|
|
2575
2661
|
})
|
|
2576
2662
|
)
|
|
2577
2663
|
})
|
|
2578
2664
|
).nullish()
|
|
2579
2665
|
}),
|
|
2580
|
-
|
|
2581
|
-
type:
|
|
2582
|
-
response:
|
|
2583
|
-
incomplete_details:
|
|
2584
|
-
usage:
|
|
2585
|
-
input_tokens:
|
|
2586
|
-
input_tokens_details:
|
|
2587
|
-
output_tokens:
|
|
2588
|
-
output_tokens_details:
|
|
2666
|
+
import_v419.z.object({
|
|
2667
|
+
type: import_v419.z.enum(["response.completed", "response.incomplete"]),
|
|
2668
|
+
response: import_v419.z.object({
|
|
2669
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
2670
|
+
usage: import_v419.z.object({
|
|
2671
|
+
input_tokens: import_v419.z.number(),
|
|
2672
|
+
input_tokens_details: import_v419.z.object({ cached_tokens: import_v419.z.number().nullish() }).nullish(),
|
|
2673
|
+
output_tokens: import_v419.z.number(),
|
|
2674
|
+
output_tokens_details: import_v419.z.object({ reasoning_tokens: import_v419.z.number().nullish() }).nullish()
|
|
2589
2675
|
}),
|
|
2590
|
-
service_tier:
|
|
2676
|
+
service_tier: import_v419.z.string().nullish()
|
|
2591
2677
|
})
|
|
2592
2678
|
}),
|
|
2593
|
-
|
|
2594
|
-
type:
|
|
2595
|
-
response:
|
|
2596
|
-
id:
|
|
2597
|
-
created_at:
|
|
2598
|
-
model:
|
|
2599
|
-
service_tier:
|
|
2679
|
+
import_v419.z.object({
|
|
2680
|
+
type: import_v419.z.literal("response.created"),
|
|
2681
|
+
response: import_v419.z.object({
|
|
2682
|
+
id: import_v419.z.string(),
|
|
2683
|
+
created_at: import_v419.z.number(),
|
|
2684
|
+
model: import_v419.z.string(),
|
|
2685
|
+
service_tier: import_v419.z.string().nullish()
|
|
2600
2686
|
})
|
|
2601
2687
|
}),
|
|
2602
|
-
|
|
2603
|
-
type:
|
|
2604
|
-
output_index:
|
|
2605
|
-
item:
|
|
2606
|
-
|
|
2607
|
-
type:
|
|
2608
|
-
id:
|
|
2688
|
+
import_v419.z.object({
|
|
2689
|
+
type: import_v419.z.literal("response.output_item.added"),
|
|
2690
|
+
output_index: import_v419.z.number(),
|
|
2691
|
+
item: import_v419.z.discriminatedUnion("type", [
|
|
2692
|
+
import_v419.z.object({
|
|
2693
|
+
type: import_v419.z.literal("message"),
|
|
2694
|
+
id: import_v419.z.string()
|
|
2609
2695
|
}),
|
|
2610
|
-
|
|
2611
|
-
type:
|
|
2612
|
-
id:
|
|
2613
|
-
encrypted_content:
|
|
2696
|
+
import_v419.z.object({
|
|
2697
|
+
type: import_v419.z.literal("reasoning"),
|
|
2698
|
+
id: import_v419.z.string(),
|
|
2699
|
+
encrypted_content: import_v419.z.string().nullish()
|
|
2614
2700
|
}),
|
|
2615
|
-
|
|
2616
|
-
type:
|
|
2617
|
-
id:
|
|
2618
|
-
call_id:
|
|
2619
|
-
name:
|
|
2620
|
-
arguments:
|
|
2701
|
+
import_v419.z.object({
|
|
2702
|
+
type: import_v419.z.literal("function_call"),
|
|
2703
|
+
id: import_v419.z.string(),
|
|
2704
|
+
call_id: import_v419.z.string(),
|
|
2705
|
+
name: import_v419.z.string(),
|
|
2706
|
+
arguments: import_v419.z.string()
|
|
2621
2707
|
}),
|
|
2622
|
-
|
|
2623
|
-
type:
|
|
2624
|
-
id:
|
|
2625
|
-
status:
|
|
2708
|
+
import_v419.z.object({
|
|
2709
|
+
type: import_v419.z.literal("web_search_call"),
|
|
2710
|
+
id: import_v419.z.string(),
|
|
2711
|
+
status: import_v419.z.string()
|
|
2626
2712
|
}),
|
|
2627
|
-
|
|
2628
|
-
type:
|
|
2629
|
-
id:
|
|
2630
|
-
status:
|
|
2713
|
+
import_v419.z.object({
|
|
2714
|
+
type: import_v419.z.literal("computer_call"),
|
|
2715
|
+
id: import_v419.z.string(),
|
|
2716
|
+
status: import_v419.z.string()
|
|
2631
2717
|
}),
|
|
2632
|
-
|
|
2633
|
-
type:
|
|
2634
|
-
id:
|
|
2718
|
+
import_v419.z.object({
|
|
2719
|
+
type: import_v419.z.literal("file_search_call"),
|
|
2720
|
+
id: import_v419.z.string()
|
|
2635
2721
|
}),
|
|
2636
|
-
|
|
2637
|
-
type:
|
|
2638
|
-
id:
|
|
2722
|
+
import_v419.z.object({
|
|
2723
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
2724
|
+
id: import_v419.z.string()
|
|
2639
2725
|
}),
|
|
2640
|
-
|
|
2641
|
-
type:
|
|
2642
|
-
id:
|
|
2643
|
-
container_id:
|
|
2644
|
-
code:
|
|
2645
|
-
outputs:
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2726
|
+
import_v419.z.object({
|
|
2727
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
2728
|
+
id: import_v419.z.string(),
|
|
2729
|
+
container_id: import_v419.z.string(),
|
|
2730
|
+
code: import_v419.z.string().nullable(),
|
|
2731
|
+
outputs: import_v419.z.array(
|
|
2732
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2733
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
2734
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
2649
2735
|
])
|
|
2650
2736
|
).nullable(),
|
|
2651
|
-
status:
|
|
2737
|
+
status: import_v419.z.string()
|
|
2652
2738
|
}),
|
|
2653
|
-
|
|
2654
|
-
type:
|
|
2655
|
-
id:
|
|
2656
|
-
status:
|
|
2739
|
+
import_v419.z.object({
|
|
2740
|
+
type: import_v419.z.literal("mcp_call"),
|
|
2741
|
+
id: import_v419.z.string(),
|
|
2742
|
+
status: import_v419.z.string()
|
|
2657
2743
|
}),
|
|
2658
|
-
|
|
2659
|
-
type:
|
|
2660
|
-
id:
|
|
2744
|
+
import_v419.z.object({
|
|
2745
|
+
type: import_v419.z.literal("mcp_list_tools"),
|
|
2746
|
+
id: import_v419.z.string()
|
|
2661
2747
|
}),
|
|
2662
|
-
|
|
2663
|
-
type:
|
|
2664
|
-
id:
|
|
2748
|
+
import_v419.z.object({
|
|
2749
|
+
type: import_v419.z.literal("mcp_approval_request"),
|
|
2750
|
+
id: import_v419.z.string()
|
|
2665
2751
|
}),
|
|
2666
|
-
|
|
2667
|
-
type:
|
|
2668
|
-
id:
|
|
2669
|
-
call_id:
|
|
2670
|
-
status:
|
|
2671
|
-
operation:
|
|
2672
|
-
|
|
2673
|
-
type:
|
|
2674
|
-
path:
|
|
2675
|
-
diff:
|
|
2752
|
+
import_v419.z.object({
|
|
2753
|
+
type: import_v419.z.literal("apply_patch_call"),
|
|
2754
|
+
id: import_v419.z.string(),
|
|
2755
|
+
call_id: import_v419.z.string(),
|
|
2756
|
+
status: import_v419.z.enum(["in_progress", "completed"]),
|
|
2757
|
+
operation: import_v419.z.discriminatedUnion("type", [
|
|
2758
|
+
import_v419.z.object({
|
|
2759
|
+
type: import_v419.z.literal("create_file"),
|
|
2760
|
+
path: import_v419.z.string(),
|
|
2761
|
+
diff: import_v419.z.string()
|
|
2676
2762
|
}),
|
|
2677
|
-
|
|
2678
|
-
type:
|
|
2679
|
-
path:
|
|
2763
|
+
import_v419.z.object({
|
|
2764
|
+
type: import_v419.z.literal("delete_file"),
|
|
2765
|
+
path: import_v419.z.string()
|
|
2680
2766
|
}),
|
|
2681
|
-
|
|
2682
|
-
type:
|
|
2683
|
-
path:
|
|
2684
|
-
diff:
|
|
2767
|
+
import_v419.z.object({
|
|
2768
|
+
type: import_v419.z.literal("update_file"),
|
|
2769
|
+
path: import_v419.z.string(),
|
|
2770
|
+
diff: import_v419.z.string()
|
|
2685
2771
|
})
|
|
2686
2772
|
])
|
|
2773
|
+
}),
|
|
2774
|
+
import_v419.z.object({
|
|
2775
|
+
type: import_v419.z.literal("shell_call"),
|
|
2776
|
+
id: import_v419.z.string(),
|
|
2777
|
+
call_id: import_v419.z.string(),
|
|
2778
|
+
status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
|
|
2779
|
+
action: import_v419.z.object({
|
|
2780
|
+
commands: import_v419.z.array(import_v419.z.string())
|
|
2781
|
+
})
|
|
2687
2782
|
})
|
|
2688
2783
|
])
|
|
2689
2784
|
}),
|
|
2690
|
-
|
|
2691
|
-
type:
|
|
2692
|
-
output_index:
|
|
2693
|
-
item:
|
|
2694
|
-
|
|
2695
|
-
type:
|
|
2696
|
-
id:
|
|
2785
|
+
import_v419.z.object({
|
|
2786
|
+
type: import_v419.z.literal("response.output_item.done"),
|
|
2787
|
+
output_index: import_v419.z.number(),
|
|
2788
|
+
item: import_v419.z.discriminatedUnion("type", [
|
|
2789
|
+
import_v419.z.object({
|
|
2790
|
+
type: import_v419.z.literal("message"),
|
|
2791
|
+
id: import_v419.z.string()
|
|
2697
2792
|
}),
|
|
2698
|
-
|
|
2699
|
-
type:
|
|
2700
|
-
id:
|
|
2701
|
-
encrypted_content:
|
|
2793
|
+
import_v419.z.object({
|
|
2794
|
+
type: import_v419.z.literal("reasoning"),
|
|
2795
|
+
id: import_v419.z.string(),
|
|
2796
|
+
encrypted_content: import_v419.z.string().nullish()
|
|
2702
2797
|
}),
|
|
2703
|
-
|
|
2704
|
-
type:
|
|
2705
|
-
id:
|
|
2706
|
-
call_id:
|
|
2707
|
-
name:
|
|
2708
|
-
arguments:
|
|
2709
|
-
status:
|
|
2798
|
+
import_v419.z.object({
|
|
2799
|
+
type: import_v419.z.literal("function_call"),
|
|
2800
|
+
id: import_v419.z.string(),
|
|
2801
|
+
call_id: import_v419.z.string(),
|
|
2802
|
+
name: import_v419.z.string(),
|
|
2803
|
+
arguments: import_v419.z.string(),
|
|
2804
|
+
status: import_v419.z.literal("completed")
|
|
2710
2805
|
}),
|
|
2711
|
-
|
|
2712
|
-
type:
|
|
2713
|
-
id:
|
|
2714
|
-
code:
|
|
2715
|
-
container_id:
|
|
2716
|
-
outputs:
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2806
|
+
import_v419.z.object({
|
|
2807
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
2808
|
+
id: import_v419.z.string(),
|
|
2809
|
+
code: import_v419.z.string().nullable(),
|
|
2810
|
+
container_id: import_v419.z.string(),
|
|
2811
|
+
outputs: import_v419.z.array(
|
|
2812
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2813
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
2814
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
2720
2815
|
])
|
|
2721
2816
|
).nullable()
|
|
2722
2817
|
}),
|
|
2723
|
-
|
|
2724
|
-
type:
|
|
2725
|
-
id:
|
|
2726
|
-
result:
|
|
2818
|
+
import_v419.z.object({
|
|
2819
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
2820
|
+
id: import_v419.z.string(),
|
|
2821
|
+
result: import_v419.z.string()
|
|
2727
2822
|
}),
|
|
2728
|
-
|
|
2729
|
-
type:
|
|
2730
|
-
id:
|
|
2731
|
-
status:
|
|
2732
|
-
action:
|
|
2733
|
-
|
|
2734
|
-
type:
|
|
2735
|
-
query:
|
|
2736
|
-
sources:
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2823
|
+
import_v419.z.object({
|
|
2824
|
+
type: import_v419.z.literal("web_search_call"),
|
|
2825
|
+
id: import_v419.z.string(),
|
|
2826
|
+
status: import_v419.z.string(),
|
|
2827
|
+
action: import_v419.z.discriminatedUnion("type", [
|
|
2828
|
+
import_v419.z.object({
|
|
2829
|
+
type: import_v419.z.literal("search"),
|
|
2830
|
+
query: import_v419.z.string().nullish(),
|
|
2831
|
+
sources: import_v419.z.array(
|
|
2832
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2833
|
+
import_v419.z.object({ type: import_v419.z.literal("url"), url: import_v419.z.string() }),
|
|
2834
|
+
import_v419.z.object({ type: import_v419.z.literal("api"), name: import_v419.z.string() })
|
|
2740
2835
|
])
|
|
2741
2836
|
).nullish()
|
|
2742
2837
|
}),
|
|
2743
|
-
|
|
2744
|
-
type:
|
|
2745
|
-
url:
|
|
2838
|
+
import_v419.z.object({
|
|
2839
|
+
type: import_v419.z.literal("open_page"),
|
|
2840
|
+
url: import_v419.z.string().nullish()
|
|
2746
2841
|
}),
|
|
2747
|
-
|
|
2748
|
-
type:
|
|
2749
|
-
url:
|
|
2750
|
-
pattern:
|
|
2842
|
+
import_v419.z.object({
|
|
2843
|
+
type: import_v419.z.literal("find"),
|
|
2844
|
+
url: import_v419.z.string().nullish(),
|
|
2845
|
+
pattern: import_v419.z.string().nullish()
|
|
2751
2846
|
})
|
|
2752
2847
|
])
|
|
2753
2848
|
}),
|
|
2754
|
-
|
|
2755
|
-
type:
|
|
2756
|
-
id:
|
|
2757
|
-
queries:
|
|
2758
|
-
results:
|
|
2759
|
-
|
|
2760
|
-
attributes:
|
|
2761
|
-
|
|
2762
|
-
|
|
2849
|
+
import_v419.z.object({
|
|
2850
|
+
type: import_v419.z.literal("file_search_call"),
|
|
2851
|
+
id: import_v419.z.string(),
|
|
2852
|
+
queries: import_v419.z.array(import_v419.z.string()),
|
|
2853
|
+
results: import_v419.z.array(
|
|
2854
|
+
import_v419.z.object({
|
|
2855
|
+
attributes: import_v419.z.record(
|
|
2856
|
+
import_v419.z.string(),
|
|
2857
|
+
import_v419.z.union([import_v419.z.string(), import_v419.z.number(), import_v419.z.boolean()])
|
|
2763
2858
|
),
|
|
2764
|
-
file_id:
|
|
2765
|
-
filename:
|
|
2766
|
-
score:
|
|
2767
|
-
text:
|
|
2859
|
+
file_id: import_v419.z.string(),
|
|
2860
|
+
filename: import_v419.z.string(),
|
|
2861
|
+
score: import_v419.z.number(),
|
|
2862
|
+
text: import_v419.z.string()
|
|
2768
2863
|
})
|
|
2769
2864
|
).nullish()
|
|
2770
2865
|
}),
|
|
2771
|
-
|
|
2772
|
-
type:
|
|
2773
|
-
id:
|
|
2774
|
-
call_id:
|
|
2775
|
-
action:
|
|
2776
|
-
type:
|
|
2777
|
-
command:
|
|
2778
|
-
timeout_ms:
|
|
2779
|
-
user:
|
|
2780
|
-
working_directory:
|
|
2781
|
-
env:
|
|
2866
|
+
import_v419.z.object({
|
|
2867
|
+
type: import_v419.z.literal("local_shell_call"),
|
|
2868
|
+
id: import_v419.z.string(),
|
|
2869
|
+
call_id: import_v419.z.string(),
|
|
2870
|
+
action: import_v419.z.object({
|
|
2871
|
+
type: import_v419.z.literal("exec"),
|
|
2872
|
+
command: import_v419.z.array(import_v419.z.string()),
|
|
2873
|
+
timeout_ms: import_v419.z.number().optional(),
|
|
2874
|
+
user: import_v419.z.string().optional(),
|
|
2875
|
+
working_directory: import_v419.z.string().optional(),
|
|
2876
|
+
env: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional()
|
|
2782
2877
|
})
|
|
2783
2878
|
}),
|
|
2784
|
-
|
|
2785
|
-
type:
|
|
2786
|
-
id:
|
|
2787
|
-
status:
|
|
2879
|
+
import_v419.z.object({
|
|
2880
|
+
type: import_v419.z.literal("computer_call"),
|
|
2881
|
+
id: import_v419.z.string(),
|
|
2882
|
+
status: import_v419.z.literal("completed")
|
|
2788
2883
|
}),
|
|
2789
|
-
|
|
2790
|
-
type:
|
|
2791
|
-
id:
|
|
2792
|
-
status:
|
|
2793
|
-
arguments:
|
|
2794
|
-
name:
|
|
2795
|
-
server_label:
|
|
2796
|
-
output:
|
|
2797
|
-
error:
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
type:
|
|
2801
|
-
code:
|
|
2802
|
-
message:
|
|
2884
|
+
import_v419.z.object({
|
|
2885
|
+
type: import_v419.z.literal("mcp_call"),
|
|
2886
|
+
id: import_v419.z.string(),
|
|
2887
|
+
status: import_v419.z.string(),
|
|
2888
|
+
arguments: import_v419.z.string(),
|
|
2889
|
+
name: import_v419.z.string(),
|
|
2890
|
+
server_label: import_v419.z.string(),
|
|
2891
|
+
output: import_v419.z.string().nullish(),
|
|
2892
|
+
error: import_v419.z.union([
|
|
2893
|
+
import_v419.z.string(),
|
|
2894
|
+
import_v419.z.object({
|
|
2895
|
+
type: import_v419.z.string().optional(),
|
|
2896
|
+
code: import_v419.z.union([import_v419.z.number(), import_v419.z.string()]).optional(),
|
|
2897
|
+
message: import_v419.z.string().optional()
|
|
2803
2898
|
}).loose()
|
|
2804
2899
|
]).nullish()
|
|
2805
2900
|
}),
|
|
2806
|
-
|
|
2807
|
-
type:
|
|
2808
|
-
id:
|
|
2809
|
-
server_label:
|
|
2810
|
-
tools:
|
|
2811
|
-
|
|
2812
|
-
name:
|
|
2813
|
-
description:
|
|
2814
|
-
input_schema:
|
|
2815
|
-
annotations:
|
|
2901
|
+
import_v419.z.object({
|
|
2902
|
+
type: import_v419.z.literal("mcp_list_tools"),
|
|
2903
|
+
id: import_v419.z.string(),
|
|
2904
|
+
server_label: import_v419.z.string(),
|
|
2905
|
+
tools: import_v419.z.array(
|
|
2906
|
+
import_v419.z.object({
|
|
2907
|
+
name: import_v419.z.string(),
|
|
2908
|
+
description: import_v419.z.string().optional(),
|
|
2909
|
+
input_schema: import_v419.z.any(),
|
|
2910
|
+
annotations: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()).optional()
|
|
2816
2911
|
})
|
|
2817
2912
|
),
|
|
2818
|
-
error:
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
type:
|
|
2822
|
-
code:
|
|
2823
|
-
message:
|
|
2913
|
+
error: import_v419.z.union([
|
|
2914
|
+
import_v419.z.string(),
|
|
2915
|
+
import_v419.z.object({
|
|
2916
|
+
type: import_v419.z.string().optional(),
|
|
2917
|
+
code: import_v419.z.union([import_v419.z.number(), import_v419.z.string()]).optional(),
|
|
2918
|
+
message: import_v419.z.string().optional()
|
|
2824
2919
|
}).loose()
|
|
2825
2920
|
]).optional()
|
|
2826
2921
|
}),
|
|
2827
|
-
|
|
2828
|
-
type:
|
|
2829
|
-
id:
|
|
2830
|
-
server_label:
|
|
2831
|
-
name:
|
|
2832
|
-
arguments:
|
|
2833
|
-
approval_request_id:
|
|
2922
|
+
import_v419.z.object({
|
|
2923
|
+
type: import_v419.z.literal("mcp_approval_request"),
|
|
2924
|
+
id: import_v419.z.string(),
|
|
2925
|
+
server_label: import_v419.z.string(),
|
|
2926
|
+
name: import_v419.z.string(),
|
|
2927
|
+
arguments: import_v419.z.string(),
|
|
2928
|
+
approval_request_id: import_v419.z.string()
|
|
2834
2929
|
}),
|
|
2835
|
-
|
|
2836
|
-
type:
|
|
2837
|
-
id:
|
|
2838
|
-
call_id:
|
|
2839
|
-
status:
|
|
2840
|
-
operation:
|
|
2841
|
-
|
|
2842
|
-
type:
|
|
2843
|
-
path:
|
|
2844
|
-
diff:
|
|
2930
|
+
import_v419.z.object({
|
|
2931
|
+
type: import_v419.z.literal("apply_patch_call"),
|
|
2932
|
+
id: import_v419.z.string(),
|
|
2933
|
+
call_id: import_v419.z.string(),
|
|
2934
|
+
status: import_v419.z.enum(["in_progress", "completed"]),
|
|
2935
|
+
operation: import_v419.z.discriminatedUnion("type", [
|
|
2936
|
+
import_v419.z.object({
|
|
2937
|
+
type: import_v419.z.literal("create_file"),
|
|
2938
|
+
path: import_v419.z.string(),
|
|
2939
|
+
diff: import_v419.z.string()
|
|
2845
2940
|
}),
|
|
2846
|
-
|
|
2847
|
-
type:
|
|
2848
|
-
path:
|
|
2941
|
+
import_v419.z.object({
|
|
2942
|
+
type: import_v419.z.literal("delete_file"),
|
|
2943
|
+
path: import_v419.z.string()
|
|
2849
2944
|
}),
|
|
2850
|
-
|
|
2851
|
-
type:
|
|
2852
|
-
path:
|
|
2853
|
-
diff:
|
|
2945
|
+
import_v419.z.object({
|
|
2946
|
+
type: import_v419.z.literal("update_file"),
|
|
2947
|
+
path: import_v419.z.string(),
|
|
2948
|
+
diff: import_v419.z.string()
|
|
2854
2949
|
})
|
|
2855
2950
|
])
|
|
2951
|
+
}),
|
|
2952
|
+
import_v419.z.object({
|
|
2953
|
+
type: import_v419.z.literal("shell_call"),
|
|
2954
|
+
id: import_v419.z.string(),
|
|
2955
|
+
call_id: import_v419.z.string(),
|
|
2956
|
+
status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
|
|
2957
|
+
action: import_v419.z.object({
|
|
2958
|
+
commands: import_v419.z.array(import_v419.z.string())
|
|
2959
|
+
})
|
|
2856
2960
|
})
|
|
2857
2961
|
])
|
|
2858
2962
|
}),
|
|
2859
|
-
|
|
2860
|
-
type:
|
|
2861
|
-
item_id:
|
|
2862
|
-
output_index:
|
|
2863
|
-
delta:
|
|
2963
|
+
import_v419.z.object({
|
|
2964
|
+
type: import_v419.z.literal("response.function_call_arguments.delta"),
|
|
2965
|
+
item_id: import_v419.z.string(),
|
|
2966
|
+
output_index: import_v419.z.number(),
|
|
2967
|
+
delta: import_v419.z.string()
|
|
2864
2968
|
}),
|
|
2865
|
-
|
|
2866
|
-
type:
|
|
2867
|
-
item_id:
|
|
2868
|
-
output_index:
|
|
2869
|
-
partial_image_b64:
|
|
2969
|
+
import_v419.z.object({
|
|
2970
|
+
type: import_v419.z.literal("response.image_generation_call.partial_image"),
|
|
2971
|
+
item_id: import_v419.z.string(),
|
|
2972
|
+
output_index: import_v419.z.number(),
|
|
2973
|
+
partial_image_b64: import_v419.z.string()
|
|
2870
2974
|
}),
|
|
2871
|
-
|
|
2872
|
-
type:
|
|
2873
|
-
item_id:
|
|
2874
|
-
output_index:
|
|
2875
|
-
delta:
|
|
2975
|
+
import_v419.z.object({
|
|
2976
|
+
type: import_v419.z.literal("response.code_interpreter_call_code.delta"),
|
|
2977
|
+
item_id: import_v419.z.string(),
|
|
2978
|
+
output_index: import_v419.z.number(),
|
|
2979
|
+
delta: import_v419.z.string()
|
|
2876
2980
|
}),
|
|
2877
|
-
|
|
2878
|
-
type:
|
|
2879
|
-
item_id:
|
|
2880
|
-
output_index:
|
|
2881
|
-
code:
|
|
2981
|
+
import_v419.z.object({
|
|
2982
|
+
type: import_v419.z.literal("response.code_interpreter_call_code.done"),
|
|
2983
|
+
item_id: import_v419.z.string(),
|
|
2984
|
+
output_index: import_v419.z.number(),
|
|
2985
|
+
code: import_v419.z.string()
|
|
2882
2986
|
}),
|
|
2883
|
-
|
|
2884
|
-
type:
|
|
2885
|
-
annotation:
|
|
2886
|
-
|
|
2887
|
-
type:
|
|
2888
|
-
start_index:
|
|
2889
|
-
end_index:
|
|
2890
|
-
url:
|
|
2891
|
-
title:
|
|
2987
|
+
import_v419.z.object({
|
|
2988
|
+
type: import_v419.z.literal("response.output_text.annotation.added"),
|
|
2989
|
+
annotation: import_v419.z.discriminatedUnion("type", [
|
|
2990
|
+
import_v419.z.object({
|
|
2991
|
+
type: import_v419.z.literal("url_citation"),
|
|
2992
|
+
start_index: import_v419.z.number(),
|
|
2993
|
+
end_index: import_v419.z.number(),
|
|
2994
|
+
url: import_v419.z.string(),
|
|
2995
|
+
title: import_v419.z.string()
|
|
2892
2996
|
}),
|
|
2893
|
-
|
|
2894
|
-
type:
|
|
2895
|
-
file_id:
|
|
2896
|
-
filename:
|
|
2897
|
-
index:
|
|
2898
|
-
start_index:
|
|
2899
|
-
end_index:
|
|
2900
|
-
quote:
|
|
2997
|
+
import_v419.z.object({
|
|
2998
|
+
type: import_v419.z.literal("file_citation"),
|
|
2999
|
+
file_id: import_v419.z.string(),
|
|
3000
|
+
filename: import_v419.z.string().nullish(),
|
|
3001
|
+
index: import_v419.z.number().nullish(),
|
|
3002
|
+
start_index: import_v419.z.number().nullish(),
|
|
3003
|
+
end_index: import_v419.z.number().nullish(),
|
|
3004
|
+
quote: import_v419.z.string().nullish()
|
|
2901
3005
|
}),
|
|
2902
|
-
|
|
2903
|
-
type:
|
|
2904
|
-
container_id:
|
|
2905
|
-
file_id:
|
|
2906
|
-
filename:
|
|
2907
|
-
start_index:
|
|
2908
|
-
end_index:
|
|
2909
|
-
index:
|
|
3006
|
+
import_v419.z.object({
|
|
3007
|
+
type: import_v419.z.literal("container_file_citation"),
|
|
3008
|
+
container_id: import_v419.z.string(),
|
|
3009
|
+
file_id: import_v419.z.string(),
|
|
3010
|
+
filename: import_v419.z.string().nullish(),
|
|
3011
|
+
start_index: import_v419.z.number().nullish(),
|
|
3012
|
+
end_index: import_v419.z.number().nullish(),
|
|
3013
|
+
index: import_v419.z.number().nullish()
|
|
2910
3014
|
}),
|
|
2911
|
-
|
|
2912
|
-
type:
|
|
2913
|
-
file_id:
|
|
2914
|
-
index:
|
|
3015
|
+
import_v419.z.object({
|
|
3016
|
+
type: import_v419.z.literal("file_path"),
|
|
3017
|
+
file_id: import_v419.z.string(),
|
|
3018
|
+
index: import_v419.z.number().nullish()
|
|
2915
3019
|
})
|
|
2916
3020
|
])
|
|
2917
3021
|
}),
|
|
2918
|
-
|
|
2919
|
-
type:
|
|
2920
|
-
item_id:
|
|
2921
|
-
summary_index:
|
|
3022
|
+
import_v419.z.object({
|
|
3023
|
+
type: import_v419.z.literal("response.reasoning_summary_part.added"),
|
|
3024
|
+
item_id: import_v419.z.string(),
|
|
3025
|
+
summary_index: import_v419.z.number()
|
|
2922
3026
|
}),
|
|
2923
|
-
|
|
2924
|
-
type:
|
|
2925
|
-
item_id:
|
|
2926
|
-
summary_index:
|
|
2927
|
-
delta:
|
|
3027
|
+
import_v419.z.object({
|
|
3028
|
+
type: import_v419.z.literal("response.reasoning_summary_text.delta"),
|
|
3029
|
+
item_id: import_v419.z.string(),
|
|
3030
|
+
summary_index: import_v419.z.number(),
|
|
3031
|
+
delta: import_v419.z.string()
|
|
2928
3032
|
}),
|
|
2929
|
-
|
|
2930
|
-
type:
|
|
2931
|
-
item_id:
|
|
2932
|
-
summary_index:
|
|
3033
|
+
import_v419.z.object({
|
|
3034
|
+
type: import_v419.z.literal("response.reasoning_summary_part.done"),
|
|
3035
|
+
item_id: import_v419.z.string(),
|
|
3036
|
+
summary_index: import_v419.z.number()
|
|
2933
3037
|
}),
|
|
2934
|
-
|
|
2935
|
-
type:
|
|
2936
|
-
sequence_number:
|
|
2937
|
-
error:
|
|
2938
|
-
type:
|
|
2939
|
-
code:
|
|
2940
|
-
message:
|
|
2941
|
-
param:
|
|
3038
|
+
import_v419.z.object({
|
|
3039
|
+
type: import_v419.z.literal("error"),
|
|
3040
|
+
sequence_number: import_v419.z.number(),
|
|
3041
|
+
error: import_v419.z.object({
|
|
3042
|
+
type: import_v419.z.string(),
|
|
3043
|
+
code: import_v419.z.string(),
|
|
3044
|
+
message: import_v419.z.string(),
|
|
3045
|
+
param: import_v419.z.string().nullish()
|
|
2942
3046
|
})
|
|
2943
3047
|
}),
|
|
2944
|
-
|
|
3048
|
+
import_v419.z.object({ type: import_v419.z.string() }).loose().transform((value) => ({
|
|
2945
3049
|
type: "unknown_chunk",
|
|
2946
3050
|
message: value.type
|
|
2947
3051
|
}))
|
|
@@ -2949,258 +3053,267 @@ var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
2949
3053
|
])
|
|
2950
3054
|
)
|
|
2951
3055
|
);
|
|
2952
|
-
var openaiResponsesResponseSchema = (0,
|
|
2953
|
-
() => (0,
|
|
2954
|
-
|
|
2955
|
-
id:
|
|
2956
|
-
created_at:
|
|
2957
|
-
error:
|
|
2958
|
-
message:
|
|
2959
|
-
type:
|
|
2960
|
-
param:
|
|
2961
|
-
code:
|
|
3056
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
|
|
3057
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3058
|
+
import_v419.z.object({
|
|
3059
|
+
id: import_v419.z.string().optional(),
|
|
3060
|
+
created_at: import_v419.z.number().optional(),
|
|
3061
|
+
error: import_v419.z.object({
|
|
3062
|
+
message: import_v419.z.string(),
|
|
3063
|
+
type: import_v419.z.string(),
|
|
3064
|
+
param: import_v419.z.string().nullish(),
|
|
3065
|
+
code: import_v419.z.string()
|
|
2962
3066
|
}).nullish(),
|
|
2963
|
-
model:
|
|
2964
|
-
output:
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
type:
|
|
2968
|
-
role:
|
|
2969
|
-
id:
|
|
2970
|
-
content:
|
|
2971
|
-
|
|
2972
|
-
type:
|
|
2973
|
-
text:
|
|
2974
|
-
logprobs:
|
|
2975
|
-
|
|
2976
|
-
token:
|
|
2977
|
-
logprob:
|
|
2978
|
-
top_logprobs:
|
|
2979
|
-
|
|
2980
|
-
token:
|
|
2981
|
-
logprob:
|
|
3067
|
+
model: import_v419.z.string().optional(),
|
|
3068
|
+
output: import_v419.z.array(
|
|
3069
|
+
import_v419.z.discriminatedUnion("type", [
|
|
3070
|
+
import_v419.z.object({
|
|
3071
|
+
type: import_v419.z.literal("message"),
|
|
3072
|
+
role: import_v419.z.literal("assistant"),
|
|
3073
|
+
id: import_v419.z.string(),
|
|
3074
|
+
content: import_v419.z.array(
|
|
3075
|
+
import_v419.z.object({
|
|
3076
|
+
type: import_v419.z.literal("output_text"),
|
|
3077
|
+
text: import_v419.z.string(),
|
|
3078
|
+
logprobs: import_v419.z.array(
|
|
3079
|
+
import_v419.z.object({
|
|
3080
|
+
token: import_v419.z.string(),
|
|
3081
|
+
logprob: import_v419.z.number(),
|
|
3082
|
+
top_logprobs: import_v419.z.array(
|
|
3083
|
+
import_v419.z.object({
|
|
3084
|
+
token: import_v419.z.string(),
|
|
3085
|
+
logprob: import_v419.z.number()
|
|
2982
3086
|
})
|
|
2983
3087
|
)
|
|
2984
3088
|
})
|
|
2985
3089
|
).nullish(),
|
|
2986
|
-
annotations:
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
type:
|
|
2990
|
-
start_index:
|
|
2991
|
-
end_index:
|
|
2992
|
-
url:
|
|
2993
|
-
title:
|
|
3090
|
+
annotations: import_v419.z.array(
|
|
3091
|
+
import_v419.z.discriminatedUnion("type", [
|
|
3092
|
+
import_v419.z.object({
|
|
3093
|
+
type: import_v419.z.literal("url_citation"),
|
|
3094
|
+
start_index: import_v419.z.number(),
|
|
3095
|
+
end_index: import_v419.z.number(),
|
|
3096
|
+
url: import_v419.z.string(),
|
|
3097
|
+
title: import_v419.z.string()
|
|
2994
3098
|
}),
|
|
2995
|
-
|
|
2996
|
-
type:
|
|
2997
|
-
file_id:
|
|
2998
|
-
filename:
|
|
2999
|
-
index:
|
|
3000
|
-
start_index:
|
|
3001
|
-
end_index:
|
|
3002
|
-
quote:
|
|
3099
|
+
import_v419.z.object({
|
|
3100
|
+
type: import_v419.z.literal("file_citation"),
|
|
3101
|
+
file_id: import_v419.z.string(),
|
|
3102
|
+
filename: import_v419.z.string().nullish(),
|
|
3103
|
+
index: import_v419.z.number().nullish(),
|
|
3104
|
+
start_index: import_v419.z.number().nullish(),
|
|
3105
|
+
end_index: import_v419.z.number().nullish(),
|
|
3106
|
+
quote: import_v419.z.string().nullish()
|
|
3003
3107
|
}),
|
|
3004
|
-
|
|
3005
|
-
type:
|
|
3006
|
-
container_id:
|
|
3007
|
-
file_id:
|
|
3008
|
-
filename:
|
|
3009
|
-
start_index:
|
|
3010
|
-
end_index:
|
|
3011
|
-
index:
|
|
3108
|
+
import_v419.z.object({
|
|
3109
|
+
type: import_v419.z.literal("container_file_citation"),
|
|
3110
|
+
container_id: import_v419.z.string(),
|
|
3111
|
+
file_id: import_v419.z.string(),
|
|
3112
|
+
filename: import_v419.z.string().nullish(),
|
|
3113
|
+
start_index: import_v419.z.number().nullish(),
|
|
3114
|
+
end_index: import_v419.z.number().nullish(),
|
|
3115
|
+
index: import_v419.z.number().nullish()
|
|
3012
3116
|
}),
|
|
3013
|
-
|
|
3014
|
-
type:
|
|
3015
|
-
file_id:
|
|
3016
|
-
index:
|
|
3117
|
+
import_v419.z.object({
|
|
3118
|
+
type: import_v419.z.literal("file_path"),
|
|
3119
|
+
file_id: import_v419.z.string(),
|
|
3120
|
+
index: import_v419.z.number().nullish()
|
|
3017
3121
|
})
|
|
3018
3122
|
])
|
|
3019
3123
|
)
|
|
3020
3124
|
})
|
|
3021
3125
|
)
|
|
3022
3126
|
}),
|
|
3023
|
-
|
|
3024
|
-
type:
|
|
3025
|
-
id:
|
|
3026
|
-
status:
|
|
3027
|
-
action:
|
|
3028
|
-
|
|
3029
|
-
type:
|
|
3030
|
-
query:
|
|
3031
|
-
sources:
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3127
|
+
import_v419.z.object({
|
|
3128
|
+
type: import_v419.z.literal("web_search_call"),
|
|
3129
|
+
id: import_v419.z.string(),
|
|
3130
|
+
status: import_v419.z.string(),
|
|
3131
|
+
action: import_v419.z.discriminatedUnion("type", [
|
|
3132
|
+
import_v419.z.object({
|
|
3133
|
+
type: import_v419.z.literal("search"),
|
|
3134
|
+
query: import_v419.z.string().nullish(),
|
|
3135
|
+
sources: import_v419.z.array(
|
|
3136
|
+
import_v419.z.discriminatedUnion("type", [
|
|
3137
|
+
import_v419.z.object({ type: import_v419.z.literal("url"), url: import_v419.z.string() }),
|
|
3138
|
+
import_v419.z.object({ type: import_v419.z.literal("api"), name: import_v419.z.string() })
|
|
3035
3139
|
])
|
|
3036
3140
|
).nullish()
|
|
3037
3141
|
}),
|
|
3038
|
-
|
|
3039
|
-
type:
|
|
3040
|
-
url:
|
|
3142
|
+
import_v419.z.object({
|
|
3143
|
+
type: import_v419.z.literal("open_page"),
|
|
3144
|
+
url: import_v419.z.string().nullish()
|
|
3041
3145
|
}),
|
|
3042
|
-
|
|
3043
|
-
type:
|
|
3044
|
-
url:
|
|
3045
|
-
pattern:
|
|
3146
|
+
import_v419.z.object({
|
|
3147
|
+
type: import_v419.z.literal("find"),
|
|
3148
|
+
url: import_v419.z.string().nullish(),
|
|
3149
|
+
pattern: import_v419.z.string().nullish()
|
|
3046
3150
|
})
|
|
3047
3151
|
])
|
|
3048
3152
|
}),
|
|
3049
|
-
|
|
3050
|
-
type:
|
|
3051
|
-
id:
|
|
3052
|
-
queries:
|
|
3053
|
-
results:
|
|
3054
|
-
|
|
3055
|
-
attributes:
|
|
3056
|
-
|
|
3057
|
-
|
|
3153
|
+
import_v419.z.object({
|
|
3154
|
+
type: import_v419.z.literal("file_search_call"),
|
|
3155
|
+
id: import_v419.z.string(),
|
|
3156
|
+
queries: import_v419.z.array(import_v419.z.string()),
|
|
3157
|
+
results: import_v419.z.array(
|
|
3158
|
+
import_v419.z.object({
|
|
3159
|
+
attributes: import_v419.z.record(
|
|
3160
|
+
import_v419.z.string(),
|
|
3161
|
+
import_v419.z.union([import_v419.z.string(), import_v419.z.number(), import_v419.z.boolean()])
|
|
3058
3162
|
),
|
|
3059
|
-
file_id:
|
|
3060
|
-
filename:
|
|
3061
|
-
score:
|
|
3062
|
-
text:
|
|
3163
|
+
file_id: import_v419.z.string(),
|
|
3164
|
+
filename: import_v419.z.string(),
|
|
3165
|
+
score: import_v419.z.number(),
|
|
3166
|
+
text: import_v419.z.string()
|
|
3063
3167
|
})
|
|
3064
3168
|
).nullish()
|
|
3065
3169
|
}),
|
|
3066
|
-
|
|
3067
|
-
type:
|
|
3068
|
-
id:
|
|
3069
|
-
code:
|
|
3070
|
-
container_id:
|
|
3071
|
-
outputs:
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3170
|
+
import_v419.z.object({
|
|
3171
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
3172
|
+
id: import_v419.z.string(),
|
|
3173
|
+
code: import_v419.z.string().nullable(),
|
|
3174
|
+
container_id: import_v419.z.string(),
|
|
3175
|
+
outputs: import_v419.z.array(
|
|
3176
|
+
import_v419.z.discriminatedUnion("type", [
|
|
3177
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
3178
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
3075
3179
|
])
|
|
3076
3180
|
).nullable()
|
|
3077
3181
|
}),
|
|
3078
|
-
|
|
3079
|
-
type:
|
|
3080
|
-
id:
|
|
3081
|
-
result:
|
|
3182
|
+
import_v419.z.object({
|
|
3183
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
3184
|
+
id: import_v419.z.string(),
|
|
3185
|
+
result: import_v419.z.string()
|
|
3082
3186
|
}),
|
|
3083
|
-
|
|
3084
|
-
type:
|
|
3085
|
-
id:
|
|
3086
|
-
call_id:
|
|
3087
|
-
action:
|
|
3088
|
-
type:
|
|
3089
|
-
command:
|
|
3090
|
-
timeout_ms:
|
|
3091
|
-
user:
|
|
3092
|
-
working_directory:
|
|
3093
|
-
env:
|
|
3187
|
+
import_v419.z.object({
|
|
3188
|
+
type: import_v419.z.literal("local_shell_call"),
|
|
3189
|
+
id: import_v419.z.string(),
|
|
3190
|
+
call_id: import_v419.z.string(),
|
|
3191
|
+
action: import_v419.z.object({
|
|
3192
|
+
type: import_v419.z.literal("exec"),
|
|
3193
|
+
command: import_v419.z.array(import_v419.z.string()),
|
|
3194
|
+
timeout_ms: import_v419.z.number().optional(),
|
|
3195
|
+
user: import_v419.z.string().optional(),
|
|
3196
|
+
working_directory: import_v419.z.string().optional(),
|
|
3197
|
+
env: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional()
|
|
3094
3198
|
})
|
|
3095
3199
|
}),
|
|
3096
|
-
|
|
3097
|
-
type:
|
|
3098
|
-
call_id:
|
|
3099
|
-
name:
|
|
3100
|
-
arguments:
|
|
3101
|
-
id:
|
|
3200
|
+
import_v419.z.object({
|
|
3201
|
+
type: import_v419.z.literal("function_call"),
|
|
3202
|
+
call_id: import_v419.z.string(),
|
|
3203
|
+
name: import_v419.z.string(),
|
|
3204
|
+
arguments: import_v419.z.string(),
|
|
3205
|
+
id: import_v419.z.string()
|
|
3102
3206
|
}),
|
|
3103
|
-
|
|
3104
|
-
type:
|
|
3105
|
-
id:
|
|
3106
|
-
status:
|
|
3207
|
+
import_v419.z.object({
|
|
3208
|
+
type: import_v419.z.literal("computer_call"),
|
|
3209
|
+
id: import_v419.z.string(),
|
|
3210
|
+
status: import_v419.z.string().optional()
|
|
3107
3211
|
}),
|
|
3108
|
-
|
|
3109
|
-
type:
|
|
3110
|
-
id:
|
|
3111
|
-
encrypted_content:
|
|
3112
|
-
summary:
|
|
3113
|
-
|
|
3114
|
-
type:
|
|
3115
|
-
text:
|
|
3212
|
+
import_v419.z.object({
|
|
3213
|
+
type: import_v419.z.literal("reasoning"),
|
|
3214
|
+
id: import_v419.z.string(),
|
|
3215
|
+
encrypted_content: import_v419.z.string().nullish(),
|
|
3216
|
+
summary: import_v419.z.array(
|
|
3217
|
+
import_v419.z.object({
|
|
3218
|
+
type: import_v419.z.literal("summary_text"),
|
|
3219
|
+
text: import_v419.z.string()
|
|
3116
3220
|
})
|
|
3117
3221
|
)
|
|
3118
3222
|
}),
|
|
3119
|
-
|
|
3120
|
-
type:
|
|
3121
|
-
id:
|
|
3122
|
-
status:
|
|
3123
|
-
arguments:
|
|
3124
|
-
name:
|
|
3125
|
-
server_label:
|
|
3126
|
-
output:
|
|
3127
|
-
error:
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
type:
|
|
3131
|
-
code:
|
|
3132
|
-
message:
|
|
3223
|
+
import_v419.z.object({
|
|
3224
|
+
type: import_v419.z.literal("mcp_call"),
|
|
3225
|
+
id: import_v419.z.string(),
|
|
3226
|
+
status: import_v419.z.string(),
|
|
3227
|
+
arguments: import_v419.z.string(),
|
|
3228
|
+
name: import_v419.z.string(),
|
|
3229
|
+
server_label: import_v419.z.string(),
|
|
3230
|
+
output: import_v419.z.string().nullish(),
|
|
3231
|
+
error: import_v419.z.union([
|
|
3232
|
+
import_v419.z.string(),
|
|
3233
|
+
import_v419.z.object({
|
|
3234
|
+
type: import_v419.z.string().optional(),
|
|
3235
|
+
code: import_v419.z.union([import_v419.z.number(), import_v419.z.string()]).optional(),
|
|
3236
|
+
message: import_v419.z.string().optional()
|
|
3133
3237
|
}).loose()
|
|
3134
3238
|
]).nullish()
|
|
3135
3239
|
}),
|
|
3136
|
-
|
|
3137
|
-
type:
|
|
3138
|
-
id:
|
|
3139
|
-
server_label:
|
|
3140
|
-
tools:
|
|
3141
|
-
|
|
3142
|
-
name:
|
|
3143
|
-
description:
|
|
3144
|
-
input_schema:
|
|
3145
|
-
annotations:
|
|
3240
|
+
import_v419.z.object({
|
|
3241
|
+
type: import_v419.z.literal("mcp_list_tools"),
|
|
3242
|
+
id: import_v419.z.string(),
|
|
3243
|
+
server_label: import_v419.z.string(),
|
|
3244
|
+
tools: import_v419.z.array(
|
|
3245
|
+
import_v419.z.object({
|
|
3246
|
+
name: import_v419.z.string(),
|
|
3247
|
+
description: import_v419.z.string().optional(),
|
|
3248
|
+
input_schema: import_v419.z.any(),
|
|
3249
|
+
annotations: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()).optional()
|
|
3146
3250
|
})
|
|
3147
3251
|
),
|
|
3148
|
-
error:
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
type:
|
|
3152
|
-
code:
|
|
3153
|
-
message:
|
|
3252
|
+
error: import_v419.z.union([
|
|
3253
|
+
import_v419.z.string(),
|
|
3254
|
+
import_v419.z.object({
|
|
3255
|
+
type: import_v419.z.string().optional(),
|
|
3256
|
+
code: import_v419.z.union([import_v419.z.number(), import_v419.z.string()]).optional(),
|
|
3257
|
+
message: import_v419.z.string().optional()
|
|
3154
3258
|
}).loose()
|
|
3155
3259
|
]).optional()
|
|
3156
3260
|
}),
|
|
3157
|
-
|
|
3158
|
-
type:
|
|
3159
|
-
id:
|
|
3160
|
-
server_label:
|
|
3161
|
-
name:
|
|
3162
|
-
arguments:
|
|
3163
|
-
approval_request_id:
|
|
3261
|
+
import_v419.z.object({
|
|
3262
|
+
type: import_v419.z.literal("mcp_approval_request"),
|
|
3263
|
+
id: import_v419.z.string(),
|
|
3264
|
+
server_label: import_v419.z.string(),
|
|
3265
|
+
name: import_v419.z.string(),
|
|
3266
|
+
arguments: import_v419.z.string(),
|
|
3267
|
+
approval_request_id: import_v419.z.string()
|
|
3164
3268
|
}),
|
|
3165
|
-
|
|
3166
|
-
type:
|
|
3167
|
-
id:
|
|
3168
|
-
call_id:
|
|
3169
|
-
status:
|
|
3170
|
-
operation:
|
|
3171
|
-
|
|
3172
|
-
type:
|
|
3173
|
-
path:
|
|
3174
|
-
diff:
|
|
3269
|
+
import_v419.z.object({
|
|
3270
|
+
type: import_v419.z.literal("apply_patch_call"),
|
|
3271
|
+
id: import_v419.z.string(),
|
|
3272
|
+
call_id: import_v419.z.string(),
|
|
3273
|
+
status: import_v419.z.enum(["in_progress", "completed"]),
|
|
3274
|
+
operation: import_v419.z.discriminatedUnion("type", [
|
|
3275
|
+
import_v419.z.object({
|
|
3276
|
+
type: import_v419.z.literal("create_file"),
|
|
3277
|
+
path: import_v419.z.string(),
|
|
3278
|
+
diff: import_v419.z.string()
|
|
3175
3279
|
}),
|
|
3176
|
-
|
|
3177
|
-
type:
|
|
3178
|
-
path:
|
|
3280
|
+
import_v419.z.object({
|
|
3281
|
+
type: import_v419.z.literal("delete_file"),
|
|
3282
|
+
path: import_v419.z.string()
|
|
3179
3283
|
}),
|
|
3180
|
-
|
|
3181
|
-
type:
|
|
3182
|
-
path:
|
|
3183
|
-
diff:
|
|
3284
|
+
import_v419.z.object({
|
|
3285
|
+
type: import_v419.z.literal("update_file"),
|
|
3286
|
+
path: import_v419.z.string(),
|
|
3287
|
+
diff: import_v419.z.string()
|
|
3184
3288
|
})
|
|
3185
3289
|
])
|
|
3290
|
+
}),
|
|
3291
|
+
import_v419.z.object({
|
|
3292
|
+
type: import_v419.z.literal("shell_call"),
|
|
3293
|
+
id: import_v419.z.string(),
|
|
3294
|
+
call_id: import_v419.z.string(),
|
|
3295
|
+
status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3296
|
+
action: import_v419.z.object({
|
|
3297
|
+
commands: import_v419.z.array(import_v419.z.string())
|
|
3298
|
+
})
|
|
3186
3299
|
})
|
|
3187
3300
|
])
|
|
3188
3301
|
).optional(),
|
|
3189
|
-
service_tier:
|
|
3190
|
-
incomplete_details:
|
|
3191
|
-
usage:
|
|
3192
|
-
input_tokens:
|
|
3193
|
-
input_tokens_details:
|
|
3194
|
-
output_tokens:
|
|
3195
|
-
output_tokens_details:
|
|
3302
|
+
service_tier: import_v419.z.string().nullish(),
|
|
3303
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
3304
|
+
usage: import_v419.z.object({
|
|
3305
|
+
input_tokens: import_v419.z.number(),
|
|
3306
|
+
input_tokens_details: import_v419.z.object({ cached_tokens: import_v419.z.number().nullish() }).nullish(),
|
|
3307
|
+
output_tokens: import_v419.z.number(),
|
|
3308
|
+
output_tokens_details: import_v419.z.object({ reasoning_tokens: import_v419.z.number().nullish() }).nullish()
|
|
3196
3309
|
}).optional()
|
|
3197
3310
|
})
|
|
3198
3311
|
)
|
|
3199
3312
|
);
|
|
3200
3313
|
|
|
3201
3314
|
// src/responses/openai-responses-options.ts
|
|
3202
|
-
var
|
|
3203
|
-
var
|
|
3315
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
3316
|
+
var import_v420 = require("zod/v4");
|
|
3204
3317
|
var TOP_LOGPROBS_MAX = 20;
|
|
3205
3318
|
var openaiResponsesReasoningModelIds = [
|
|
3206
3319
|
"o1",
|
|
@@ -3267,9 +3380,9 @@ var openaiResponsesModelIds = [
|
|
|
3267
3380
|
"gpt-5-chat-latest",
|
|
3268
3381
|
...openaiResponsesReasoningModelIds
|
|
3269
3382
|
];
|
|
3270
|
-
var openaiResponsesProviderOptionsSchema = (0,
|
|
3271
|
-
() => (0,
|
|
3272
|
-
|
|
3383
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils25.lazySchema)(
|
|
3384
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
3385
|
+
import_v420.z.object({
|
|
3273
3386
|
/**
|
|
3274
3387
|
* The ID of the OpenAI Conversation to continue.
|
|
3275
3388
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -3277,13 +3390,13 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils24.lazySchem
|
|
|
3277
3390
|
* Defaults to `undefined`.
|
|
3278
3391
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3279
3392
|
*/
|
|
3280
|
-
conversation:
|
|
3393
|
+
conversation: import_v420.z.string().nullish(),
|
|
3281
3394
|
/**
|
|
3282
3395
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
3283
3396
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
3284
3397
|
*/
|
|
3285
|
-
include:
|
|
3286
|
-
|
|
3398
|
+
include: import_v420.z.array(
|
|
3399
|
+
import_v420.z.enum([
|
|
3287
3400
|
"reasoning.encrypted_content",
|
|
3288
3401
|
// handled internally by default, only needed for unknown reasoning models
|
|
3289
3402
|
"file_search_call.results",
|
|
@@ -3295,7 +3408,7 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils24.lazySchem
|
|
|
3295
3408
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
3296
3409
|
* Defaults to `undefined`.
|
|
3297
3410
|
*/
|
|
3298
|
-
instructions:
|
|
3411
|
+
instructions: import_v420.z.string().nullish(),
|
|
3299
3412
|
/**
|
|
3300
3413
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
3301
3414
|
* the response size and can slow down response times. However, it can
|
|
@@ -3310,30 +3423,30 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils24.lazySchem
|
|
|
3310
3423
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3311
3424
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3312
3425
|
*/
|
|
3313
|
-
logprobs:
|
|
3426
|
+
logprobs: import_v420.z.union([import_v420.z.boolean(), import_v420.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3314
3427
|
/**
|
|
3315
3428
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3316
3429
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3317
3430
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3318
3431
|
*/
|
|
3319
|
-
maxToolCalls:
|
|
3432
|
+
maxToolCalls: import_v420.z.number().nullish(),
|
|
3320
3433
|
/**
|
|
3321
3434
|
* Additional metadata to store with the generation.
|
|
3322
3435
|
*/
|
|
3323
|
-
metadata:
|
|
3436
|
+
metadata: import_v420.z.any().nullish(),
|
|
3324
3437
|
/**
|
|
3325
3438
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
3326
3439
|
*/
|
|
3327
|
-
parallelToolCalls:
|
|
3440
|
+
parallelToolCalls: import_v420.z.boolean().nullish(),
|
|
3328
3441
|
/**
|
|
3329
3442
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
3330
3443
|
* Defaults to `undefined`.
|
|
3331
3444
|
*/
|
|
3332
|
-
previousResponseId:
|
|
3445
|
+
previousResponseId: import_v420.z.string().nullish(),
|
|
3333
3446
|
/**
|
|
3334
3447
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
3335
3448
|
*/
|
|
3336
|
-
promptCacheKey:
|
|
3449
|
+
promptCacheKey: import_v420.z.string().nullish(),
|
|
3337
3450
|
/**
|
|
3338
3451
|
* The retention policy for the prompt cache.
|
|
3339
3452
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -3342,7 +3455,7 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils24.lazySchem
|
|
|
3342
3455
|
*
|
|
3343
3456
|
* @default 'in_memory'
|
|
3344
3457
|
*/
|
|
3345
|
-
promptCacheRetention:
|
|
3458
|
+
promptCacheRetention: import_v420.z.enum(["in_memory", "24h"]).nullish(),
|
|
3346
3459
|
/**
|
|
3347
3460
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3348
3461
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -3352,17 +3465,17 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils24.lazySchem
|
|
|
3352
3465
|
* models. Setting `reasoningEffort` to 'none' with other models will result in
|
|
3353
3466
|
* an error.
|
|
3354
3467
|
*/
|
|
3355
|
-
reasoningEffort:
|
|
3468
|
+
reasoningEffort: import_v420.z.string().nullish(),
|
|
3356
3469
|
/**
|
|
3357
3470
|
* Controls reasoning summary output from the model.
|
|
3358
3471
|
* Set to "auto" to automatically receive the richest level available,
|
|
3359
3472
|
* or "detailed" for comprehensive summaries.
|
|
3360
3473
|
*/
|
|
3361
|
-
reasoningSummary:
|
|
3474
|
+
reasoningSummary: import_v420.z.string().nullish(),
|
|
3362
3475
|
/**
|
|
3363
3476
|
* The identifier for safety monitoring and tracking.
|
|
3364
3477
|
*/
|
|
3365
|
-
safetyIdentifier:
|
|
3478
|
+
safetyIdentifier: import_v420.z.string().nullish(),
|
|
3366
3479
|
/**
|
|
3367
3480
|
* Service tier for the request.
|
|
3368
3481
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -3370,41 +3483,41 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils24.lazySchem
|
|
|
3370
3483
|
*
|
|
3371
3484
|
* Defaults to 'auto'.
|
|
3372
3485
|
*/
|
|
3373
|
-
serviceTier:
|
|
3486
|
+
serviceTier: import_v420.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3374
3487
|
/**
|
|
3375
3488
|
* Whether to store the generation. Defaults to `true`.
|
|
3376
3489
|
*/
|
|
3377
|
-
store:
|
|
3490
|
+
store: import_v420.z.boolean().nullish(),
|
|
3378
3491
|
/**
|
|
3379
3492
|
* Whether to use strict JSON schema validation.
|
|
3380
3493
|
* Defaults to `true`.
|
|
3381
3494
|
*/
|
|
3382
|
-
strictJsonSchema:
|
|
3495
|
+
strictJsonSchema: import_v420.z.boolean().nullish(),
|
|
3383
3496
|
/**
|
|
3384
3497
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
3385
3498
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
3386
3499
|
* Valid values: 'low', 'medium', 'high'.
|
|
3387
3500
|
*/
|
|
3388
|
-
textVerbosity:
|
|
3501
|
+
textVerbosity: import_v420.z.enum(["low", "medium", "high"]).nullish(),
|
|
3389
3502
|
/**
|
|
3390
3503
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
3391
3504
|
* 'disabled' turns truncation off.
|
|
3392
3505
|
*/
|
|
3393
|
-
truncation:
|
|
3506
|
+
truncation: import_v420.z.enum(["auto", "disabled"]).nullish(),
|
|
3394
3507
|
/**
|
|
3395
3508
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
3396
3509
|
* monitor and detect abuse.
|
|
3397
3510
|
* Defaults to `undefined`.
|
|
3398
3511
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
3399
3512
|
*/
|
|
3400
|
-
user:
|
|
3513
|
+
user: import_v420.z.string().nullish()
|
|
3401
3514
|
})
|
|
3402
3515
|
)
|
|
3403
3516
|
);
|
|
3404
3517
|
|
|
3405
3518
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3406
3519
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3407
|
-
var
|
|
3520
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
3408
3521
|
async function prepareResponsesTools({
|
|
3409
3522
|
tools,
|
|
3410
3523
|
toolChoice
|
|
@@ -3429,7 +3542,7 @@ async function prepareResponsesTools({
|
|
|
3429
3542
|
case "provider": {
|
|
3430
3543
|
switch (tool.id) {
|
|
3431
3544
|
case "openai.file_search": {
|
|
3432
|
-
const args = await (0,
|
|
3545
|
+
const args = await (0, import_provider_utils26.validateTypes)({
|
|
3433
3546
|
value: tool.args,
|
|
3434
3547
|
schema: fileSearchArgsSchema
|
|
3435
3548
|
});
|
|
@@ -3451,6 +3564,12 @@ async function prepareResponsesTools({
|
|
|
3451
3564
|
});
|
|
3452
3565
|
break;
|
|
3453
3566
|
}
|
|
3567
|
+
case "openai.shell": {
|
|
3568
|
+
openaiTools2.push({
|
|
3569
|
+
type: "shell"
|
|
3570
|
+
});
|
|
3571
|
+
break;
|
|
3572
|
+
}
|
|
3454
3573
|
case "openai.apply_patch": {
|
|
3455
3574
|
openaiTools2.push({
|
|
3456
3575
|
type: "apply_patch"
|
|
@@ -3458,7 +3577,7 @@ async function prepareResponsesTools({
|
|
|
3458
3577
|
break;
|
|
3459
3578
|
}
|
|
3460
3579
|
case "openai.web_search_preview": {
|
|
3461
|
-
const args = await (0,
|
|
3580
|
+
const args = await (0, import_provider_utils26.validateTypes)({
|
|
3462
3581
|
value: tool.args,
|
|
3463
3582
|
schema: webSearchPreviewArgsSchema
|
|
3464
3583
|
});
|
|
@@ -3470,7 +3589,7 @@ async function prepareResponsesTools({
|
|
|
3470
3589
|
break;
|
|
3471
3590
|
}
|
|
3472
3591
|
case "openai.web_search": {
|
|
3473
|
-
const args = await (0,
|
|
3592
|
+
const args = await (0, import_provider_utils26.validateTypes)({
|
|
3474
3593
|
value: tool.args,
|
|
3475
3594
|
schema: webSearchArgsSchema
|
|
3476
3595
|
});
|
|
@@ -3484,7 +3603,7 @@ async function prepareResponsesTools({
|
|
|
3484
3603
|
break;
|
|
3485
3604
|
}
|
|
3486
3605
|
case "openai.code_interpreter": {
|
|
3487
|
-
const args = await (0,
|
|
3606
|
+
const args = await (0, import_provider_utils26.validateTypes)({
|
|
3488
3607
|
value: tool.args,
|
|
3489
3608
|
schema: codeInterpreterArgsSchema
|
|
3490
3609
|
});
|
|
@@ -3495,7 +3614,7 @@ async function prepareResponsesTools({
|
|
|
3495
3614
|
break;
|
|
3496
3615
|
}
|
|
3497
3616
|
case "openai.image_generation": {
|
|
3498
|
-
const args = await (0,
|
|
3617
|
+
const args = await (0, import_provider_utils26.validateTypes)({
|
|
3499
3618
|
value: tool.args,
|
|
3500
3619
|
schema: imageGenerationArgsSchema
|
|
3501
3620
|
});
|
|
@@ -3518,7 +3637,7 @@ async function prepareResponsesTools({
|
|
|
3518
3637
|
break;
|
|
3519
3638
|
}
|
|
3520
3639
|
case "openai.mcp": {
|
|
3521
|
-
const args = await (0,
|
|
3640
|
+
const args = await (0, import_provider_utils26.validateTypes)({
|
|
3522
3641
|
value: tool.args,
|
|
3523
3642
|
schema: mcpArgsSchema
|
|
3524
3643
|
});
|
|
@@ -3620,7 +3739,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3620
3739
|
if (stopSequences != null) {
|
|
3621
3740
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
3622
3741
|
}
|
|
3623
|
-
const openaiOptions = await (0,
|
|
3742
|
+
const openaiOptions = await (0, import_provider_utils27.parseProviderOptions)({
|
|
3624
3743
|
provider: "openai",
|
|
3625
3744
|
providerOptions,
|
|
3626
3745
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -3632,13 +3751,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3632
3751
|
details: "conversation and previousResponseId cannot be used together"
|
|
3633
3752
|
});
|
|
3634
3753
|
}
|
|
3635
|
-
const toolNameMapping = (0,
|
|
3754
|
+
const toolNameMapping = (0, import_provider_utils27.createToolNameMapping)({
|
|
3636
3755
|
tools,
|
|
3637
3756
|
providerToolNames: {
|
|
3638
3757
|
"openai.code_interpreter": "code_interpreter",
|
|
3639
3758
|
"openai.file_search": "file_search",
|
|
3640
3759
|
"openai.image_generation": "image_generation",
|
|
3641
3760
|
"openai.local_shell": "local_shell",
|
|
3761
|
+
"openai.shell": "shell",
|
|
3642
3762
|
"openai.web_search": "web_search",
|
|
3643
3763
|
"openai.web_search_preview": "web_search_preview",
|
|
3644
3764
|
"openai.mcp": "mcp",
|
|
@@ -3652,6 +3772,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3652
3772
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
3653
3773
|
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
3654
3774
|
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
3775
|
+
hasShellTool: hasOpenAITool("openai.shell"),
|
|
3655
3776
|
hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
|
|
3656
3777
|
});
|
|
3657
3778
|
warnings.push(...inputWarnings);
|
|
@@ -3820,12 +3941,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3820
3941
|
responseHeaders,
|
|
3821
3942
|
value: response,
|
|
3822
3943
|
rawValue: rawResponse
|
|
3823
|
-
} = await (0,
|
|
3944
|
+
} = await (0, import_provider_utils27.postJsonToApi)({
|
|
3824
3945
|
url,
|
|
3825
|
-
headers: (0,
|
|
3946
|
+
headers: (0, import_provider_utils27.combineHeaders)(this.config.headers(), options.headers),
|
|
3826
3947
|
body,
|
|
3827
3948
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3828
|
-
successfulResponseHandler: (0,
|
|
3949
|
+
successfulResponseHandler: (0, import_provider_utils27.createJsonResponseHandler)(
|
|
3829
3950
|
openaiResponsesResponseSchema
|
|
3830
3951
|
),
|
|
3831
3952
|
abortSignal: options.abortSignal,
|
|
@@ -3899,6 +4020,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3899
4020
|
});
|
|
3900
4021
|
break;
|
|
3901
4022
|
}
|
|
4023
|
+
case "shell_call": {
|
|
4024
|
+
content.push({
|
|
4025
|
+
type: "tool-call",
|
|
4026
|
+
toolCallId: part.call_id,
|
|
4027
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
4028
|
+
input: JSON.stringify({
|
|
4029
|
+
action: {
|
|
4030
|
+
commands: part.action.commands
|
|
4031
|
+
}
|
|
4032
|
+
}),
|
|
4033
|
+
providerMetadata: {
|
|
4034
|
+
[providerKey]: {
|
|
4035
|
+
itemId: part.id
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
4038
|
+
});
|
|
4039
|
+
break;
|
|
4040
|
+
}
|
|
3902
4041
|
case "message": {
|
|
3903
4042
|
for (const contentPart of part.content) {
|
|
3904
4043
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -3922,7 +4061,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3922
4061
|
content.push({
|
|
3923
4062
|
type: "source",
|
|
3924
4063
|
sourceType: "url",
|
|
3925
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
4064
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils27.generateId)(),
|
|
3926
4065
|
url: annotation.url,
|
|
3927
4066
|
title: annotation.title
|
|
3928
4067
|
});
|
|
@@ -3930,7 +4069,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3930
4069
|
content.push({
|
|
3931
4070
|
type: "source",
|
|
3932
4071
|
sourceType: "document",
|
|
3933
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
4072
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils27.generateId)(),
|
|
3934
4073
|
mediaType: "text/plain",
|
|
3935
4074
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3936
4075
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
@@ -3946,7 +4085,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3946
4085
|
content.push({
|
|
3947
4086
|
type: "source",
|
|
3948
4087
|
sourceType: "document",
|
|
3949
|
-
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
4088
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils27.generateId)(),
|
|
3950
4089
|
mediaType: "text/plain",
|
|
3951
4090
|
title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
|
|
3952
4091
|
filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
|
|
@@ -3962,7 +4101,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3962
4101
|
content.push({
|
|
3963
4102
|
type: "source",
|
|
3964
4103
|
sourceType: "document",
|
|
3965
|
-
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0,
|
|
4104
|
+
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils27.generateId)(),
|
|
3966
4105
|
mediaType: "application/octet-stream",
|
|
3967
4106
|
title: annotation.file_id,
|
|
3968
4107
|
filename: annotation.file_id,
|
|
@@ -4214,18 +4353,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4214
4353
|
toolNameMapping,
|
|
4215
4354
|
store
|
|
4216
4355
|
} = await this.getArgs(options);
|
|
4217
|
-
const { responseHeaders, value: response } = await (0,
|
|
4356
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils27.postJsonToApi)({
|
|
4218
4357
|
url: this.config.url({
|
|
4219
4358
|
path: "/responses",
|
|
4220
4359
|
modelId: this.modelId
|
|
4221
4360
|
}),
|
|
4222
|
-
headers: (0,
|
|
4361
|
+
headers: (0, import_provider_utils27.combineHeaders)(this.config.headers(), options.headers),
|
|
4223
4362
|
body: {
|
|
4224
4363
|
...body,
|
|
4225
4364
|
stream: true
|
|
4226
4365
|
},
|
|
4227
4366
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4228
|
-
successfulResponseHandler: (0,
|
|
4367
|
+
successfulResponseHandler: (0, import_provider_utils27.createEventSourceResponseHandler)(
|
|
4229
4368
|
openaiResponsesChunkSchema
|
|
4230
4369
|
),
|
|
4231
4370
|
abortSignal: options.abortSignal,
|
|
@@ -4377,6 +4516,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4377
4516
|
}
|
|
4378
4517
|
});
|
|
4379
4518
|
}
|
|
4519
|
+
} else if (value.item.type === "shell_call") {
|
|
4520
|
+
ongoingToolCalls[value.output_index] = {
|
|
4521
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
4522
|
+
toolCallId: value.item.call_id
|
|
4523
|
+
};
|
|
4380
4524
|
} else if (value.item.type === "message") {
|
|
4381
4525
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
4382
4526
|
controller.enqueue({
|
|
@@ -4592,6 +4736,21 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4592
4736
|
[providerKey]: { itemId: value.item.id }
|
|
4593
4737
|
}
|
|
4594
4738
|
});
|
|
4739
|
+
} else if (value.item.type === "shell_call") {
|
|
4740
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
4741
|
+
controller.enqueue({
|
|
4742
|
+
type: "tool-call",
|
|
4743
|
+
toolCallId: value.item.call_id,
|
|
4744
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
4745
|
+
input: JSON.stringify({
|
|
4746
|
+
action: {
|
|
4747
|
+
commands: value.item.action.commands
|
|
4748
|
+
}
|
|
4749
|
+
}),
|
|
4750
|
+
providerMetadata: {
|
|
4751
|
+
[providerKey]: { itemId: value.item.id }
|
|
4752
|
+
}
|
|
4753
|
+
});
|
|
4595
4754
|
} else if (value.item.type === "reasoning") {
|
|
4596
4755
|
const activeReasoningPart = activeReasoning[value.item.id];
|
|
4597
4756
|
const summaryPartIndices = Object.entries(
|
|
@@ -4755,7 +4914,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4755
4914
|
controller.enqueue({
|
|
4756
4915
|
type: "source",
|
|
4757
4916
|
sourceType: "url",
|
|
4758
|
-
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0,
|
|
4917
|
+
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0, import_provider_utils27.generateId)(),
|
|
4759
4918
|
url: value.annotation.url,
|
|
4760
4919
|
title: value.annotation.title
|
|
4761
4920
|
});
|
|
@@ -4763,7 +4922,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4763
4922
|
controller.enqueue({
|
|
4764
4923
|
type: "source",
|
|
4765
4924
|
sourceType: "document",
|
|
4766
|
-
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0,
|
|
4925
|
+
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils27.generateId)(),
|
|
4767
4926
|
mediaType: "text/plain",
|
|
4768
4927
|
title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
|
|
4769
4928
|
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
|
|
@@ -4779,7 +4938,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4779
4938
|
controller.enqueue({
|
|
4780
4939
|
type: "source",
|
|
4781
4940
|
sourceType: "document",
|
|
4782
|
-
id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0,
|
|
4941
|
+
id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0, import_provider_utils27.generateId)(),
|
|
4783
4942
|
mediaType: "text/plain",
|
|
4784
4943
|
title: (_A = (_z = value.annotation.filename) != null ? _z : value.annotation.file_id) != null ? _A : "Document",
|
|
4785
4944
|
filename: (_B = value.annotation.filename) != null ? _B : value.annotation.file_id,
|
|
@@ -4795,7 +4954,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4795
4954
|
controller.enqueue({
|
|
4796
4955
|
type: "source",
|
|
4797
4956
|
sourceType: "document",
|
|
4798
|
-
id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0,
|
|
4957
|
+
id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0, import_provider_utils27.generateId)(),
|
|
4799
4958
|
mediaType: "application/octet-stream",
|
|
4800
4959
|
title: value.annotation.file_id,
|
|
4801
4960
|
filename: value.annotation.file_id,
|
|
@@ -4901,16 +5060,16 @@ function mapWebSearchOutput(action) {
|
|
|
4901
5060
|
}
|
|
4902
5061
|
|
|
4903
5062
|
// src/speech/openai-speech-model.ts
|
|
4904
|
-
var
|
|
5063
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
4905
5064
|
|
|
4906
5065
|
// src/speech/openai-speech-options.ts
|
|
4907
|
-
var
|
|
4908
|
-
var
|
|
4909
|
-
var openaiSpeechProviderOptionsSchema = (0,
|
|
4910
|
-
() => (0,
|
|
4911
|
-
|
|
4912
|
-
instructions:
|
|
4913
|
-
speed:
|
|
5066
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
5067
|
+
var import_v421 = require("zod/v4");
|
|
5068
|
+
var openaiSpeechProviderOptionsSchema = (0, import_provider_utils28.lazySchema)(
|
|
5069
|
+
() => (0, import_provider_utils28.zodSchema)(
|
|
5070
|
+
import_v421.z.object({
|
|
5071
|
+
instructions: import_v421.z.string().nullish(),
|
|
5072
|
+
speed: import_v421.z.number().min(0.25).max(4).default(1).nullish()
|
|
4914
5073
|
})
|
|
4915
5074
|
)
|
|
4916
5075
|
);
|
|
@@ -4935,7 +5094,7 @@ var OpenAISpeechModel = class {
|
|
|
4935
5094
|
providerOptions
|
|
4936
5095
|
}) {
|
|
4937
5096
|
const warnings = [];
|
|
4938
|
-
const openAIOptions = await (0,
|
|
5097
|
+
const openAIOptions = await (0, import_provider_utils29.parseProviderOptions)({
|
|
4939
5098
|
provider: "openai",
|
|
4940
5099
|
providerOptions,
|
|
4941
5100
|
schema: openaiSpeechProviderOptionsSchema
|
|
@@ -4988,15 +5147,15 @@ var OpenAISpeechModel = class {
|
|
|
4988
5147
|
value: audio,
|
|
4989
5148
|
responseHeaders,
|
|
4990
5149
|
rawValue: rawResponse
|
|
4991
|
-
} = await (0,
|
|
5150
|
+
} = await (0, import_provider_utils29.postJsonToApi)({
|
|
4992
5151
|
url: this.config.url({
|
|
4993
5152
|
path: "/audio/speech",
|
|
4994
5153
|
modelId: this.modelId
|
|
4995
5154
|
}),
|
|
4996
|
-
headers: (0,
|
|
5155
|
+
headers: (0, import_provider_utils29.combineHeaders)(this.config.headers(), options.headers),
|
|
4997
5156
|
body: requestBody,
|
|
4998
5157
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4999
|
-
successfulResponseHandler: (0,
|
|
5158
|
+
successfulResponseHandler: (0, import_provider_utils29.createBinaryResponseHandler)(),
|
|
5000
5159
|
abortSignal: options.abortSignal,
|
|
5001
5160
|
fetch: this.config.fetch
|
|
5002
5161
|
});
|
|
@@ -5017,36 +5176,36 @@ var OpenAISpeechModel = class {
|
|
|
5017
5176
|
};
|
|
5018
5177
|
|
|
5019
5178
|
// src/transcription/openai-transcription-model.ts
|
|
5020
|
-
var
|
|
5179
|
+
var import_provider_utils32 = require("@ai-sdk/provider-utils");
|
|
5021
5180
|
|
|
5022
5181
|
// src/transcription/openai-transcription-api.ts
|
|
5023
|
-
var
|
|
5024
|
-
var
|
|
5025
|
-
var openaiTranscriptionResponseSchema = (0,
|
|
5026
|
-
() => (0,
|
|
5027
|
-
|
|
5028
|
-
text:
|
|
5029
|
-
language:
|
|
5030
|
-
duration:
|
|
5031
|
-
words:
|
|
5032
|
-
|
|
5033
|
-
word:
|
|
5034
|
-
start:
|
|
5035
|
-
end:
|
|
5182
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
5183
|
+
var import_v422 = require("zod/v4");
|
|
5184
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils30.lazySchema)(
|
|
5185
|
+
() => (0, import_provider_utils30.zodSchema)(
|
|
5186
|
+
import_v422.z.object({
|
|
5187
|
+
text: import_v422.z.string(),
|
|
5188
|
+
language: import_v422.z.string().nullish(),
|
|
5189
|
+
duration: import_v422.z.number().nullish(),
|
|
5190
|
+
words: import_v422.z.array(
|
|
5191
|
+
import_v422.z.object({
|
|
5192
|
+
word: import_v422.z.string(),
|
|
5193
|
+
start: import_v422.z.number(),
|
|
5194
|
+
end: import_v422.z.number()
|
|
5036
5195
|
})
|
|
5037
5196
|
).nullish(),
|
|
5038
|
-
segments:
|
|
5039
|
-
|
|
5040
|
-
id:
|
|
5041
|
-
seek:
|
|
5042
|
-
start:
|
|
5043
|
-
end:
|
|
5044
|
-
text:
|
|
5045
|
-
tokens:
|
|
5046
|
-
temperature:
|
|
5047
|
-
avg_logprob:
|
|
5048
|
-
compression_ratio:
|
|
5049
|
-
no_speech_prob:
|
|
5197
|
+
segments: import_v422.z.array(
|
|
5198
|
+
import_v422.z.object({
|
|
5199
|
+
id: import_v422.z.number(),
|
|
5200
|
+
seek: import_v422.z.number(),
|
|
5201
|
+
start: import_v422.z.number(),
|
|
5202
|
+
end: import_v422.z.number(),
|
|
5203
|
+
text: import_v422.z.string(),
|
|
5204
|
+
tokens: import_v422.z.array(import_v422.z.number()),
|
|
5205
|
+
temperature: import_v422.z.number(),
|
|
5206
|
+
avg_logprob: import_v422.z.number(),
|
|
5207
|
+
compression_ratio: import_v422.z.number(),
|
|
5208
|
+
no_speech_prob: import_v422.z.number()
|
|
5050
5209
|
})
|
|
5051
5210
|
).nullish()
|
|
5052
5211
|
})
|
|
@@ -5054,33 +5213,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils29.lazySchema)(
|
|
|
5054
5213
|
);
|
|
5055
5214
|
|
|
5056
5215
|
// src/transcription/openai-transcription-options.ts
|
|
5057
|
-
var
|
|
5058
|
-
var
|
|
5059
|
-
var openAITranscriptionProviderOptions = (0,
|
|
5060
|
-
() => (0,
|
|
5061
|
-
|
|
5216
|
+
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
5217
|
+
var import_v423 = require("zod/v4");
|
|
5218
|
+
var openAITranscriptionProviderOptions = (0, import_provider_utils31.lazySchema)(
|
|
5219
|
+
() => (0, import_provider_utils31.zodSchema)(
|
|
5220
|
+
import_v423.z.object({
|
|
5062
5221
|
/**
|
|
5063
5222
|
* Additional information to include in the transcription response.
|
|
5064
5223
|
*/
|
|
5065
|
-
include:
|
|
5224
|
+
include: import_v423.z.array(import_v423.z.string()).optional(),
|
|
5066
5225
|
/**
|
|
5067
5226
|
* The language of the input audio in ISO-639-1 format.
|
|
5068
5227
|
*/
|
|
5069
|
-
language:
|
|
5228
|
+
language: import_v423.z.string().optional(),
|
|
5070
5229
|
/**
|
|
5071
5230
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
5072
5231
|
*/
|
|
5073
|
-
prompt:
|
|
5232
|
+
prompt: import_v423.z.string().optional(),
|
|
5074
5233
|
/**
|
|
5075
5234
|
* The sampling temperature, between 0 and 1.
|
|
5076
5235
|
* @default 0
|
|
5077
5236
|
*/
|
|
5078
|
-
temperature:
|
|
5237
|
+
temperature: import_v423.z.number().min(0).max(1).default(0).optional(),
|
|
5079
5238
|
/**
|
|
5080
5239
|
* The timestamp granularities to populate for this transcription.
|
|
5081
5240
|
* @default ['segment']
|
|
5082
5241
|
*/
|
|
5083
|
-
timestampGranularities:
|
|
5242
|
+
timestampGranularities: import_v423.z.array(import_v423.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
5084
5243
|
})
|
|
5085
5244
|
)
|
|
5086
5245
|
);
|
|
@@ -5160,15 +5319,15 @@ var OpenAITranscriptionModel = class {
|
|
|
5160
5319
|
providerOptions
|
|
5161
5320
|
}) {
|
|
5162
5321
|
const warnings = [];
|
|
5163
|
-
const openAIOptions = await (0,
|
|
5322
|
+
const openAIOptions = await (0, import_provider_utils32.parseProviderOptions)({
|
|
5164
5323
|
provider: "openai",
|
|
5165
5324
|
providerOptions,
|
|
5166
5325
|
schema: openAITranscriptionProviderOptions
|
|
5167
5326
|
});
|
|
5168
5327
|
const formData = new FormData();
|
|
5169
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
5328
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils32.convertBase64ToUint8Array)(audio)]);
|
|
5170
5329
|
formData.append("model", this.modelId);
|
|
5171
|
-
const fileExtension = (0,
|
|
5330
|
+
const fileExtension = (0, import_provider_utils32.mediaTypeToExtension)(mediaType);
|
|
5172
5331
|
formData.append(
|
|
5173
5332
|
"file",
|
|
5174
5333
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -5213,15 +5372,15 @@ var OpenAITranscriptionModel = class {
|
|
|
5213
5372
|
value: response,
|
|
5214
5373
|
responseHeaders,
|
|
5215
5374
|
rawValue: rawResponse
|
|
5216
|
-
} = await (0,
|
|
5375
|
+
} = await (0, import_provider_utils32.postFormDataToApi)({
|
|
5217
5376
|
url: this.config.url({
|
|
5218
5377
|
path: "/audio/transcriptions",
|
|
5219
5378
|
modelId: this.modelId
|
|
5220
5379
|
}),
|
|
5221
|
-
headers: (0,
|
|
5380
|
+
headers: (0, import_provider_utils32.combineHeaders)(this.config.headers(), options.headers),
|
|
5222
5381
|
formData,
|
|
5223
5382
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
5224
|
-
successfulResponseHandler: (0,
|
|
5383
|
+
successfulResponseHandler: (0, import_provider_utils32.createJsonResponseHandler)(
|
|
5225
5384
|
openaiTranscriptionResponseSchema
|
|
5226
5385
|
),
|
|
5227
5386
|
abortSignal: options.abortSignal,
|
|
@@ -5253,21 +5412,21 @@ var OpenAITranscriptionModel = class {
|
|
|
5253
5412
|
};
|
|
5254
5413
|
|
|
5255
5414
|
// src/version.ts
|
|
5256
|
-
var VERSION = true ? "3.0.0-beta.
|
|
5415
|
+
var VERSION = true ? "3.0.0-beta.82" : "0.0.0-test";
|
|
5257
5416
|
|
|
5258
5417
|
// src/openai-provider.ts
|
|
5259
5418
|
function createOpenAI(options = {}) {
|
|
5260
5419
|
var _a, _b;
|
|
5261
|
-
const baseURL = (_a = (0,
|
|
5262
|
-
(0,
|
|
5420
|
+
const baseURL = (_a = (0, import_provider_utils33.withoutTrailingSlash)(
|
|
5421
|
+
(0, import_provider_utils33.loadOptionalSetting)({
|
|
5263
5422
|
settingValue: options.baseURL,
|
|
5264
5423
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
5265
5424
|
})
|
|
5266
5425
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
5267
5426
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
5268
|
-
const getHeaders = () => (0,
|
|
5427
|
+
const getHeaders = () => (0, import_provider_utils33.withUserAgentSuffix)(
|
|
5269
5428
|
{
|
|
5270
|
-
Authorization: `Bearer ${(0,
|
|
5429
|
+
Authorization: `Bearer ${(0, import_provider_utils33.loadApiKey)({
|
|
5271
5430
|
apiKey: options.apiKey,
|
|
5272
5431
|
environmentVariableName: "OPENAI_API_KEY",
|
|
5273
5432
|
description: "OpenAI"
|