@ai-sdk/openai 3.0.36 → 3.0.38
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 +14 -0
- package/README.md +1 -1
- package/dist/index.d.mts +53 -3
- package/dist/index.d.ts +53 -3
- package/dist/index.js +1168 -966
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1118 -912
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +20 -2
- package/dist/internal/index.d.ts +20 -2
- package/dist/internal/index.js +349 -158
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +327 -132
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +79 -1
- package/package.json +2 -2
- package/src/chat/openai-chat-options.ts +0 -5
- package/src/openai-language-model-capabilities.ts +0 -2
- package/src/openai-tools.ts +13 -1
- package/src/responses/convert-to-openai-responses-input.ts +74 -0
- package/src/responses/openai-responses-api.ts +58 -0
- package/src/responses/openai-responses-language-model.ts +94 -9
- package/src/responses/openai-responses-options.ts +0 -22
- package/src/responses/openai-responses-prepare-tools.ts +41 -11
- package/src/tool/custom.ts +64 -0
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_utils34 = 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");
|
|
@@ -56,7 +56,7 @@ var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
|
|
|
56
56
|
function getOpenAILanguageModelCapabilities(modelId) {
|
|
57
57
|
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
58
58
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
59
|
-
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("
|
|
59
|
+
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
60
60
|
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2");
|
|
61
61
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
62
62
|
return {
|
|
@@ -2043,82 +2043,110 @@ var codeInterpreter = (args = {}) => {
|
|
|
2043
2043
|
return codeInterpreterToolFactory(args);
|
|
2044
2044
|
};
|
|
2045
2045
|
|
|
2046
|
-
// src/tool/
|
|
2046
|
+
// src/tool/custom.ts
|
|
2047
2047
|
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2048
2048
|
var import_v411 = require("zod/v4");
|
|
2049
|
-
var
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2049
|
+
var customArgsSchema = (0, import_provider_utils16.lazySchema)(
|
|
2050
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
2051
|
+
import_v411.z.object({
|
|
2052
|
+
name: import_v411.z.string(),
|
|
2053
|
+
description: import_v411.z.string().optional(),
|
|
2054
|
+
format: import_v411.z.union([
|
|
2055
|
+
import_v411.z.object({
|
|
2056
|
+
type: import_v411.z.literal("grammar"),
|
|
2057
|
+
syntax: import_v411.z.enum(["regex", "lark"]),
|
|
2058
|
+
definition: import_v411.z.string()
|
|
2059
|
+
}),
|
|
2060
|
+
import_v411.z.object({
|
|
2061
|
+
type: import_v411.z.literal("text")
|
|
2062
|
+
})
|
|
2063
|
+
]).optional()
|
|
2064
|
+
})
|
|
2065
|
+
)
|
|
2066
|
+
);
|
|
2067
|
+
var customInputSchema = (0, import_provider_utils16.lazySchema)(() => (0, import_provider_utils16.zodSchema)(import_v411.z.string()));
|
|
2068
|
+
var customToolFactory = (0, import_provider_utils16.createProviderToolFactory)({
|
|
2069
|
+
id: "openai.custom",
|
|
2070
|
+
inputSchema: customInputSchema
|
|
2053
2071
|
});
|
|
2054
|
-
var
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2072
|
+
var customTool = (args) => customToolFactory(args);
|
|
2073
|
+
|
|
2074
|
+
// src/tool/file-search.ts
|
|
2075
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
2076
|
+
var import_v412 = require("zod/v4");
|
|
2077
|
+
var comparisonFilterSchema = import_v412.z.object({
|
|
2078
|
+
key: import_v412.z.string(),
|
|
2079
|
+
type: import_v412.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
2080
|
+
value: import_v412.z.union([import_v412.z.string(), import_v412.z.number(), import_v412.z.boolean(), import_v412.z.array(import_v412.z.string())])
|
|
2081
|
+
});
|
|
2082
|
+
var compoundFilterSchema = import_v412.z.object({
|
|
2083
|
+
type: import_v412.z.enum(["and", "or"]),
|
|
2084
|
+
filters: import_v412.z.array(
|
|
2085
|
+
import_v412.z.union([comparisonFilterSchema, import_v412.z.lazy(() => compoundFilterSchema)])
|
|
2058
2086
|
)
|
|
2059
2087
|
});
|
|
2060
|
-
var fileSearchArgsSchema = (0,
|
|
2061
|
-
() => (0,
|
|
2062
|
-
|
|
2063
|
-
vectorStoreIds:
|
|
2064
|
-
maxNumResults:
|
|
2065
|
-
ranking:
|
|
2066
|
-
ranker:
|
|
2067
|
-
scoreThreshold:
|
|
2088
|
+
var fileSearchArgsSchema = (0, import_provider_utils17.lazySchema)(
|
|
2089
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
2090
|
+
import_v412.z.object({
|
|
2091
|
+
vectorStoreIds: import_v412.z.array(import_v412.z.string()),
|
|
2092
|
+
maxNumResults: import_v412.z.number().optional(),
|
|
2093
|
+
ranking: import_v412.z.object({
|
|
2094
|
+
ranker: import_v412.z.string().optional(),
|
|
2095
|
+
scoreThreshold: import_v412.z.number().optional()
|
|
2068
2096
|
}).optional(),
|
|
2069
|
-
filters:
|
|
2097
|
+
filters: import_v412.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2070
2098
|
})
|
|
2071
2099
|
)
|
|
2072
2100
|
);
|
|
2073
|
-
var fileSearchOutputSchema = (0,
|
|
2074
|
-
() => (0,
|
|
2075
|
-
|
|
2076
|
-
queries:
|
|
2077
|
-
results:
|
|
2078
|
-
|
|
2079
|
-
attributes:
|
|
2080
|
-
fileId:
|
|
2081
|
-
filename:
|
|
2082
|
-
score:
|
|
2083
|
-
text:
|
|
2101
|
+
var fileSearchOutputSchema = (0, import_provider_utils17.lazySchema)(
|
|
2102
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
2103
|
+
import_v412.z.object({
|
|
2104
|
+
queries: import_v412.z.array(import_v412.z.string()),
|
|
2105
|
+
results: import_v412.z.array(
|
|
2106
|
+
import_v412.z.object({
|
|
2107
|
+
attributes: import_v412.z.record(import_v412.z.string(), import_v412.z.unknown()),
|
|
2108
|
+
fileId: import_v412.z.string(),
|
|
2109
|
+
filename: import_v412.z.string(),
|
|
2110
|
+
score: import_v412.z.number(),
|
|
2111
|
+
text: import_v412.z.string()
|
|
2084
2112
|
})
|
|
2085
2113
|
).nullable()
|
|
2086
2114
|
})
|
|
2087
2115
|
)
|
|
2088
2116
|
);
|
|
2089
|
-
var fileSearch = (0,
|
|
2117
|
+
var fileSearch = (0, import_provider_utils17.createProviderToolFactoryWithOutputSchema)({
|
|
2090
2118
|
id: "openai.file_search",
|
|
2091
|
-
inputSchema:
|
|
2119
|
+
inputSchema: import_v412.z.object({}),
|
|
2092
2120
|
outputSchema: fileSearchOutputSchema
|
|
2093
2121
|
});
|
|
2094
2122
|
|
|
2095
2123
|
// src/tool/image-generation.ts
|
|
2096
|
-
var
|
|
2097
|
-
var
|
|
2098
|
-
var imageGenerationArgsSchema = (0,
|
|
2099
|
-
() => (0,
|
|
2100
|
-
|
|
2101
|
-
background:
|
|
2102
|
-
inputFidelity:
|
|
2103
|
-
inputImageMask:
|
|
2104
|
-
fileId:
|
|
2105
|
-
imageUrl:
|
|
2124
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
2125
|
+
var import_v413 = require("zod/v4");
|
|
2126
|
+
var imageGenerationArgsSchema = (0, import_provider_utils18.lazySchema)(
|
|
2127
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2128
|
+
import_v413.z.object({
|
|
2129
|
+
background: import_v413.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
2130
|
+
inputFidelity: import_v413.z.enum(["low", "high"]).optional(),
|
|
2131
|
+
inputImageMask: import_v413.z.object({
|
|
2132
|
+
fileId: import_v413.z.string().optional(),
|
|
2133
|
+
imageUrl: import_v413.z.string().optional()
|
|
2106
2134
|
}).optional(),
|
|
2107
|
-
model:
|
|
2108
|
-
moderation:
|
|
2109
|
-
outputCompression:
|
|
2110
|
-
outputFormat:
|
|
2111
|
-
partialImages:
|
|
2112
|
-
quality:
|
|
2113
|
-
size:
|
|
2135
|
+
model: import_v413.z.string().optional(),
|
|
2136
|
+
moderation: import_v413.z.enum(["auto"]).optional(),
|
|
2137
|
+
outputCompression: import_v413.z.number().int().min(0).max(100).optional(),
|
|
2138
|
+
outputFormat: import_v413.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
2139
|
+
partialImages: import_v413.z.number().int().min(0).max(3).optional(),
|
|
2140
|
+
quality: import_v413.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
2141
|
+
size: import_v413.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
2114
2142
|
}).strict()
|
|
2115
2143
|
)
|
|
2116
2144
|
);
|
|
2117
|
-
var imageGenerationInputSchema = (0,
|
|
2118
|
-
var imageGenerationOutputSchema = (0,
|
|
2119
|
-
() => (0,
|
|
2145
|
+
var imageGenerationInputSchema = (0, import_provider_utils18.lazySchema)(() => (0, import_provider_utils18.zodSchema)(import_v413.z.object({})));
|
|
2146
|
+
var imageGenerationOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2147
|
+
() => (0, import_provider_utils18.zodSchema)(import_v413.z.object({ result: import_v413.z.string() }))
|
|
2120
2148
|
);
|
|
2121
|
-
var imageGenerationToolFactory = (0,
|
|
2149
|
+
var imageGenerationToolFactory = (0, import_provider_utils18.createProviderToolFactoryWithOutputSchema)({
|
|
2122
2150
|
id: "openai.image_generation",
|
|
2123
2151
|
inputSchema: imageGenerationInputSchema,
|
|
2124
2152
|
outputSchema: imageGenerationOutputSchema
|
|
@@ -2128,115 +2156,115 @@ var imageGeneration = (args = {}) => {
|
|
|
2128
2156
|
};
|
|
2129
2157
|
|
|
2130
2158
|
// src/tool/local-shell.ts
|
|
2131
|
-
var
|
|
2132
|
-
var
|
|
2133
|
-
var localShellInputSchema = (0,
|
|
2134
|
-
() => (0,
|
|
2135
|
-
|
|
2136
|
-
action:
|
|
2137
|
-
type:
|
|
2138
|
-
command:
|
|
2139
|
-
timeoutMs:
|
|
2140
|
-
user:
|
|
2141
|
-
workingDirectory:
|
|
2142
|
-
env:
|
|
2159
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
2160
|
+
var import_v414 = require("zod/v4");
|
|
2161
|
+
var localShellInputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2162
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
2163
|
+
import_v414.z.object({
|
|
2164
|
+
action: import_v414.z.object({
|
|
2165
|
+
type: import_v414.z.literal("exec"),
|
|
2166
|
+
command: import_v414.z.array(import_v414.z.string()),
|
|
2167
|
+
timeoutMs: import_v414.z.number().optional(),
|
|
2168
|
+
user: import_v414.z.string().optional(),
|
|
2169
|
+
workingDirectory: import_v414.z.string().optional(),
|
|
2170
|
+
env: import_v414.z.record(import_v414.z.string(), import_v414.z.string()).optional()
|
|
2143
2171
|
})
|
|
2144
2172
|
})
|
|
2145
2173
|
)
|
|
2146
2174
|
);
|
|
2147
|
-
var localShellOutputSchema = (0,
|
|
2148
|
-
() => (0,
|
|
2175
|
+
var localShellOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2176
|
+
() => (0, import_provider_utils19.zodSchema)(import_v414.z.object({ output: import_v414.z.string() }))
|
|
2149
2177
|
);
|
|
2150
|
-
var localShell = (0,
|
|
2178
|
+
var localShell = (0, import_provider_utils19.createProviderToolFactoryWithOutputSchema)({
|
|
2151
2179
|
id: "openai.local_shell",
|
|
2152
2180
|
inputSchema: localShellInputSchema,
|
|
2153
2181
|
outputSchema: localShellOutputSchema
|
|
2154
2182
|
});
|
|
2155
2183
|
|
|
2156
2184
|
// src/tool/shell.ts
|
|
2157
|
-
var
|
|
2158
|
-
var
|
|
2159
|
-
var shellInputSchema = (0,
|
|
2160
|
-
() => (0,
|
|
2161
|
-
|
|
2162
|
-
action:
|
|
2163
|
-
commands:
|
|
2164
|
-
timeoutMs:
|
|
2165
|
-
maxOutputLength:
|
|
2185
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2186
|
+
var import_v415 = require("zod/v4");
|
|
2187
|
+
var shellInputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2188
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2189
|
+
import_v415.z.object({
|
|
2190
|
+
action: import_v415.z.object({
|
|
2191
|
+
commands: import_v415.z.array(import_v415.z.string()),
|
|
2192
|
+
timeoutMs: import_v415.z.number().optional(),
|
|
2193
|
+
maxOutputLength: import_v415.z.number().optional()
|
|
2166
2194
|
})
|
|
2167
2195
|
})
|
|
2168
2196
|
)
|
|
2169
2197
|
);
|
|
2170
|
-
var shellOutputSchema = (0,
|
|
2171
|
-
() => (0,
|
|
2172
|
-
|
|
2173
|
-
output:
|
|
2174
|
-
|
|
2175
|
-
stdout:
|
|
2176
|
-
stderr:
|
|
2177
|
-
outcome:
|
|
2178
|
-
|
|
2179
|
-
|
|
2198
|
+
var shellOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2199
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2200
|
+
import_v415.z.object({
|
|
2201
|
+
output: import_v415.z.array(
|
|
2202
|
+
import_v415.z.object({
|
|
2203
|
+
stdout: import_v415.z.string(),
|
|
2204
|
+
stderr: import_v415.z.string(),
|
|
2205
|
+
outcome: import_v415.z.discriminatedUnion("type", [
|
|
2206
|
+
import_v415.z.object({ type: import_v415.z.literal("timeout") }),
|
|
2207
|
+
import_v415.z.object({ type: import_v415.z.literal("exit"), exitCode: import_v415.z.number() })
|
|
2180
2208
|
])
|
|
2181
2209
|
})
|
|
2182
2210
|
)
|
|
2183
2211
|
})
|
|
2184
2212
|
)
|
|
2185
2213
|
);
|
|
2186
|
-
var shellSkillsSchema =
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
type:
|
|
2190
|
-
skillId:
|
|
2191
|
-
version:
|
|
2214
|
+
var shellSkillsSchema = import_v415.z.array(
|
|
2215
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2216
|
+
import_v415.z.object({
|
|
2217
|
+
type: import_v415.z.literal("skillReference"),
|
|
2218
|
+
skillId: import_v415.z.string(),
|
|
2219
|
+
version: import_v415.z.string().optional()
|
|
2192
2220
|
}),
|
|
2193
|
-
|
|
2194
|
-
type:
|
|
2195
|
-
name:
|
|
2196
|
-
description:
|
|
2197
|
-
source:
|
|
2198
|
-
type:
|
|
2199
|
-
mediaType:
|
|
2200
|
-
data:
|
|
2221
|
+
import_v415.z.object({
|
|
2222
|
+
type: import_v415.z.literal("inline"),
|
|
2223
|
+
name: import_v415.z.string(),
|
|
2224
|
+
description: import_v415.z.string(),
|
|
2225
|
+
source: import_v415.z.object({
|
|
2226
|
+
type: import_v415.z.literal("base64"),
|
|
2227
|
+
mediaType: import_v415.z.literal("application/zip"),
|
|
2228
|
+
data: import_v415.z.string()
|
|
2201
2229
|
})
|
|
2202
2230
|
})
|
|
2203
2231
|
])
|
|
2204
2232
|
).optional();
|
|
2205
|
-
var shellArgsSchema = (0,
|
|
2206
|
-
() => (0,
|
|
2207
|
-
|
|
2208
|
-
environment:
|
|
2209
|
-
|
|
2210
|
-
type:
|
|
2211
|
-
fileIds:
|
|
2212
|
-
memoryLimit:
|
|
2213
|
-
networkPolicy:
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
type:
|
|
2217
|
-
allowedDomains:
|
|
2218
|
-
domainSecrets:
|
|
2219
|
-
|
|
2220
|
-
domain:
|
|
2221
|
-
name:
|
|
2222
|
-
value:
|
|
2233
|
+
var shellArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
2234
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2235
|
+
import_v415.z.object({
|
|
2236
|
+
environment: import_v415.z.union([
|
|
2237
|
+
import_v415.z.object({
|
|
2238
|
+
type: import_v415.z.literal("containerAuto"),
|
|
2239
|
+
fileIds: import_v415.z.array(import_v415.z.string()).optional(),
|
|
2240
|
+
memoryLimit: import_v415.z.enum(["1g", "4g", "16g", "64g"]).optional(),
|
|
2241
|
+
networkPolicy: import_v415.z.discriminatedUnion("type", [
|
|
2242
|
+
import_v415.z.object({ type: import_v415.z.literal("disabled") }),
|
|
2243
|
+
import_v415.z.object({
|
|
2244
|
+
type: import_v415.z.literal("allowlist"),
|
|
2245
|
+
allowedDomains: import_v415.z.array(import_v415.z.string()),
|
|
2246
|
+
domainSecrets: import_v415.z.array(
|
|
2247
|
+
import_v415.z.object({
|
|
2248
|
+
domain: import_v415.z.string(),
|
|
2249
|
+
name: import_v415.z.string(),
|
|
2250
|
+
value: import_v415.z.string()
|
|
2223
2251
|
})
|
|
2224
2252
|
).optional()
|
|
2225
2253
|
})
|
|
2226
2254
|
]).optional(),
|
|
2227
2255
|
skills: shellSkillsSchema
|
|
2228
2256
|
}),
|
|
2229
|
-
|
|
2230
|
-
type:
|
|
2231
|
-
containerId:
|
|
2257
|
+
import_v415.z.object({
|
|
2258
|
+
type: import_v415.z.literal("containerReference"),
|
|
2259
|
+
containerId: import_v415.z.string()
|
|
2232
2260
|
}),
|
|
2233
|
-
|
|
2234
|
-
type:
|
|
2235
|
-
skills:
|
|
2236
|
-
|
|
2237
|
-
name:
|
|
2238
|
-
description:
|
|
2239
|
-
path:
|
|
2261
|
+
import_v415.z.object({
|
|
2262
|
+
type: import_v415.z.literal("local").optional(),
|
|
2263
|
+
skills: import_v415.z.array(
|
|
2264
|
+
import_v415.z.object({
|
|
2265
|
+
name: import_v415.z.string(),
|
|
2266
|
+
description: import_v415.z.string(),
|
|
2267
|
+
path: import_v415.z.string()
|
|
2240
2268
|
})
|
|
2241
2269
|
).optional()
|
|
2242
2270
|
})
|
|
@@ -2244,72 +2272,20 @@ var shellArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
2244
2272
|
})
|
|
2245
2273
|
)
|
|
2246
2274
|
);
|
|
2247
|
-
var shell = (0,
|
|
2275
|
+
var shell = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
|
|
2248
2276
|
id: "openai.shell",
|
|
2249
2277
|
inputSchema: shellInputSchema,
|
|
2250
2278
|
outputSchema: shellOutputSchema
|
|
2251
2279
|
});
|
|
2252
2280
|
|
|
2253
2281
|
// src/tool/web-search.ts
|
|
2254
|
-
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2255
|
-
var import_v415 = require("zod/v4");
|
|
2256
|
-
var webSearchArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
2257
|
-
() => (0, import_provider_utils20.zodSchema)(
|
|
2258
|
-
import_v415.z.object({
|
|
2259
|
-
externalWebAccess: import_v415.z.boolean().optional(),
|
|
2260
|
-
filters: import_v415.z.object({ allowedDomains: import_v415.z.array(import_v415.z.string()).optional() }).optional(),
|
|
2261
|
-
searchContextSize: import_v415.z.enum(["low", "medium", "high"]).optional(),
|
|
2262
|
-
userLocation: import_v415.z.object({
|
|
2263
|
-
type: import_v415.z.literal("approximate"),
|
|
2264
|
-
country: import_v415.z.string().optional(),
|
|
2265
|
-
city: import_v415.z.string().optional(),
|
|
2266
|
-
region: import_v415.z.string().optional(),
|
|
2267
|
-
timezone: import_v415.z.string().optional()
|
|
2268
|
-
}).optional()
|
|
2269
|
-
})
|
|
2270
|
-
)
|
|
2271
|
-
);
|
|
2272
|
-
var webSearchInputSchema = (0, import_provider_utils20.lazySchema)(() => (0, import_provider_utils20.zodSchema)(import_v415.z.object({})));
|
|
2273
|
-
var webSearchOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2274
|
-
() => (0, import_provider_utils20.zodSchema)(
|
|
2275
|
-
import_v415.z.object({
|
|
2276
|
-
action: import_v415.z.discriminatedUnion("type", [
|
|
2277
|
-
import_v415.z.object({
|
|
2278
|
-
type: import_v415.z.literal("search"),
|
|
2279
|
-
query: import_v415.z.string().optional()
|
|
2280
|
-
}),
|
|
2281
|
-
import_v415.z.object({
|
|
2282
|
-
type: import_v415.z.literal("openPage"),
|
|
2283
|
-
url: import_v415.z.string().nullish()
|
|
2284
|
-
}),
|
|
2285
|
-
import_v415.z.object({
|
|
2286
|
-
type: import_v415.z.literal("findInPage"),
|
|
2287
|
-
url: import_v415.z.string().nullish(),
|
|
2288
|
-
pattern: import_v415.z.string().nullish()
|
|
2289
|
-
})
|
|
2290
|
-
]).optional(),
|
|
2291
|
-
sources: import_v415.z.array(
|
|
2292
|
-
import_v415.z.discriminatedUnion("type", [
|
|
2293
|
-
import_v415.z.object({ type: import_v415.z.literal("url"), url: import_v415.z.string() }),
|
|
2294
|
-
import_v415.z.object({ type: import_v415.z.literal("api"), name: import_v415.z.string() })
|
|
2295
|
-
])
|
|
2296
|
-
).optional()
|
|
2297
|
-
})
|
|
2298
|
-
)
|
|
2299
|
-
);
|
|
2300
|
-
var webSearchToolFactory = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
|
|
2301
|
-
id: "openai.web_search",
|
|
2302
|
-
inputSchema: webSearchInputSchema,
|
|
2303
|
-
outputSchema: webSearchOutputSchema
|
|
2304
|
-
});
|
|
2305
|
-
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2306
|
-
|
|
2307
|
-
// src/tool/web-search-preview.ts
|
|
2308
2282
|
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2309
2283
|
var import_v416 = require("zod/v4");
|
|
2310
|
-
var
|
|
2284
|
+
var webSearchArgsSchema = (0, import_provider_utils21.lazySchema)(
|
|
2311
2285
|
() => (0, import_provider_utils21.zodSchema)(
|
|
2312
2286
|
import_v416.z.object({
|
|
2287
|
+
externalWebAccess: import_v416.z.boolean().optional(),
|
|
2288
|
+
filters: import_v416.z.object({ allowedDomains: import_v416.z.array(import_v416.z.string()).optional() }).optional(),
|
|
2313
2289
|
searchContextSize: import_v416.z.enum(["low", "medium", "high"]).optional(),
|
|
2314
2290
|
userLocation: import_v416.z.object({
|
|
2315
2291
|
type: import_v416.z.literal("approximate"),
|
|
@@ -2321,10 +2297,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2321
2297
|
})
|
|
2322
2298
|
)
|
|
2323
2299
|
);
|
|
2324
|
-
var
|
|
2325
|
-
|
|
2326
|
-
);
|
|
2327
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2300
|
+
var webSearchInputSchema = (0, import_provider_utils21.lazySchema)(() => (0, import_provider_utils21.zodSchema)(import_v416.z.object({})));
|
|
2301
|
+
var webSearchOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2328
2302
|
() => (0, import_provider_utils21.zodSchema)(
|
|
2329
2303
|
import_v416.z.object({
|
|
2330
2304
|
action: import_v416.z.discriminatedUnion("type", [
|
|
@@ -2341,73 +2315,127 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2341
2315
|
url: import_v416.z.string().nullish(),
|
|
2342
2316
|
pattern: import_v416.z.string().nullish()
|
|
2343
2317
|
})
|
|
2318
|
+
]).optional(),
|
|
2319
|
+
sources: import_v416.z.array(
|
|
2320
|
+
import_v416.z.discriminatedUnion("type", [
|
|
2321
|
+
import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
|
|
2322
|
+
import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
|
|
2323
|
+
])
|
|
2324
|
+
).optional()
|
|
2325
|
+
})
|
|
2326
|
+
)
|
|
2327
|
+
);
|
|
2328
|
+
var webSearchToolFactory = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
|
|
2329
|
+
id: "openai.web_search",
|
|
2330
|
+
inputSchema: webSearchInputSchema,
|
|
2331
|
+
outputSchema: webSearchOutputSchema
|
|
2332
|
+
});
|
|
2333
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2334
|
+
|
|
2335
|
+
// src/tool/web-search-preview.ts
|
|
2336
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2337
|
+
var import_v417 = require("zod/v4");
|
|
2338
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils22.lazySchema)(
|
|
2339
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2340
|
+
import_v417.z.object({
|
|
2341
|
+
searchContextSize: import_v417.z.enum(["low", "medium", "high"]).optional(),
|
|
2342
|
+
userLocation: import_v417.z.object({
|
|
2343
|
+
type: import_v417.z.literal("approximate"),
|
|
2344
|
+
country: import_v417.z.string().optional(),
|
|
2345
|
+
city: import_v417.z.string().optional(),
|
|
2346
|
+
region: import_v417.z.string().optional(),
|
|
2347
|
+
timezone: import_v417.z.string().optional()
|
|
2348
|
+
}).optional()
|
|
2349
|
+
})
|
|
2350
|
+
)
|
|
2351
|
+
);
|
|
2352
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2353
|
+
() => (0, import_provider_utils22.zodSchema)(import_v417.z.object({}))
|
|
2354
|
+
);
|
|
2355
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2356
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2357
|
+
import_v417.z.object({
|
|
2358
|
+
action: import_v417.z.discriminatedUnion("type", [
|
|
2359
|
+
import_v417.z.object({
|
|
2360
|
+
type: import_v417.z.literal("search"),
|
|
2361
|
+
query: import_v417.z.string().optional()
|
|
2362
|
+
}),
|
|
2363
|
+
import_v417.z.object({
|
|
2364
|
+
type: import_v417.z.literal("openPage"),
|
|
2365
|
+
url: import_v417.z.string().nullish()
|
|
2366
|
+
}),
|
|
2367
|
+
import_v417.z.object({
|
|
2368
|
+
type: import_v417.z.literal("findInPage"),
|
|
2369
|
+
url: import_v417.z.string().nullish(),
|
|
2370
|
+
pattern: import_v417.z.string().nullish()
|
|
2371
|
+
})
|
|
2344
2372
|
]).optional()
|
|
2345
2373
|
})
|
|
2346
2374
|
)
|
|
2347
2375
|
);
|
|
2348
|
-
var webSearchPreview = (0,
|
|
2376
|
+
var webSearchPreview = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
|
|
2349
2377
|
id: "openai.web_search_preview",
|
|
2350
2378
|
inputSchema: webSearchPreviewInputSchema,
|
|
2351
2379
|
outputSchema: webSearchPreviewOutputSchema
|
|
2352
2380
|
});
|
|
2353
2381
|
|
|
2354
2382
|
// src/tool/mcp.ts
|
|
2355
|
-
var
|
|
2356
|
-
var
|
|
2357
|
-
var jsonValueSchema =
|
|
2358
|
-
() =>
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2383
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2384
|
+
var import_v418 = require("zod/v4");
|
|
2385
|
+
var jsonValueSchema = import_v418.z.lazy(
|
|
2386
|
+
() => import_v418.z.union([
|
|
2387
|
+
import_v418.z.string(),
|
|
2388
|
+
import_v418.z.number(),
|
|
2389
|
+
import_v418.z.boolean(),
|
|
2390
|
+
import_v418.z.null(),
|
|
2391
|
+
import_v418.z.array(jsonValueSchema),
|
|
2392
|
+
import_v418.z.record(import_v418.z.string(), jsonValueSchema)
|
|
2365
2393
|
])
|
|
2366
2394
|
);
|
|
2367
|
-
var mcpArgsSchema = (0,
|
|
2368
|
-
() => (0,
|
|
2369
|
-
|
|
2370
|
-
serverLabel:
|
|
2371
|
-
allowedTools:
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
readOnly:
|
|
2375
|
-
toolNames:
|
|
2395
|
+
var mcpArgsSchema = (0, import_provider_utils23.lazySchema)(
|
|
2396
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2397
|
+
import_v418.z.object({
|
|
2398
|
+
serverLabel: import_v418.z.string(),
|
|
2399
|
+
allowedTools: import_v418.z.union([
|
|
2400
|
+
import_v418.z.array(import_v418.z.string()),
|
|
2401
|
+
import_v418.z.object({
|
|
2402
|
+
readOnly: import_v418.z.boolean().optional(),
|
|
2403
|
+
toolNames: import_v418.z.array(import_v418.z.string()).optional()
|
|
2376
2404
|
})
|
|
2377
2405
|
]).optional(),
|
|
2378
|
-
authorization:
|
|
2379
|
-
connectorId:
|
|
2380
|
-
headers:
|
|
2381
|
-
requireApproval:
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
never:
|
|
2385
|
-
toolNames:
|
|
2406
|
+
authorization: import_v418.z.string().optional(),
|
|
2407
|
+
connectorId: import_v418.z.string().optional(),
|
|
2408
|
+
headers: import_v418.z.record(import_v418.z.string(), import_v418.z.string()).optional(),
|
|
2409
|
+
requireApproval: import_v418.z.union([
|
|
2410
|
+
import_v418.z.enum(["always", "never"]),
|
|
2411
|
+
import_v418.z.object({
|
|
2412
|
+
never: import_v418.z.object({
|
|
2413
|
+
toolNames: import_v418.z.array(import_v418.z.string()).optional()
|
|
2386
2414
|
}).optional()
|
|
2387
2415
|
})
|
|
2388
2416
|
]).optional(),
|
|
2389
|
-
serverDescription:
|
|
2390
|
-
serverUrl:
|
|
2417
|
+
serverDescription: import_v418.z.string().optional(),
|
|
2418
|
+
serverUrl: import_v418.z.string().optional()
|
|
2391
2419
|
}).refine(
|
|
2392
2420
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2393
2421
|
"One of serverUrl or connectorId must be provided."
|
|
2394
2422
|
)
|
|
2395
2423
|
)
|
|
2396
2424
|
);
|
|
2397
|
-
var mcpInputSchema = (0,
|
|
2398
|
-
var mcpOutputSchema = (0,
|
|
2399
|
-
() => (0,
|
|
2400
|
-
|
|
2401
|
-
type:
|
|
2402
|
-
serverLabel:
|
|
2403
|
-
name:
|
|
2404
|
-
arguments:
|
|
2405
|
-
output:
|
|
2406
|
-
error:
|
|
2425
|
+
var mcpInputSchema = (0, import_provider_utils23.lazySchema)(() => (0, import_provider_utils23.zodSchema)(import_v418.z.object({})));
|
|
2426
|
+
var mcpOutputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2427
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2428
|
+
import_v418.z.object({
|
|
2429
|
+
type: import_v418.z.literal("call"),
|
|
2430
|
+
serverLabel: import_v418.z.string(),
|
|
2431
|
+
name: import_v418.z.string(),
|
|
2432
|
+
arguments: import_v418.z.string(),
|
|
2433
|
+
output: import_v418.z.string().nullish(),
|
|
2434
|
+
error: import_v418.z.union([import_v418.z.string(), jsonValueSchema]).optional()
|
|
2407
2435
|
})
|
|
2408
2436
|
)
|
|
2409
2437
|
);
|
|
2410
|
-
var mcpToolFactory = (0,
|
|
2438
|
+
var mcpToolFactory = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
|
|
2411
2439
|
id: "openai.mcp",
|
|
2412
2440
|
inputSchema: mcpInputSchema,
|
|
2413
2441
|
outputSchema: mcpOutputSchema
|
|
@@ -2424,6 +2452,16 @@ var openaiTools = {
|
|
|
2424
2452
|
*
|
|
2425
2453
|
*/
|
|
2426
2454
|
applyPatch,
|
|
2455
|
+
/**
|
|
2456
|
+
* Custom tools let callers constrain model output to a grammar (regex or
|
|
2457
|
+
* Lark syntax). The model returns a `custom_tool_call` output item whose
|
|
2458
|
+
* `input` field is a string matching the specified grammar.
|
|
2459
|
+
*
|
|
2460
|
+
* @param name - The name of the custom tool.
|
|
2461
|
+
* @param description - An optional description of the tool.
|
|
2462
|
+
* @param format - The output format constraint (grammar type, syntax, and definition).
|
|
2463
|
+
*/
|
|
2464
|
+
customTool,
|
|
2427
2465
|
/**
|
|
2428
2466
|
* The Code Interpreter tool allows models to write and run Python code in a
|
|
2429
2467
|
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
@@ -2464,7 +2502,7 @@ var openaiTools = {
|
|
|
2464
2502
|
* Local shell is a tool that allows agents to run shell commands locally
|
|
2465
2503
|
* on a machine you or the user provides.
|
|
2466
2504
|
*
|
|
2467
|
-
* Supported models: `gpt-5-codex`
|
|
2505
|
+
* Supported models: `gpt-5-codex`
|
|
2468
2506
|
*/
|
|
2469
2507
|
localShell,
|
|
2470
2508
|
/**
|
|
@@ -2514,7 +2552,7 @@ var openaiTools = {
|
|
|
2514
2552
|
|
|
2515
2553
|
// src/responses/openai-responses-language-model.ts
|
|
2516
2554
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2517
|
-
var
|
|
2555
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
2518
2556
|
|
|
2519
2557
|
// src/responses/convert-openai-responses-usage.ts
|
|
2520
2558
|
function convertOpenAIResponsesUsage(usage) {
|
|
@@ -2557,8 +2595,8 @@ function convertOpenAIResponsesUsage(usage) {
|
|
|
2557
2595
|
|
|
2558
2596
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2559
2597
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2560
|
-
var
|
|
2561
|
-
var
|
|
2598
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
2599
|
+
var import_v419 = require("zod/v4");
|
|
2562
2600
|
function isFileId(data, prefixes) {
|
|
2563
2601
|
if (!prefixes) return false;
|
|
2564
2602
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2573,9 +2611,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2573
2611
|
hasConversation = false,
|
|
2574
2612
|
hasLocalShellTool = false,
|
|
2575
2613
|
hasShellTool = false,
|
|
2576
|
-
hasApplyPatchTool = false
|
|
2614
|
+
hasApplyPatchTool = false,
|
|
2615
|
+
customProviderToolNames
|
|
2577
2616
|
}) {
|
|
2578
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2617
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2579
2618
|
const input = [];
|
|
2580
2619
|
const warnings = [];
|
|
2581
2620
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -2622,7 +2661,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2622
2661
|
return {
|
|
2623
2662
|
type: "input_image",
|
|
2624
2663
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2625
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2664
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils24.convertToBase64)(part.data)}`
|
|
2626
2665
|
},
|
|
2627
2666
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
|
|
2628
2667
|
};
|
|
@@ -2637,7 +2676,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2637
2676
|
type: "input_file",
|
|
2638
2677
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2639
2678
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2640
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2679
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils24.convertToBase64)(part.data)}`
|
|
2641
2680
|
}
|
|
2642
2681
|
};
|
|
2643
2682
|
} else {
|
|
@@ -2693,7 +2732,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2693
2732
|
part.toolName
|
|
2694
2733
|
);
|
|
2695
2734
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2696
|
-
const parsedInput = await (0,
|
|
2735
|
+
const parsedInput = await (0, import_provider_utils24.validateTypes)({
|
|
2697
2736
|
value: part.input,
|
|
2698
2737
|
schema: localShellInputSchema
|
|
2699
2738
|
});
|
|
@@ -2713,7 +2752,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2713
2752
|
break;
|
|
2714
2753
|
}
|
|
2715
2754
|
if (hasShellTool && resolvedToolName === "shell") {
|
|
2716
|
-
const parsedInput = await (0,
|
|
2755
|
+
const parsedInput = await (0, import_provider_utils24.validateTypes)({
|
|
2717
2756
|
value: part.input,
|
|
2718
2757
|
schema: shellInputSchema
|
|
2719
2758
|
});
|
|
@@ -2731,7 +2770,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2731
2770
|
break;
|
|
2732
2771
|
}
|
|
2733
2772
|
if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
|
|
2734
|
-
const parsedInput = await (0,
|
|
2773
|
+
const parsedInput = await (0, import_provider_utils24.validateTypes)({
|
|
2735
2774
|
value: part.input,
|
|
2736
2775
|
schema: applyPatchInputSchema
|
|
2737
2776
|
});
|
|
@@ -2744,6 +2783,16 @@ async function convertToOpenAIResponsesInput({
|
|
|
2744
2783
|
});
|
|
2745
2784
|
break;
|
|
2746
2785
|
}
|
|
2786
|
+
if (customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) {
|
|
2787
|
+
input.push({
|
|
2788
|
+
type: "custom_tool_call",
|
|
2789
|
+
call_id: part.toolCallId,
|
|
2790
|
+
name: resolvedToolName,
|
|
2791
|
+
input: typeof part.input === "string" ? part.input : JSON.stringify(part.input),
|
|
2792
|
+
id
|
|
2793
|
+
});
|
|
2794
|
+
break;
|
|
2795
|
+
}
|
|
2747
2796
|
input.push({
|
|
2748
2797
|
type: "function_call",
|
|
2749
2798
|
call_id: part.toolCallId,
|
|
@@ -2766,7 +2815,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2766
2815
|
);
|
|
2767
2816
|
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2768
2817
|
if (part.output.type === "json") {
|
|
2769
|
-
const parsedOutput = await (0,
|
|
2818
|
+
const parsedOutput = await (0, import_provider_utils24.validateTypes)({
|
|
2770
2819
|
value: part.output.value,
|
|
2771
2820
|
schema: shellOutputSchema
|
|
2772
2821
|
});
|
|
@@ -2797,7 +2846,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2797
2846
|
break;
|
|
2798
2847
|
}
|
|
2799
2848
|
case "reasoning": {
|
|
2800
|
-
const providerOptions = await (0,
|
|
2849
|
+
const providerOptions = await (0, import_provider_utils24.parseProviderOptions)({
|
|
2801
2850
|
provider: providerOptionsName,
|
|
2802
2851
|
providerOptions: part.providerOptions,
|
|
2803
2852
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2905,7 +2954,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2905
2954
|
part.toolName
|
|
2906
2955
|
);
|
|
2907
2956
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2908
|
-
const parsedOutput = await (0,
|
|
2957
|
+
const parsedOutput = await (0, import_provider_utils24.validateTypes)({
|
|
2909
2958
|
value: output.value,
|
|
2910
2959
|
schema: localShellOutputSchema
|
|
2911
2960
|
});
|
|
@@ -2917,7 +2966,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2917
2966
|
continue;
|
|
2918
2967
|
}
|
|
2919
2968
|
if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
|
|
2920
|
-
const parsedOutput = await (0,
|
|
2969
|
+
const parsedOutput = await (0, import_provider_utils24.validateTypes)({
|
|
2921
2970
|
value: output.value,
|
|
2922
2971
|
schema: shellOutputSchema
|
|
2923
2972
|
});
|
|
@@ -2936,7 +2985,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2936
2985
|
continue;
|
|
2937
2986
|
}
|
|
2938
2987
|
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
2939
|
-
const parsedOutput = await (0,
|
|
2988
|
+
const parsedOutput = await (0, import_provider_utils24.validateTypes)({
|
|
2940
2989
|
value: output.value,
|
|
2941
2990
|
schema: applyPatchOutputSchema
|
|
2942
2991
|
});
|
|
@@ -2948,6 +2997,61 @@ async function convertToOpenAIResponsesInput({
|
|
|
2948
2997
|
});
|
|
2949
2998
|
continue;
|
|
2950
2999
|
}
|
|
3000
|
+
if (customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) {
|
|
3001
|
+
let outputValue;
|
|
3002
|
+
switch (output.type) {
|
|
3003
|
+
case "text":
|
|
3004
|
+
case "error-text":
|
|
3005
|
+
outputValue = output.value;
|
|
3006
|
+
break;
|
|
3007
|
+
case "execution-denied":
|
|
3008
|
+
outputValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
|
|
3009
|
+
break;
|
|
3010
|
+
case "json":
|
|
3011
|
+
case "error-json":
|
|
3012
|
+
outputValue = JSON.stringify(output.value);
|
|
3013
|
+
break;
|
|
3014
|
+
case "content":
|
|
3015
|
+
outputValue = output.value.map((item) => {
|
|
3016
|
+
var _a2;
|
|
3017
|
+
switch (item.type) {
|
|
3018
|
+
case "text":
|
|
3019
|
+
return { type: "input_text", text: item.text };
|
|
3020
|
+
case "image-data":
|
|
3021
|
+
return {
|
|
3022
|
+
type: "input_image",
|
|
3023
|
+
image_url: `data:${item.mediaType};base64,${item.data}`
|
|
3024
|
+
};
|
|
3025
|
+
case "image-url":
|
|
3026
|
+
return {
|
|
3027
|
+
type: "input_image",
|
|
3028
|
+
image_url: item.url
|
|
3029
|
+
};
|
|
3030
|
+
case "file-data":
|
|
3031
|
+
return {
|
|
3032
|
+
type: "input_file",
|
|
3033
|
+
filename: (_a2 = item.filename) != null ? _a2 : "data",
|
|
3034
|
+
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3035
|
+
};
|
|
3036
|
+
default:
|
|
3037
|
+
warnings.push({
|
|
3038
|
+
type: "other",
|
|
3039
|
+
message: `unsupported custom tool content part type: ${item.type}`
|
|
3040
|
+
});
|
|
3041
|
+
return void 0;
|
|
3042
|
+
}
|
|
3043
|
+
}).filter(import_provider_utils24.isNonNullable);
|
|
3044
|
+
break;
|
|
3045
|
+
default:
|
|
3046
|
+
outputValue = "";
|
|
3047
|
+
}
|
|
3048
|
+
input.push({
|
|
3049
|
+
type: "custom_tool_call_output",
|
|
3050
|
+
call_id: part.toolCallId,
|
|
3051
|
+
output: outputValue
|
|
3052
|
+
});
|
|
3053
|
+
continue;
|
|
3054
|
+
}
|
|
2951
3055
|
let contentValue;
|
|
2952
3056
|
switch (output.type) {
|
|
2953
3057
|
case "text":
|
|
@@ -2955,7 +3059,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2955
3059
|
contentValue = output.value;
|
|
2956
3060
|
break;
|
|
2957
3061
|
case "execution-denied":
|
|
2958
|
-
contentValue = (
|
|
3062
|
+
contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
|
|
2959
3063
|
break;
|
|
2960
3064
|
case "json":
|
|
2961
3065
|
case "error-json":
|
|
@@ -2995,7 +3099,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2995
3099
|
return void 0;
|
|
2996
3100
|
}
|
|
2997
3101
|
}
|
|
2998
|
-
}).filter(
|
|
3102
|
+
}).filter(import_provider_utils24.isNonNullable);
|
|
2999
3103
|
break;
|
|
3000
3104
|
}
|
|
3001
3105
|
input.push({
|
|
@@ -3014,9 +3118,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
3014
3118
|
}
|
|
3015
3119
|
return { input, warnings };
|
|
3016
3120
|
}
|
|
3017
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3018
|
-
itemId:
|
|
3019
|
-
reasoningEncryptedContent:
|
|
3121
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v419.z.object({
|
|
3122
|
+
itemId: import_v419.z.string().nullish(),
|
|
3123
|
+
reasoningEncryptedContent: import_v419.z.string().nullish()
|
|
3020
3124
|
});
|
|
3021
3125
|
|
|
3022
3126
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3038,161 +3142,168 @@ function mapOpenAIResponseFinishReason({
|
|
|
3038
3142
|
}
|
|
3039
3143
|
|
|
3040
3144
|
// src/responses/openai-responses-api.ts
|
|
3041
|
-
var
|
|
3042
|
-
var
|
|
3043
|
-
var openaiResponsesChunkSchema = (0,
|
|
3044
|
-
() => (0,
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
type:
|
|
3048
|
-
item_id:
|
|
3049
|
-
delta:
|
|
3050
|
-
logprobs:
|
|
3051
|
-
|
|
3052
|
-
token:
|
|
3053
|
-
logprob:
|
|
3054
|
-
top_logprobs:
|
|
3055
|
-
|
|
3056
|
-
token:
|
|
3057
|
-
logprob:
|
|
3145
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
3146
|
+
var import_v420 = require("zod/v4");
|
|
3147
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils25.lazySchema)(
|
|
3148
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
3149
|
+
import_v420.z.union([
|
|
3150
|
+
import_v420.z.object({
|
|
3151
|
+
type: import_v420.z.literal("response.output_text.delta"),
|
|
3152
|
+
item_id: import_v420.z.string(),
|
|
3153
|
+
delta: import_v420.z.string(),
|
|
3154
|
+
logprobs: import_v420.z.array(
|
|
3155
|
+
import_v420.z.object({
|
|
3156
|
+
token: import_v420.z.string(),
|
|
3157
|
+
logprob: import_v420.z.number(),
|
|
3158
|
+
top_logprobs: import_v420.z.array(
|
|
3159
|
+
import_v420.z.object({
|
|
3160
|
+
token: import_v420.z.string(),
|
|
3161
|
+
logprob: import_v420.z.number()
|
|
3058
3162
|
})
|
|
3059
3163
|
)
|
|
3060
3164
|
})
|
|
3061
3165
|
).nullish()
|
|
3062
3166
|
}),
|
|
3063
|
-
|
|
3064
|
-
type:
|
|
3065
|
-
response:
|
|
3066
|
-
incomplete_details:
|
|
3067
|
-
usage:
|
|
3068
|
-
input_tokens:
|
|
3069
|
-
input_tokens_details:
|
|
3070
|
-
output_tokens:
|
|
3071
|
-
output_tokens_details:
|
|
3167
|
+
import_v420.z.object({
|
|
3168
|
+
type: import_v420.z.enum(["response.completed", "response.incomplete"]),
|
|
3169
|
+
response: import_v420.z.object({
|
|
3170
|
+
incomplete_details: import_v420.z.object({ reason: import_v420.z.string() }).nullish(),
|
|
3171
|
+
usage: import_v420.z.object({
|
|
3172
|
+
input_tokens: import_v420.z.number(),
|
|
3173
|
+
input_tokens_details: import_v420.z.object({ cached_tokens: import_v420.z.number().nullish() }).nullish(),
|
|
3174
|
+
output_tokens: import_v420.z.number(),
|
|
3175
|
+
output_tokens_details: import_v420.z.object({ reasoning_tokens: import_v420.z.number().nullish() }).nullish()
|
|
3072
3176
|
}),
|
|
3073
|
-
service_tier:
|
|
3177
|
+
service_tier: import_v420.z.string().nullish()
|
|
3074
3178
|
})
|
|
3075
3179
|
}),
|
|
3076
|
-
|
|
3077
|
-
type:
|
|
3078
|
-
response:
|
|
3079
|
-
id:
|
|
3080
|
-
created_at:
|
|
3081
|
-
model:
|
|
3082
|
-
service_tier:
|
|
3180
|
+
import_v420.z.object({
|
|
3181
|
+
type: import_v420.z.literal("response.created"),
|
|
3182
|
+
response: import_v420.z.object({
|
|
3183
|
+
id: import_v420.z.string(),
|
|
3184
|
+
created_at: import_v420.z.number(),
|
|
3185
|
+
model: import_v420.z.string(),
|
|
3186
|
+
service_tier: import_v420.z.string().nullish()
|
|
3083
3187
|
})
|
|
3084
3188
|
}),
|
|
3085
|
-
|
|
3086
|
-
type:
|
|
3087
|
-
output_index:
|
|
3088
|
-
item:
|
|
3089
|
-
|
|
3090
|
-
type:
|
|
3091
|
-
id:
|
|
3092
|
-
phase:
|
|
3189
|
+
import_v420.z.object({
|
|
3190
|
+
type: import_v420.z.literal("response.output_item.added"),
|
|
3191
|
+
output_index: import_v420.z.number(),
|
|
3192
|
+
item: import_v420.z.discriminatedUnion("type", [
|
|
3193
|
+
import_v420.z.object({
|
|
3194
|
+
type: import_v420.z.literal("message"),
|
|
3195
|
+
id: import_v420.z.string(),
|
|
3196
|
+
phase: import_v420.z.enum(["commentary", "final_answer"]).nullish()
|
|
3093
3197
|
}),
|
|
3094
|
-
|
|
3095
|
-
type:
|
|
3096
|
-
id:
|
|
3097
|
-
encrypted_content:
|
|
3198
|
+
import_v420.z.object({
|
|
3199
|
+
type: import_v420.z.literal("reasoning"),
|
|
3200
|
+
id: import_v420.z.string(),
|
|
3201
|
+
encrypted_content: import_v420.z.string().nullish()
|
|
3098
3202
|
}),
|
|
3099
|
-
|
|
3100
|
-
type:
|
|
3101
|
-
id:
|
|
3102
|
-
call_id:
|
|
3103
|
-
name:
|
|
3104
|
-
arguments:
|
|
3203
|
+
import_v420.z.object({
|
|
3204
|
+
type: import_v420.z.literal("function_call"),
|
|
3205
|
+
id: import_v420.z.string(),
|
|
3206
|
+
call_id: import_v420.z.string(),
|
|
3207
|
+
name: import_v420.z.string(),
|
|
3208
|
+
arguments: import_v420.z.string()
|
|
3105
3209
|
}),
|
|
3106
|
-
|
|
3107
|
-
type:
|
|
3108
|
-
id:
|
|
3109
|
-
status:
|
|
3210
|
+
import_v420.z.object({
|
|
3211
|
+
type: import_v420.z.literal("web_search_call"),
|
|
3212
|
+
id: import_v420.z.string(),
|
|
3213
|
+
status: import_v420.z.string()
|
|
3110
3214
|
}),
|
|
3111
|
-
|
|
3112
|
-
type:
|
|
3113
|
-
id:
|
|
3114
|
-
status:
|
|
3215
|
+
import_v420.z.object({
|
|
3216
|
+
type: import_v420.z.literal("computer_call"),
|
|
3217
|
+
id: import_v420.z.string(),
|
|
3218
|
+
status: import_v420.z.string()
|
|
3115
3219
|
}),
|
|
3116
|
-
|
|
3117
|
-
type:
|
|
3118
|
-
id:
|
|
3220
|
+
import_v420.z.object({
|
|
3221
|
+
type: import_v420.z.literal("file_search_call"),
|
|
3222
|
+
id: import_v420.z.string()
|
|
3119
3223
|
}),
|
|
3120
|
-
|
|
3121
|
-
type:
|
|
3122
|
-
id:
|
|
3224
|
+
import_v420.z.object({
|
|
3225
|
+
type: import_v420.z.literal("image_generation_call"),
|
|
3226
|
+
id: import_v420.z.string()
|
|
3123
3227
|
}),
|
|
3124
|
-
|
|
3125
|
-
type:
|
|
3126
|
-
id:
|
|
3127
|
-
container_id:
|
|
3128
|
-
code:
|
|
3129
|
-
outputs:
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3228
|
+
import_v420.z.object({
|
|
3229
|
+
type: import_v420.z.literal("code_interpreter_call"),
|
|
3230
|
+
id: import_v420.z.string(),
|
|
3231
|
+
container_id: import_v420.z.string(),
|
|
3232
|
+
code: import_v420.z.string().nullable(),
|
|
3233
|
+
outputs: import_v420.z.array(
|
|
3234
|
+
import_v420.z.discriminatedUnion("type", [
|
|
3235
|
+
import_v420.z.object({ type: import_v420.z.literal("logs"), logs: import_v420.z.string() }),
|
|
3236
|
+
import_v420.z.object({ type: import_v420.z.literal("image"), url: import_v420.z.string() })
|
|
3133
3237
|
])
|
|
3134
3238
|
).nullable(),
|
|
3135
|
-
status:
|
|
3239
|
+
status: import_v420.z.string()
|
|
3136
3240
|
}),
|
|
3137
|
-
|
|
3138
|
-
type:
|
|
3139
|
-
id:
|
|
3140
|
-
status:
|
|
3141
|
-
approval_request_id:
|
|
3241
|
+
import_v420.z.object({
|
|
3242
|
+
type: import_v420.z.literal("mcp_call"),
|
|
3243
|
+
id: import_v420.z.string(),
|
|
3244
|
+
status: import_v420.z.string(),
|
|
3245
|
+
approval_request_id: import_v420.z.string().nullish()
|
|
3142
3246
|
}),
|
|
3143
|
-
|
|
3144
|
-
type:
|
|
3145
|
-
id:
|
|
3247
|
+
import_v420.z.object({
|
|
3248
|
+
type: import_v420.z.literal("mcp_list_tools"),
|
|
3249
|
+
id: import_v420.z.string()
|
|
3146
3250
|
}),
|
|
3147
|
-
|
|
3148
|
-
type:
|
|
3149
|
-
id:
|
|
3251
|
+
import_v420.z.object({
|
|
3252
|
+
type: import_v420.z.literal("mcp_approval_request"),
|
|
3253
|
+
id: import_v420.z.string()
|
|
3150
3254
|
}),
|
|
3151
|
-
|
|
3152
|
-
type:
|
|
3153
|
-
id:
|
|
3154
|
-
call_id:
|
|
3155
|
-
status:
|
|
3156
|
-
operation:
|
|
3157
|
-
|
|
3158
|
-
type:
|
|
3159
|
-
path:
|
|
3160
|
-
diff:
|
|
3255
|
+
import_v420.z.object({
|
|
3256
|
+
type: import_v420.z.literal("apply_patch_call"),
|
|
3257
|
+
id: import_v420.z.string(),
|
|
3258
|
+
call_id: import_v420.z.string(),
|
|
3259
|
+
status: import_v420.z.enum(["in_progress", "completed"]),
|
|
3260
|
+
operation: import_v420.z.discriminatedUnion("type", [
|
|
3261
|
+
import_v420.z.object({
|
|
3262
|
+
type: import_v420.z.literal("create_file"),
|
|
3263
|
+
path: import_v420.z.string(),
|
|
3264
|
+
diff: import_v420.z.string()
|
|
3161
3265
|
}),
|
|
3162
|
-
|
|
3163
|
-
type:
|
|
3164
|
-
path:
|
|
3266
|
+
import_v420.z.object({
|
|
3267
|
+
type: import_v420.z.literal("delete_file"),
|
|
3268
|
+
path: import_v420.z.string()
|
|
3165
3269
|
}),
|
|
3166
|
-
|
|
3167
|
-
type:
|
|
3168
|
-
path:
|
|
3169
|
-
diff:
|
|
3270
|
+
import_v420.z.object({
|
|
3271
|
+
type: import_v420.z.literal("update_file"),
|
|
3272
|
+
path: import_v420.z.string(),
|
|
3273
|
+
diff: import_v420.z.string()
|
|
3170
3274
|
})
|
|
3171
3275
|
])
|
|
3172
3276
|
}),
|
|
3173
|
-
|
|
3174
|
-
type:
|
|
3175
|
-
id:
|
|
3176
|
-
call_id:
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3277
|
+
import_v420.z.object({
|
|
3278
|
+
type: import_v420.z.literal("custom_tool_call"),
|
|
3279
|
+
id: import_v420.z.string(),
|
|
3280
|
+
call_id: import_v420.z.string(),
|
|
3281
|
+
name: import_v420.z.string(),
|
|
3282
|
+
input: import_v420.z.string()
|
|
3283
|
+
}),
|
|
3284
|
+
import_v420.z.object({
|
|
3285
|
+
type: import_v420.z.literal("shell_call"),
|
|
3286
|
+
id: import_v420.z.string(),
|
|
3287
|
+
call_id: import_v420.z.string(),
|
|
3288
|
+
status: import_v420.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3289
|
+
action: import_v420.z.object({
|
|
3290
|
+
commands: import_v420.z.array(import_v420.z.string())
|
|
3180
3291
|
})
|
|
3181
3292
|
}),
|
|
3182
|
-
|
|
3183
|
-
type:
|
|
3184
|
-
id:
|
|
3185
|
-
call_id:
|
|
3186
|
-
status:
|
|
3187
|
-
output:
|
|
3188
|
-
|
|
3189
|
-
stdout:
|
|
3190
|
-
stderr:
|
|
3191
|
-
outcome:
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
type:
|
|
3195
|
-
exit_code:
|
|
3293
|
+
import_v420.z.object({
|
|
3294
|
+
type: import_v420.z.literal("shell_call_output"),
|
|
3295
|
+
id: import_v420.z.string(),
|
|
3296
|
+
call_id: import_v420.z.string(),
|
|
3297
|
+
status: import_v420.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3298
|
+
output: import_v420.z.array(
|
|
3299
|
+
import_v420.z.object({
|
|
3300
|
+
stdout: import_v420.z.string(),
|
|
3301
|
+
stderr: import_v420.z.string(),
|
|
3302
|
+
outcome: import_v420.z.discriminatedUnion("type", [
|
|
3303
|
+
import_v420.z.object({ type: import_v420.z.literal("timeout") }),
|
|
3304
|
+
import_v420.z.object({
|
|
3305
|
+
type: import_v420.z.literal("exit"),
|
|
3306
|
+
exit_code: import_v420.z.number()
|
|
3196
3307
|
})
|
|
3197
3308
|
])
|
|
3198
3309
|
})
|
|
@@ -3200,198 +3311,206 @@ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3200
3311
|
})
|
|
3201
3312
|
])
|
|
3202
3313
|
}),
|
|
3203
|
-
|
|
3204
|
-
type:
|
|
3205
|
-
output_index:
|
|
3206
|
-
item:
|
|
3207
|
-
|
|
3208
|
-
type:
|
|
3209
|
-
id:
|
|
3210
|
-
phase:
|
|
3314
|
+
import_v420.z.object({
|
|
3315
|
+
type: import_v420.z.literal("response.output_item.done"),
|
|
3316
|
+
output_index: import_v420.z.number(),
|
|
3317
|
+
item: import_v420.z.discriminatedUnion("type", [
|
|
3318
|
+
import_v420.z.object({
|
|
3319
|
+
type: import_v420.z.literal("message"),
|
|
3320
|
+
id: import_v420.z.string(),
|
|
3321
|
+
phase: import_v420.z.enum(["commentary", "final_answer"]).nullish()
|
|
3211
3322
|
}),
|
|
3212
|
-
|
|
3213
|
-
type:
|
|
3214
|
-
id:
|
|
3215
|
-
encrypted_content:
|
|
3323
|
+
import_v420.z.object({
|
|
3324
|
+
type: import_v420.z.literal("reasoning"),
|
|
3325
|
+
id: import_v420.z.string(),
|
|
3326
|
+
encrypted_content: import_v420.z.string().nullish()
|
|
3216
3327
|
}),
|
|
3217
|
-
|
|
3218
|
-
type:
|
|
3219
|
-
id:
|
|
3220
|
-
call_id:
|
|
3221
|
-
name:
|
|
3222
|
-
arguments:
|
|
3223
|
-
status:
|
|
3328
|
+
import_v420.z.object({
|
|
3329
|
+
type: import_v420.z.literal("function_call"),
|
|
3330
|
+
id: import_v420.z.string(),
|
|
3331
|
+
call_id: import_v420.z.string(),
|
|
3332
|
+
name: import_v420.z.string(),
|
|
3333
|
+
arguments: import_v420.z.string(),
|
|
3334
|
+
status: import_v420.z.literal("completed")
|
|
3224
3335
|
}),
|
|
3225
|
-
|
|
3226
|
-
type:
|
|
3227
|
-
id:
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3336
|
+
import_v420.z.object({
|
|
3337
|
+
type: import_v420.z.literal("custom_tool_call"),
|
|
3338
|
+
id: import_v420.z.string(),
|
|
3339
|
+
call_id: import_v420.z.string(),
|
|
3340
|
+
name: import_v420.z.string(),
|
|
3341
|
+
input: import_v420.z.string(),
|
|
3342
|
+
status: import_v420.z.literal("completed")
|
|
3343
|
+
}),
|
|
3344
|
+
import_v420.z.object({
|
|
3345
|
+
type: import_v420.z.literal("code_interpreter_call"),
|
|
3346
|
+
id: import_v420.z.string(),
|
|
3347
|
+
code: import_v420.z.string().nullable(),
|
|
3348
|
+
container_id: import_v420.z.string(),
|
|
3349
|
+
outputs: import_v420.z.array(
|
|
3350
|
+
import_v420.z.discriminatedUnion("type", [
|
|
3351
|
+
import_v420.z.object({ type: import_v420.z.literal("logs"), logs: import_v420.z.string() }),
|
|
3352
|
+
import_v420.z.object({ type: import_v420.z.literal("image"), url: import_v420.z.string() })
|
|
3234
3353
|
])
|
|
3235
3354
|
).nullable()
|
|
3236
3355
|
}),
|
|
3237
|
-
|
|
3238
|
-
type:
|
|
3239
|
-
id:
|
|
3240
|
-
result:
|
|
3356
|
+
import_v420.z.object({
|
|
3357
|
+
type: import_v420.z.literal("image_generation_call"),
|
|
3358
|
+
id: import_v420.z.string(),
|
|
3359
|
+
result: import_v420.z.string()
|
|
3241
3360
|
}),
|
|
3242
|
-
|
|
3243
|
-
type:
|
|
3244
|
-
id:
|
|
3245
|
-
status:
|
|
3246
|
-
action:
|
|
3247
|
-
|
|
3248
|
-
type:
|
|
3249
|
-
query:
|
|
3250
|
-
sources:
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3361
|
+
import_v420.z.object({
|
|
3362
|
+
type: import_v420.z.literal("web_search_call"),
|
|
3363
|
+
id: import_v420.z.string(),
|
|
3364
|
+
status: import_v420.z.string(),
|
|
3365
|
+
action: import_v420.z.discriminatedUnion("type", [
|
|
3366
|
+
import_v420.z.object({
|
|
3367
|
+
type: import_v420.z.literal("search"),
|
|
3368
|
+
query: import_v420.z.string().nullish(),
|
|
3369
|
+
sources: import_v420.z.array(
|
|
3370
|
+
import_v420.z.discriminatedUnion("type", [
|
|
3371
|
+
import_v420.z.object({ type: import_v420.z.literal("url"), url: import_v420.z.string() }),
|
|
3372
|
+
import_v420.z.object({ type: import_v420.z.literal("api"), name: import_v420.z.string() })
|
|
3254
3373
|
])
|
|
3255
3374
|
).nullish()
|
|
3256
3375
|
}),
|
|
3257
|
-
|
|
3258
|
-
type:
|
|
3259
|
-
url:
|
|
3376
|
+
import_v420.z.object({
|
|
3377
|
+
type: import_v420.z.literal("open_page"),
|
|
3378
|
+
url: import_v420.z.string().nullish()
|
|
3260
3379
|
}),
|
|
3261
|
-
|
|
3262
|
-
type:
|
|
3263
|
-
url:
|
|
3264
|
-
pattern:
|
|
3380
|
+
import_v420.z.object({
|
|
3381
|
+
type: import_v420.z.literal("find_in_page"),
|
|
3382
|
+
url: import_v420.z.string().nullish(),
|
|
3383
|
+
pattern: import_v420.z.string().nullish()
|
|
3265
3384
|
})
|
|
3266
3385
|
]).nullish()
|
|
3267
3386
|
}),
|
|
3268
|
-
|
|
3269
|
-
type:
|
|
3270
|
-
id:
|
|
3271
|
-
queries:
|
|
3272
|
-
results:
|
|
3273
|
-
|
|
3274
|
-
attributes:
|
|
3275
|
-
|
|
3276
|
-
|
|
3387
|
+
import_v420.z.object({
|
|
3388
|
+
type: import_v420.z.literal("file_search_call"),
|
|
3389
|
+
id: import_v420.z.string(),
|
|
3390
|
+
queries: import_v420.z.array(import_v420.z.string()),
|
|
3391
|
+
results: import_v420.z.array(
|
|
3392
|
+
import_v420.z.object({
|
|
3393
|
+
attributes: import_v420.z.record(
|
|
3394
|
+
import_v420.z.string(),
|
|
3395
|
+
import_v420.z.union([import_v420.z.string(), import_v420.z.number(), import_v420.z.boolean()])
|
|
3277
3396
|
),
|
|
3278
|
-
file_id:
|
|
3279
|
-
filename:
|
|
3280
|
-
score:
|
|
3281
|
-
text:
|
|
3397
|
+
file_id: import_v420.z.string(),
|
|
3398
|
+
filename: import_v420.z.string(),
|
|
3399
|
+
score: import_v420.z.number(),
|
|
3400
|
+
text: import_v420.z.string()
|
|
3282
3401
|
})
|
|
3283
3402
|
).nullish()
|
|
3284
3403
|
}),
|
|
3285
|
-
|
|
3286
|
-
type:
|
|
3287
|
-
id:
|
|
3288
|
-
call_id:
|
|
3289
|
-
action:
|
|
3290
|
-
type:
|
|
3291
|
-
command:
|
|
3292
|
-
timeout_ms:
|
|
3293
|
-
user:
|
|
3294
|
-
working_directory:
|
|
3295
|
-
env:
|
|
3404
|
+
import_v420.z.object({
|
|
3405
|
+
type: import_v420.z.literal("local_shell_call"),
|
|
3406
|
+
id: import_v420.z.string(),
|
|
3407
|
+
call_id: import_v420.z.string(),
|
|
3408
|
+
action: import_v420.z.object({
|
|
3409
|
+
type: import_v420.z.literal("exec"),
|
|
3410
|
+
command: import_v420.z.array(import_v420.z.string()),
|
|
3411
|
+
timeout_ms: import_v420.z.number().optional(),
|
|
3412
|
+
user: import_v420.z.string().optional(),
|
|
3413
|
+
working_directory: import_v420.z.string().optional(),
|
|
3414
|
+
env: import_v420.z.record(import_v420.z.string(), import_v420.z.string()).optional()
|
|
3296
3415
|
})
|
|
3297
3416
|
}),
|
|
3298
|
-
|
|
3299
|
-
type:
|
|
3300
|
-
id:
|
|
3301
|
-
status:
|
|
3417
|
+
import_v420.z.object({
|
|
3418
|
+
type: import_v420.z.literal("computer_call"),
|
|
3419
|
+
id: import_v420.z.string(),
|
|
3420
|
+
status: import_v420.z.literal("completed")
|
|
3302
3421
|
}),
|
|
3303
|
-
|
|
3304
|
-
type:
|
|
3305
|
-
id:
|
|
3306
|
-
status:
|
|
3307
|
-
arguments:
|
|
3308
|
-
name:
|
|
3309
|
-
server_label:
|
|
3310
|
-
output:
|
|
3311
|
-
error:
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
type:
|
|
3315
|
-
code:
|
|
3316
|
-
message:
|
|
3422
|
+
import_v420.z.object({
|
|
3423
|
+
type: import_v420.z.literal("mcp_call"),
|
|
3424
|
+
id: import_v420.z.string(),
|
|
3425
|
+
status: import_v420.z.string(),
|
|
3426
|
+
arguments: import_v420.z.string(),
|
|
3427
|
+
name: import_v420.z.string(),
|
|
3428
|
+
server_label: import_v420.z.string(),
|
|
3429
|
+
output: import_v420.z.string().nullish(),
|
|
3430
|
+
error: import_v420.z.union([
|
|
3431
|
+
import_v420.z.string(),
|
|
3432
|
+
import_v420.z.object({
|
|
3433
|
+
type: import_v420.z.string().optional(),
|
|
3434
|
+
code: import_v420.z.union([import_v420.z.number(), import_v420.z.string()]).optional(),
|
|
3435
|
+
message: import_v420.z.string().optional()
|
|
3317
3436
|
}).loose()
|
|
3318
3437
|
]).nullish(),
|
|
3319
|
-
approval_request_id:
|
|
3438
|
+
approval_request_id: import_v420.z.string().nullish()
|
|
3320
3439
|
}),
|
|
3321
|
-
|
|
3322
|
-
type:
|
|
3323
|
-
id:
|
|
3324
|
-
server_label:
|
|
3325
|
-
tools:
|
|
3326
|
-
|
|
3327
|
-
name:
|
|
3328
|
-
description:
|
|
3329
|
-
input_schema:
|
|
3330
|
-
annotations:
|
|
3440
|
+
import_v420.z.object({
|
|
3441
|
+
type: import_v420.z.literal("mcp_list_tools"),
|
|
3442
|
+
id: import_v420.z.string(),
|
|
3443
|
+
server_label: import_v420.z.string(),
|
|
3444
|
+
tools: import_v420.z.array(
|
|
3445
|
+
import_v420.z.object({
|
|
3446
|
+
name: import_v420.z.string(),
|
|
3447
|
+
description: import_v420.z.string().optional(),
|
|
3448
|
+
input_schema: import_v420.z.any(),
|
|
3449
|
+
annotations: import_v420.z.record(import_v420.z.string(), import_v420.z.unknown()).optional()
|
|
3331
3450
|
})
|
|
3332
3451
|
),
|
|
3333
|
-
error:
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
type:
|
|
3337
|
-
code:
|
|
3338
|
-
message:
|
|
3452
|
+
error: import_v420.z.union([
|
|
3453
|
+
import_v420.z.string(),
|
|
3454
|
+
import_v420.z.object({
|
|
3455
|
+
type: import_v420.z.string().optional(),
|
|
3456
|
+
code: import_v420.z.union([import_v420.z.number(), import_v420.z.string()]).optional(),
|
|
3457
|
+
message: import_v420.z.string().optional()
|
|
3339
3458
|
}).loose()
|
|
3340
3459
|
]).optional()
|
|
3341
3460
|
}),
|
|
3342
|
-
|
|
3343
|
-
type:
|
|
3344
|
-
id:
|
|
3345
|
-
server_label:
|
|
3346
|
-
name:
|
|
3347
|
-
arguments:
|
|
3348
|
-
approval_request_id:
|
|
3461
|
+
import_v420.z.object({
|
|
3462
|
+
type: import_v420.z.literal("mcp_approval_request"),
|
|
3463
|
+
id: import_v420.z.string(),
|
|
3464
|
+
server_label: import_v420.z.string(),
|
|
3465
|
+
name: import_v420.z.string(),
|
|
3466
|
+
arguments: import_v420.z.string(),
|
|
3467
|
+
approval_request_id: import_v420.z.string().optional()
|
|
3349
3468
|
}),
|
|
3350
|
-
|
|
3351
|
-
type:
|
|
3352
|
-
id:
|
|
3353
|
-
call_id:
|
|
3354
|
-
status:
|
|
3355
|
-
operation:
|
|
3356
|
-
|
|
3357
|
-
type:
|
|
3358
|
-
path:
|
|
3359
|
-
diff:
|
|
3469
|
+
import_v420.z.object({
|
|
3470
|
+
type: import_v420.z.literal("apply_patch_call"),
|
|
3471
|
+
id: import_v420.z.string(),
|
|
3472
|
+
call_id: import_v420.z.string(),
|
|
3473
|
+
status: import_v420.z.enum(["in_progress", "completed"]),
|
|
3474
|
+
operation: import_v420.z.discriminatedUnion("type", [
|
|
3475
|
+
import_v420.z.object({
|
|
3476
|
+
type: import_v420.z.literal("create_file"),
|
|
3477
|
+
path: import_v420.z.string(),
|
|
3478
|
+
diff: import_v420.z.string()
|
|
3360
3479
|
}),
|
|
3361
|
-
|
|
3362
|
-
type:
|
|
3363
|
-
path:
|
|
3480
|
+
import_v420.z.object({
|
|
3481
|
+
type: import_v420.z.literal("delete_file"),
|
|
3482
|
+
path: import_v420.z.string()
|
|
3364
3483
|
}),
|
|
3365
|
-
|
|
3366
|
-
type:
|
|
3367
|
-
path:
|
|
3368
|
-
diff:
|
|
3484
|
+
import_v420.z.object({
|
|
3485
|
+
type: import_v420.z.literal("update_file"),
|
|
3486
|
+
path: import_v420.z.string(),
|
|
3487
|
+
diff: import_v420.z.string()
|
|
3369
3488
|
})
|
|
3370
3489
|
])
|
|
3371
3490
|
}),
|
|
3372
|
-
|
|
3373
|
-
type:
|
|
3374
|
-
id:
|
|
3375
|
-
call_id:
|
|
3376
|
-
status:
|
|
3377
|
-
action:
|
|
3378
|
-
commands:
|
|
3491
|
+
import_v420.z.object({
|
|
3492
|
+
type: import_v420.z.literal("shell_call"),
|
|
3493
|
+
id: import_v420.z.string(),
|
|
3494
|
+
call_id: import_v420.z.string(),
|
|
3495
|
+
status: import_v420.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3496
|
+
action: import_v420.z.object({
|
|
3497
|
+
commands: import_v420.z.array(import_v420.z.string())
|
|
3379
3498
|
})
|
|
3380
3499
|
}),
|
|
3381
|
-
|
|
3382
|
-
type:
|
|
3383
|
-
id:
|
|
3384
|
-
call_id:
|
|
3385
|
-
status:
|
|
3386
|
-
output:
|
|
3387
|
-
|
|
3388
|
-
stdout:
|
|
3389
|
-
stderr:
|
|
3390
|
-
outcome:
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
type:
|
|
3394
|
-
exit_code:
|
|
3500
|
+
import_v420.z.object({
|
|
3501
|
+
type: import_v420.z.literal("shell_call_output"),
|
|
3502
|
+
id: import_v420.z.string(),
|
|
3503
|
+
call_id: import_v420.z.string(),
|
|
3504
|
+
status: import_v420.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3505
|
+
output: import_v420.z.array(
|
|
3506
|
+
import_v420.z.object({
|
|
3507
|
+
stdout: import_v420.z.string(),
|
|
3508
|
+
stderr: import_v420.z.string(),
|
|
3509
|
+
outcome: import_v420.z.discriminatedUnion("type", [
|
|
3510
|
+
import_v420.z.object({ type: import_v420.z.literal("timeout") }),
|
|
3511
|
+
import_v420.z.object({
|
|
3512
|
+
type: import_v420.z.literal("exit"),
|
|
3513
|
+
exit_code: import_v420.z.number()
|
|
3395
3514
|
})
|
|
3396
3515
|
])
|
|
3397
3516
|
})
|
|
@@ -3399,101 +3518,107 @@ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3399
3518
|
})
|
|
3400
3519
|
])
|
|
3401
3520
|
}),
|
|
3402
|
-
|
|
3403
|
-
type:
|
|
3404
|
-
item_id:
|
|
3405
|
-
output_index:
|
|
3406
|
-
delta:
|
|
3521
|
+
import_v420.z.object({
|
|
3522
|
+
type: import_v420.z.literal("response.function_call_arguments.delta"),
|
|
3523
|
+
item_id: import_v420.z.string(),
|
|
3524
|
+
output_index: import_v420.z.number(),
|
|
3525
|
+
delta: import_v420.z.string()
|
|
3526
|
+
}),
|
|
3527
|
+
import_v420.z.object({
|
|
3528
|
+
type: import_v420.z.literal("response.custom_tool_call_input.delta"),
|
|
3529
|
+
item_id: import_v420.z.string(),
|
|
3530
|
+
output_index: import_v420.z.number(),
|
|
3531
|
+
delta: import_v420.z.string()
|
|
3407
3532
|
}),
|
|
3408
|
-
|
|
3409
|
-
type:
|
|
3410
|
-
item_id:
|
|
3411
|
-
output_index:
|
|
3412
|
-
partial_image_b64:
|
|
3533
|
+
import_v420.z.object({
|
|
3534
|
+
type: import_v420.z.literal("response.image_generation_call.partial_image"),
|
|
3535
|
+
item_id: import_v420.z.string(),
|
|
3536
|
+
output_index: import_v420.z.number(),
|
|
3537
|
+
partial_image_b64: import_v420.z.string()
|
|
3413
3538
|
}),
|
|
3414
|
-
|
|
3415
|
-
type:
|
|
3416
|
-
item_id:
|
|
3417
|
-
output_index:
|
|
3418
|
-
delta:
|
|
3539
|
+
import_v420.z.object({
|
|
3540
|
+
type: import_v420.z.literal("response.code_interpreter_call_code.delta"),
|
|
3541
|
+
item_id: import_v420.z.string(),
|
|
3542
|
+
output_index: import_v420.z.number(),
|
|
3543
|
+
delta: import_v420.z.string()
|
|
3419
3544
|
}),
|
|
3420
|
-
|
|
3421
|
-
type:
|
|
3422
|
-
item_id:
|
|
3423
|
-
output_index:
|
|
3424
|
-
code:
|
|
3545
|
+
import_v420.z.object({
|
|
3546
|
+
type: import_v420.z.literal("response.code_interpreter_call_code.done"),
|
|
3547
|
+
item_id: import_v420.z.string(),
|
|
3548
|
+
output_index: import_v420.z.number(),
|
|
3549
|
+
code: import_v420.z.string()
|
|
3425
3550
|
}),
|
|
3426
|
-
|
|
3427
|
-
type:
|
|
3428
|
-
annotation:
|
|
3429
|
-
|
|
3430
|
-
type:
|
|
3431
|
-
start_index:
|
|
3432
|
-
end_index:
|
|
3433
|
-
url:
|
|
3434
|
-
title:
|
|
3551
|
+
import_v420.z.object({
|
|
3552
|
+
type: import_v420.z.literal("response.output_text.annotation.added"),
|
|
3553
|
+
annotation: import_v420.z.discriminatedUnion("type", [
|
|
3554
|
+
import_v420.z.object({
|
|
3555
|
+
type: import_v420.z.literal("url_citation"),
|
|
3556
|
+
start_index: import_v420.z.number(),
|
|
3557
|
+
end_index: import_v420.z.number(),
|
|
3558
|
+
url: import_v420.z.string(),
|
|
3559
|
+
title: import_v420.z.string()
|
|
3435
3560
|
}),
|
|
3436
|
-
|
|
3437
|
-
type:
|
|
3438
|
-
file_id:
|
|
3439
|
-
filename:
|
|
3440
|
-
index:
|
|
3561
|
+
import_v420.z.object({
|
|
3562
|
+
type: import_v420.z.literal("file_citation"),
|
|
3563
|
+
file_id: import_v420.z.string(),
|
|
3564
|
+
filename: import_v420.z.string(),
|
|
3565
|
+
index: import_v420.z.number()
|
|
3441
3566
|
}),
|
|
3442
|
-
|
|
3443
|
-
type:
|
|
3444
|
-
container_id:
|
|
3445
|
-
file_id:
|
|
3446
|
-
filename:
|
|
3447
|
-
start_index:
|
|
3448
|
-
end_index:
|
|
3567
|
+
import_v420.z.object({
|
|
3568
|
+
type: import_v420.z.literal("container_file_citation"),
|
|
3569
|
+
container_id: import_v420.z.string(),
|
|
3570
|
+
file_id: import_v420.z.string(),
|
|
3571
|
+
filename: import_v420.z.string(),
|
|
3572
|
+
start_index: import_v420.z.number(),
|
|
3573
|
+
end_index: import_v420.z.number()
|
|
3449
3574
|
}),
|
|
3450
|
-
|
|
3451
|
-
type:
|
|
3452
|
-
file_id:
|
|
3453
|
-
index:
|
|
3575
|
+
import_v420.z.object({
|
|
3576
|
+
type: import_v420.z.literal("file_path"),
|
|
3577
|
+
file_id: import_v420.z.string(),
|
|
3578
|
+
index: import_v420.z.number()
|
|
3454
3579
|
})
|
|
3455
3580
|
])
|
|
3456
3581
|
}),
|
|
3457
|
-
|
|
3458
|
-
type:
|
|
3459
|
-
item_id:
|
|
3460
|
-
summary_index:
|
|
3582
|
+
import_v420.z.object({
|
|
3583
|
+
type: import_v420.z.literal("response.reasoning_summary_part.added"),
|
|
3584
|
+
item_id: import_v420.z.string(),
|
|
3585
|
+
summary_index: import_v420.z.number()
|
|
3461
3586
|
}),
|
|
3462
|
-
|
|
3463
|
-
type:
|
|
3464
|
-
item_id:
|
|
3465
|
-
summary_index:
|
|
3466
|
-
delta:
|
|
3587
|
+
import_v420.z.object({
|
|
3588
|
+
type: import_v420.z.literal("response.reasoning_summary_text.delta"),
|
|
3589
|
+
item_id: import_v420.z.string(),
|
|
3590
|
+
summary_index: import_v420.z.number(),
|
|
3591
|
+
delta: import_v420.z.string()
|
|
3467
3592
|
}),
|
|
3468
|
-
|
|
3469
|
-
type:
|
|
3470
|
-
item_id:
|
|
3471
|
-
summary_index:
|
|
3593
|
+
import_v420.z.object({
|
|
3594
|
+
type: import_v420.z.literal("response.reasoning_summary_part.done"),
|
|
3595
|
+
item_id: import_v420.z.string(),
|
|
3596
|
+
summary_index: import_v420.z.number()
|
|
3472
3597
|
}),
|
|
3473
|
-
|
|
3474
|
-
type:
|
|
3475
|
-
item_id:
|
|
3476
|
-
output_index:
|
|
3477
|
-
delta:
|
|
3478
|
-
obfuscation:
|
|
3598
|
+
import_v420.z.object({
|
|
3599
|
+
type: import_v420.z.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3600
|
+
item_id: import_v420.z.string(),
|
|
3601
|
+
output_index: import_v420.z.number(),
|
|
3602
|
+
delta: import_v420.z.string(),
|
|
3603
|
+
obfuscation: import_v420.z.string().nullish()
|
|
3479
3604
|
}),
|
|
3480
|
-
|
|
3481
|
-
type:
|
|
3482
|
-
item_id:
|
|
3483
|
-
output_index:
|
|
3484
|
-
diff:
|
|
3605
|
+
import_v420.z.object({
|
|
3606
|
+
type: import_v420.z.literal("response.apply_patch_call_operation_diff.done"),
|
|
3607
|
+
item_id: import_v420.z.string(),
|
|
3608
|
+
output_index: import_v420.z.number(),
|
|
3609
|
+
diff: import_v420.z.string()
|
|
3485
3610
|
}),
|
|
3486
|
-
|
|
3487
|
-
type:
|
|
3488
|
-
sequence_number:
|
|
3489
|
-
error:
|
|
3490
|
-
type:
|
|
3491
|
-
code:
|
|
3492
|
-
message:
|
|
3493
|
-
param:
|
|
3611
|
+
import_v420.z.object({
|
|
3612
|
+
type: import_v420.z.literal("error"),
|
|
3613
|
+
sequence_number: import_v420.z.number(),
|
|
3614
|
+
error: import_v420.z.object({
|
|
3615
|
+
type: import_v420.z.string(),
|
|
3616
|
+
code: import_v420.z.string(),
|
|
3617
|
+
message: import_v420.z.string(),
|
|
3618
|
+
param: import_v420.z.string().nullish()
|
|
3494
3619
|
})
|
|
3495
3620
|
}),
|
|
3496
|
-
|
|
3621
|
+
import_v420.z.object({ type: import_v420.z.string() }).loose().transform((value) => ({
|
|
3497
3622
|
type: "unknown_chunk",
|
|
3498
3623
|
message: value.type
|
|
3499
3624
|
}))
|
|
@@ -3501,265 +3626,272 @@ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3501
3626
|
])
|
|
3502
3627
|
)
|
|
3503
3628
|
);
|
|
3504
|
-
var openaiResponsesResponseSchema = (0,
|
|
3505
|
-
() => (0,
|
|
3506
|
-
|
|
3507
|
-
id:
|
|
3508
|
-
created_at:
|
|
3509
|
-
error:
|
|
3510
|
-
message:
|
|
3511
|
-
type:
|
|
3512
|
-
param:
|
|
3513
|
-
code:
|
|
3629
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils25.lazySchema)(
|
|
3630
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
3631
|
+
import_v420.z.object({
|
|
3632
|
+
id: import_v420.z.string().optional(),
|
|
3633
|
+
created_at: import_v420.z.number().optional(),
|
|
3634
|
+
error: import_v420.z.object({
|
|
3635
|
+
message: import_v420.z.string(),
|
|
3636
|
+
type: import_v420.z.string(),
|
|
3637
|
+
param: import_v420.z.string().nullish(),
|
|
3638
|
+
code: import_v420.z.string()
|
|
3514
3639
|
}).nullish(),
|
|
3515
|
-
model:
|
|
3516
|
-
output:
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
type:
|
|
3520
|
-
role:
|
|
3521
|
-
id:
|
|
3522
|
-
phase:
|
|
3523
|
-
content:
|
|
3524
|
-
|
|
3525
|
-
type:
|
|
3526
|
-
text:
|
|
3527
|
-
logprobs:
|
|
3528
|
-
|
|
3529
|
-
token:
|
|
3530
|
-
logprob:
|
|
3531
|
-
top_logprobs:
|
|
3532
|
-
|
|
3533
|
-
token:
|
|
3534
|
-
logprob:
|
|
3640
|
+
model: import_v420.z.string().optional(),
|
|
3641
|
+
output: import_v420.z.array(
|
|
3642
|
+
import_v420.z.discriminatedUnion("type", [
|
|
3643
|
+
import_v420.z.object({
|
|
3644
|
+
type: import_v420.z.literal("message"),
|
|
3645
|
+
role: import_v420.z.literal("assistant"),
|
|
3646
|
+
id: import_v420.z.string(),
|
|
3647
|
+
phase: import_v420.z.enum(["commentary", "final_answer"]).nullish(),
|
|
3648
|
+
content: import_v420.z.array(
|
|
3649
|
+
import_v420.z.object({
|
|
3650
|
+
type: import_v420.z.literal("output_text"),
|
|
3651
|
+
text: import_v420.z.string(),
|
|
3652
|
+
logprobs: import_v420.z.array(
|
|
3653
|
+
import_v420.z.object({
|
|
3654
|
+
token: import_v420.z.string(),
|
|
3655
|
+
logprob: import_v420.z.number(),
|
|
3656
|
+
top_logprobs: import_v420.z.array(
|
|
3657
|
+
import_v420.z.object({
|
|
3658
|
+
token: import_v420.z.string(),
|
|
3659
|
+
logprob: import_v420.z.number()
|
|
3535
3660
|
})
|
|
3536
3661
|
)
|
|
3537
3662
|
})
|
|
3538
3663
|
).nullish(),
|
|
3539
|
-
annotations:
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
type:
|
|
3543
|
-
start_index:
|
|
3544
|
-
end_index:
|
|
3545
|
-
url:
|
|
3546
|
-
title:
|
|
3664
|
+
annotations: import_v420.z.array(
|
|
3665
|
+
import_v420.z.discriminatedUnion("type", [
|
|
3666
|
+
import_v420.z.object({
|
|
3667
|
+
type: import_v420.z.literal("url_citation"),
|
|
3668
|
+
start_index: import_v420.z.number(),
|
|
3669
|
+
end_index: import_v420.z.number(),
|
|
3670
|
+
url: import_v420.z.string(),
|
|
3671
|
+
title: import_v420.z.string()
|
|
3547
3672
|
}),
|
|
3548
|
-
|
|
3549
|
-
type:
|
|
3550
|
-
file_id:
|
|
3551
|
-
filename:
|
|
3552
|
-
index:
|
|
3673
|
+
import_v420.z.object({
|
|
3674
|
+
type: import_v420.z.literal("file_citation"),
|
|
3675
|
+
file_id: import_v420.z.string(),
|
|
3676
|
+
filename: import_v420.z.string(),
|
|
3677
|
+
index: import_v420.z.number()
|
|
3553
3678
|
}),
|
|
3554
|
-
|
|
3555
|
-
type:
|
|
3556
|
-
container_id:
|
|
3557
|
-
file_id:
|
|
3558
|
-
filename:
|
|
3559
|
-
start_index:
|
|
3560
|
-
end_index:
|
|
3679
|
+
import_v420.z.object({
|
|
3680
|
+
type: import_v420.z.literal("container_file_citation"),
|
|
3681
|
+
container_id: import_v420.z.string(),
|
|
3682
|
+
file_id: import_v420.z.string(),
|
|
3683
|
+
filename: import_v420.z.string(),
|
|
3684
|
+
start_index: import_v420.z.number(),
|
|
3685
|
+
end_index: import_v420.z.number()
|
|
3561
3686
|
}),
|
|
3562
|
-
|
|
3563
|
-
type:
|
|
3564
|
-
file_id:
|
|
3565
|
-
index:
|
|
3687
|
+
import_v420.z.object({
|
|
3688
|
+
type: import_v420.z.literal("file_path"),
|
|
3689
|
+
file_id: import_v420.z.string(),
|
|
3690
|
+
index: import_v420.z.number()
|
|
3566
3691
|
})
|
|
3567
3692
|
])
|
|
3568
3693
|
)
|
|
3569
3694
|
})
|
|
3570
3695
|
)
|
|
3571
3696
|
}),
|
|
3572
|
-
|
|
3573
|
-
type:
|
|
3574
|
-
id:
|
|
3575
|
-
status:
|
|
3576
|
-
action:
|
|
3577
|
-
|
|
3578
|
-
type:
|
|
3579
|
-
query:
|
|
3580
|
-
sources:
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
type:
|
|
3585
|
-
name:
|
|
3697
|
+
import_v420.z.object({
|
|
3698
|
+
type: import_v420.z.literal("web_search_call"),
|
|
3699
|
+
id: import_v420.z.string(),
|
|
3700
|
+
status: import_v420.z.string(),
|
|
3701
|
+
action: import_v420.z.discriminatedUnion("type", [
|
|
3702
|
+
import_v420.z.object({
|
|
3703
|
+
type: import_v420.z.literal("search"),
|
|
3704
|
+
query: import_v420.z.string().nullish(),
|
|
3705
|
+
sources: import_v420.z.array(
|
|
3706
|
+
import_v420.z.discriminatedUnion("type", [
|
|
3707
|
+
import_v420.z.object({ type: import_v420.z.literal("url"), url: import_v420.z.string() }),
|
|
3708
|
+
import_v420.z.object({
|
|
3709
|
+
type: import_v420.z.literal("api"),
|
|
3710
|
+
name: import_v420.z.string()
|
|
3586
3711
|
})
|
|
3587
3712
|
])
|
|
3588
3713
|
).nullish()
|
|
3589
3714
|
}),
|
|
3590
|
-
|
|
3591
|
-
type:
|
|
3592
|
-
url:
|
|
3715
|
+
import_v420.z.object({
|
|
3716
|
+
type: import_v420.z.literal("open_page"),
|
|
3717
|
+
url: import_v420.z.string().nullish()
|
|
3593
3718
|
}),
|
|
3594
|
-
|
|
3595
|
-
type:
|
|
3596
|
-
url:
|
|
3597
|
-
pattern:
|
|
3719
|
+
import_v420.z.object({
|
|
3720
|
+
type: import_v420.z.literal("find_in_page"),
|
|
3721
|
+
url: import_v420.z.string().nullish(),
|
|
3722
|
+
pattern: import_v420.z.string().nullish()
|
|
3598
3723
|
})
|
|
3599
3724
|
]).nullish()
|
|
3600
3725
|
}),
|
|
3601
|
-
|
|
3602
|
-
type:
|
|
3603
|
-
id:
|
|
3604
|
-
queries:
|
|
3605
|
-
results:
|
|
3606
|
-
|
|
3607
|
-
attributes:
|
|
3608
|
-
|
|
3609
|
-
|
|
3726
|
+
import_v420.z.object({
|
|
3727
|
+
type: import_v420.z.literal("file_search_call"),
|
|
3728
|
+
id: import_v420.z.string(),
|
|
3729
|
+
queries: import_v420.z.array(import_v420.z.string()),
|
|
3730
|
+
results: import_v420.z.array(
|
|
3731
|
+
import_v420.z.object({
|
|
3732
|
+
attributes: import_v420.z.record(
|
|
3733
|
+
import_v420.z.string(),
|
|
3734
|
+
import_v420.z.union([import_v420.z.string(), import_v420.z.number(), import_v420.z.boolean()])
|
|
3610
3735
|
),
|
|
3611
|
-
file_id:
|
|
3612
|
-
filename:
|
|
3613
|
-
score:
|
|
3614
|
-
text:
|
|
3736
|
+
file_id: import_v420.z.string(),
|
|
3737
|
+
filename: import_v420.z.string(),
|
|
3738
|
+
score: import_v420.z.number(),
|
|
3739
|
+
text: import_v420.z.string()
|
|
3615
3740
|
})
|
|
3616
3741
|
).nullish()
|
|
3617
3742
|
}),
|
|
3618
|
-
|
|
3619
|
-
type:
|
|
3620
|
-
id:
|
|
3621
|
-
code:
|
|
3622
|
-
container_id:
|
|
3623
|
-
outputs:
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3743
|
+
import_v420.z.object({
|
|
3744
|
+
type: import_v420.z.literal("code_interpreter_call"),
|
|
3745
|
+
id: import_v420.z.string(),
|
|
3746
|
+
code: import_v420.z.string().nullable(),
|
|
3747
|
+
container_id: import_v420.z.string(),
|
|
3748
|
+
outputs: import_v420.z.array(
|
|
3749
|
+
import_v420.z.discriminatedUnion("type", [
|
|
3750
|
+
import_v420.z.object({ type: import_v420.z.literal("logs"), logs: import_v420.z.string() }),
|
|
3751
|
+
import_v420.z.object({ type: import_v420.z.literal("image"), url: import_v420.z.string() })
|
|
3627
3752
|
])
|
|
3628
3753
|
).nullable()
|
|
3629
3754
|
}),
|
|
3630
|
-
|
|
3631
|
-
type:
|
|
3632
|
-
id:
|
|
3633
|
-
result:
|
|
3755
|
+
import_v420.z.object({
|
|
3756
|
+
type: import_v420.z.literal("image_generation_call"),
|
|
3757
|
+
id: import_v420.z.string(),
|
|
3758
|
+
result: import_v420.z.string()
|
|
3634
3759
|
}),
|
|
3635
|
-
|
|
3636
|
-
type:
|
|
3637
|
-
id:
|
|
3638
|
-
call_id:
|
|
3639
|
-
action:
|
|
3640
|
-
type:
|
|
3641
|
-
command:
|
|
3642
|
-
timeout_ms:
|
|
3643
|
-
user:
|
|
3644
|
-
working_directory:
|
|
3645
|
-
env:
|
|
3760
|
+
import_v420.z.object({
|
|
3761
|
+
type: import_v420.z.literal("local_shell_call"),
|
|
3762
|
+
id: import_v420.z.string(),
|
|
3763
|
+
call_id: import_v420.z.string(),
|
|
3764
|
+
action: import_v420.z.object({
|
|
3765
|
+
type: import_v420.z.literal("exec"),
|
|
3766
|
+
command: import_v420.z.array(import_v420.z.string()),
|
|
3767
|
+
timeout_ms: import_v420.z.number().optional(),
|
|
3768
|
+
user: import_v420.z.string().optional(),
|
|
3769
|
+
working_directory: import_v420.z.string().optional(),
|
|
3770
|
+
env: import_v420.z.record(import_v420.z.string(), import_v420.z.string()).optional()
|
|
3646
3771
|
})
|
|
3647
3772
|
}),
|
|
3648
|
-
|
|
3649
|
-
type:
|
|
3650
|
-
call_id:
|
|
3651
|
-
name:
|
|
3652
|
-
arguments:
|
|
3653
|
-
id:
|
|
3773
|
+
import_v420.z.object({
|
|
3774
|
+
type: import_v420.z.literal("function_call"),
|
|
3775
|
+
call_id: import_v420.z.string(),
|
|
3776
|
+
name: import_v420.z.string(),
|
|
3777
|
+
arguments: import_v420.z.string(),
|
|
3778
|
+
id: import_v420.z.string()
|
|
3654
3779
|
}),
|
|
3655
|
-
|
|
3656
|
-
type:
|
|
3657
|
-
|
|
3658
|
-
|
|
3780
|
+
import_v420.z.object({
|
|
3781
|
+
type: import_v420.z.literal("custom_tool_call"),
|
|
3782
|
+
call_id: import_v420.z.string(),
|
|
3783
|
+
name: import_v420.z.string(),
|
|
3784
|
+
input: import_v420.z.string(),
|
|
3785
|
+
id: import_v420.z.string()
|
|
3659
3786
|
}),
|
|
3660
|
-
|
|
3661
|
-
type:
|
|
3662
|
-
id:
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3787
|
+
import_v420.z.object({
|
|
3788
|
+
type: import_v420.z.literal("computer_call"),
|
|
3789
|
+
id: import_v420.z.string(),
|
|
3790
|
+
status: import_v420.z.string().optional()
|
|
3791
|
+
}),
|
|
3792
|
+
import_v420.z.object({
|
|
3793
|
+
type: import_v420.z.literal("reasoning"),
|
|
3794
|
+
id: import_v420.z.string(),
|
|
3795
|
+
encrypted_content: import_v420.z.string().nullish(),
|
|
3796
|
+
summary: import_v420.z.array(
|
|
3797
|
+
import_v420.z.object({
|
|
3798
|
+
type: import_v420.z.literal("summary_text"),
|
|
3799
|
+
text: import_v420.z.string()
|
|
3668
3800
|
})
|
|
3669
3801
|
)
|
|
3670
3802
|
}),
|
|
3671
|
-
|
|
3672
|
-
type:
|
|
3673
|
-
id:
|
|
3674
|
-
status:
|
|
3675
|
-
arguments:
|
|
3676
|
-
name:
|
|
3677
|
-
server_label:
|
|
3678
|
-
output:
|
|
3679
|
-
error:
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
type:
|
|
3683
|
-
code:
|
|
3684
|
-
message:
|
|
3803
|
+
import_v420.z.object({
|
|
3804
|
+
type: import_v420.z.literal("mcp_call"),
|
|
3805
|
+
id: import_v420.z.string(),
|
|
3806
|
+
status: import_v420.z.string(),
|
|
3807
|
+
arguments: import_v420.z.string(),
|
|
3808
|
+
name: import_v420.z.string(),
|
|
3809
|
+
server_label: import_v420.z.string(),
|
|
3810
|
+
output: import_v420.z.string().nullish(),
|
|
3811
|
+
error: import_v420.z.union([
|
|
3812
|
+
import_v420.z.string(),
|
|
3813
|
+
import_v420.z.object({
|
|
3814
|
+
type: import_v420.z.string().optional(),
|
|
3815
|
+
code: import_v420.z.union([import_v420.z.number(), import_v420.z.string()]).optional(),
|
|
3816
|
+
message: import_v420.z.string().optional()
|
|
3685
3817
|
}).loose()
|
|
3686
3818
|
]).nullish(),
|
|
3687
|
-
approval_request_id:
|
|
3819
|
+
approval_request_id: import_v420.z.string().nullish()
|
|
3688
3820
|
}),
|
|
3689
|
-
|
|
3690
|
-
type:
|
|
3691
|
-
id:
|
|
3692
|
-
server_label:
|
|
3693
|
-
tools:
|
|
3694
|
-
|
|
3695
|
-
name:
|
|
3696
|
-
description:
|
|
3697
|
-
input_schema:
|
|
3698
|
-
annotations:
|
|
3821
|
+
import_v420.z.object({
|
|
3822
|
+
type: import_v420.z.literal("mcp_list_tools"),
|
|
3823
|
+
id: import_v420.z.string(),
|
|
3824
|
+
server_label: import_v420.z.string(),
|
|
3825
|
+
tools: import_v420.z.array(
|
|
3826
|
+
import_v420.z.object({
|
|
3827
|
+
name: import_v420.z.string(),
|
|
3828
|
+
description: import_v420.z.string().optional(),
|
|
3829
|
+
input_schema: import_v420.z.any(),
|
|
3830
|
+
annotations: import_v420.z.record(import_v420.z.string(), import_v420.z.unknown()).optional()
|
|
3699
3831
|
})
|
|
3700
3832
|
),
|
|
3701
|
-
error:
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
type:
|
|
3705
|
-
code:
|
|
3706
|
-
message:
|
|
3833
|
+
error: import_v420.z.union([
|
|
3834
|
+
import_v420.z.string(),
|
|
3835
|
+
import_v420.z.object({
|
|
3836
|
+
type: import_v420.z.string().optional(),
|
|
3837
|
+
code: import_v420.z.union([import_v420.z.number(), import_v420.z.string()]).optional(),
|
|
3838
|
+
message: import_v420.z.string().optional()
|
|
3707
3839
|
}).loose()
|
|
3708
3840
|
]).optional()
|
|
3709
3841
|
}),
|
|
3710
|
-
|
|
3711
|
-
type:
|
|
3712
|
-
id:
|
|
3713
|
-
server_label:
|
|
3714
|
-
name:
|
|
3715
|
-
arguments:
|
|
3716
|
-
approval_request_id:
|
|
3842
|
+
import_v420.z.object({
|
|
3843
|
+
type: import_v420.z.literal("mcp_approval_request"),
|
|
3844
|
+
id: import_v420.z.string(),
|
|
3845
|
+
server_label: import_v420.z.string(),
|
|
3846
|
+
name: import_v420.z.string(),
|
|
3847
|
+
arguments: import_v420.z.string(),
|
|
3848
|
+
approval_request_id: import_v420.z.string().optional()
|
|
3717
3849
|
}),
|
|
3718
|
-
|
|
3719
|
-
type:
|
|
3720
|
-
id:
|
|
3721
|
-
call_id:
|
|
3722
|
-
status:
|
|
3723
|
-
operation:
|
|
3724
|
-
|
|
3725
|
-
type:
|
|
3726
|
-
path:
|
|
3727
|
-
diff:
|
|
3850
|
+
import_v420.z.object({
|
|
3851
|
+
type: import_v420.z.literal("apply_patch_call"),
|
|
3852
|
+
id: import_v420.z.string(),
|
|
3853
|
+
call_id: import_v420.z.string(),
|
|
3854
|
+
status: import_v420.z.enum(["in_progress", "completed"]),
|
|
3855
|
+
operation: import_v420.z.discriminatedUnion("type", [
|
|
3856
|
+
import_v420.z.object({
|
|
3857
|
+
type: import_v420.z.literal("create_file"),
|
|
3858
|
+
path: import_v420.z.string(),
|
|
3859
|
+
diff: import_v420.z.string()
|
|
3728
3860
|
}),
|
|
3729
|
-
|
|
3730
|
-
type:
|
|
3731
|
-
path:
|
|
3861
|
+
import_v420.z.object({
|
|
3862
|
+
type: import_v420.z.literal("delete_file"),
|
|
3863
|
+
path: import_v420.z.string()
|
|
3732
3864
|
}),
|
|
3733
|
-
|
|
3734
|
-
type:
|
|
3735
|
-
path:
|
|
3736
|
-
diff:
|
|
3865
|
+
import_v420.z.object({
|
|
3866
|
+
type: import_v420.z.literal("update_file"),
|
|
3867
|
+
path: import_v420.z.string(),
|
|
3868
|
+
diff: import_v420.z.string()
|
|
3737
3869
|
})
|
|
3738
3870
|
])
|
|
3739
3871
|
}),
|
|
3740
|
-
|
|
3741
|
-
type:
|
|
3742
|
-
id:
|
|
3743
|
-
call_id:
|
|
3744
|
-
status:
|
|
3745
|
-
action:
|
|
3746
|
-
commands:
|
|
3872
|
+
import_v420.z.object({
|
|
3873
|
+
type: import_v420.z.literal("shell_call"),
|
|
3874
|
+
id: import_v420.z.string(),
|
|
3875
|
+
call_id: import_v420.z.string(),
|
|
3876
|
+
status: import_v420.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3877
|
+
action: import_v420.z.object({
|
|
3878
|
+
commands: import_v420.z.array(import_v420.z.string())
|
|
3747
3879
|
})
|
|
3748
3880
|
}),
|
|
3749
|
-
|
|
3750
|
-
type:
|
|
3751
|
-
id:
|
|
3752
|
-
call_id:
|
|
3753
|
-
status:
|
|
3754
|
-
output:
|
|
3755
|
-
|
|
3756
|
-
stdout:
|
|
3757
|
-
stderr:
|
|
3758
|
-
outcome:
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
type:
|
|
3762
|
-
exit_code:
|
|
3881
|
+
import_v420.z.object({
|
|
3882
|
+
type: import_v420.z.literal("shell_call_output"),
|
|
3883
|
+
id: import_v420.z.string(),
|
|
3884
|
+
call_id: import_v420.z.string(),
|
|
3885
|
+
status: import_v420.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3886
|
+
output: import_v420.z.array(
|
|
3887
|
+
import_v420.z.object({
|
|
3888
|
+
stdout: import_v420.z.string(),
|
|
3889
|
+
stderr: import_v420.z.string(),
|
|
3890
|
+
outcome: import_v420.z.discriminatedUnion("type", [
|
|
3891
|
+
import_v420.z.object({ type: import_v420.z.literal("timeout") }),
|
|
3892
|
+
import_v420.z.object({
|
|
3893
|
+
type: import_v420.z.literal("exit"),
|
|
3894
|
+
exit_code: import_v420.z.number()
|
|
3763
3895
|
})
|
|
3764
3896
|
])
|
|
3765
3897
|
})
|
|
@@ -3767,37 +3899,31 @@ var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3767
3899
|
})
|
|
3768
3900
|
])
|
|
3769
3901
|
).optional(),
|
|
3770
|
-
service_tier:
|
|
3771
|
-
incomplete_details:
|
|
3772
|
-
usage:
|
|
3773
|
-
input_tokens:
|
|
3774
|
-
input_tokens_details:
|
|
3775
|
-
output_tokens:
|
|
3776
|
-
output_tokens_details:
|
|
3902
|
+
service_tier: import_v420.z.string().nullish(),
|
|
3903
|
+
incomplete_details: import_v420.z.object({ reason: import_v420.z.string() }).nullish(),
|
|
3904
|
+
usage: import_v420.z.object({
|
|
3905
|
+
input_tokens: import_v420.z.number(),
|
|
3906
|
+
input_tokens_details: import_v420.z.object({ cached_tokens: import_v420.z.number().nullish() }).nullish(),
|
|
3907
|
+
output_tokens: import_v420.z.number(),
|
|
3908
|
+
output_tokens_details: import_v420.z.object({ reasoning_tokens: import_v420.z.number().nullish() }).nullish()
|
|
3777
3909
|
}).optional()
|
|
3778
3910
|
})
|
|
3779
3911
|
)
|
|
3780
3912
|
);
|
|
3781
3913
|
|
|
3782
3914
|
// src/responses/openai-responses-options.ts
|
|
3783
|
-
var
|
|
3784
|
-
var
|
|
3915
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
3916
|
+
var import_v421 = require("zod/v4");
|
|
3785
3917
|
var TOP_LOGPROBS_MAX = 20;
|
|
3786
3918
|
var openaiResponsesReasoningModelIds = [
|
|
3787
3919
|
"o1",
|
|
3788
3920
|
"o1-2024-12-17",
|
|
3789
3921
|
"o3",
|
|
3790
3922
|
"o3-2025-04-16",
|
|
3791
|
-
"o3-deep-research",
|
|
3792
|
-
"o3-deep-research-2025-06-26",
|
|
3793
3923
|
"o3-mini",
|
|
3794
3924
|
"o3-mini-2025-01-31",
|
|
3795
3925
|
"o4-mini",
|
|
3796
3926
|
"o4-mini-2025-04-16",
|
|
3797
|
-
"o4-mini-deep-research",
|
|
3798
|
-
"o4-mini-deep-research-2025-06-26",
|
|
3799
|
-
"codex-mini-latest",
|
|
3800
|
-
"computer-use-preview",
|
|
3801
3927
|
"gpt-5",
|
|
3802
3928
|
"gpt-5-2025-08-07",
|
|
3803
3929
|
"gpt-5-codex",
|
|
@@ -3830,7 +3956,6 @@ var openaiResponsesModelIds = [
|
|
|
3830
3956
|
"gpt-4o-2024-08-06",
|
|
3831
3957
|
"gpt-4o-2024-11-20",
|
|
3832
3958
|
"gpt-4o-audio-preview",
|
|
3833
|
-
"gpt-4o-audio-preview-2024-10-01",
|
|
3834
3959
|
"gpt-4o-audio-preview-2024-12-17",
|
|
3835
3960
|
"gpt-4o-search-preview",
|
|
3836
3961
|
"gpt-4o-search-preview-2025-03-11",
|
|
@@ -3838,25 +3963,15 @@ var openaiResponsesModelIds = [
|
|
|
3838
3963
|
"gpt-4o-mini-search-preview-2025-03-11",
|
|
3839
3964
|
"gpt-4o-mini",
|
|
3840
3965
|
"gpt-4o-mini-2024-07-18",
|
|
3841
|
-
"gpt-4-turbo",
|
|
3842
|
-
"gpt-4-turbo-2024-04-09",
|
|
3843
|
-
"gpt-4-turbo-preview",
|
|
3844
|
-
"gpt-4-0125-preview",
|
|
3845
|
-
"gpt-4-1106-preview",
|
|
3846
|
-
"gpt-4",
|
|
3847
|
-
"gpt-4-0613",
|
|
3848
|
-
"gpt-4.5-preview",
|
|
3849
|
-
"gpt-4.5-preview-2025-02-27",
|
|
3850
3966
|
"gpt-3.5-turbo-0125",
|
|
3851
3967
|
"gpt-3.5-turbo",
|
|
3852
3968
|
"gpt-3.5-turbo-1106",
|
|
3853
|
-
"chatgpt-4o-latest",
|
|
3854
3969
|
"gpt-5-chat-latest",
|
|
3855
3970
|
...openaiResponsesReasoningModelIds
|
|
3856
3971
|
];
|
|
3857
|
-
var openaiLanguageModelResponsesOptionsSchema = (0,
|
|
3858
|
-
() => (0,
|
|
3859
|
-
|
|
3972
|
+
var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazySchema)(
|
|
3973
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
3974
|
+
import_v421.z.object({
|
|
3860
3975
|
/**
|
|
3861
3976
|
* The ID of the OpenAI Conversation to continue.
|
|
3862
3977
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -3864,13 +3979,13 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3864
3979
|
* Defaults to `undefined`.
|
|
3865
3980
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3866
3981
|
*/
|
|
3867
|
-
conversation:
|
|
3982
|
+
conversation: import_v421.z.string().nullish(),
|
|
3868
3983
|
/**
|
|
3869
3984
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
3870
3985
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
3871
3986
|
*/
|
|
3872
|
-
include:
|
|
3873
|
-
|
|
3987
|
+
include: import_v421.z.array(
|
|
3988
|
+
import_v421.z.enum([
|
|
3874
3989
|
"reasoning.encrypted_content",
|
|
3875
3990
|
// handled internally by default, only needed for unknown reasoning models
|
|
3876
3991
|
"file_search_call.results",
|
|
@@ -3882,7 +3997,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3882
3997
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
3883
3998
|
* Defaults to `undefined`.
|
|
3884
3999
|
*/
|
|
3885
|
-
instructions:
|
|
4000
|
+
instructions: import_v421.z.string().nullish(),
|
|
3886
4001
|
/**
|
|
3887
4002
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
3888
4003
|
* the response size and can slow down response times. However, it can
|
|
@@ -3897,30 +4012,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3897
4012
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3898
4013
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3899
4014
|
*/
|
|
3900
|
-
logprobs:
|
|
4015
|
+
logprobs: import_v421.z.union([import_v421.z.boolean(), import_v421.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3901
4016
|
/**
|
|
3902
4017
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3903
4018
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3904
4019
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3905
4020
|
*/
|
|
3906
|
-
maxToolCalls:
|
|
4021
|
+
maxToolCalls: import_v421.z.number().nullish(),
|
|
3907
4022
|
/**
|
|
3908
4023
|
* Additional metadata to store with the generation.
|
|
3909
4024
|
*/
|
|
3910
|
-
metadata:
|
|
4025
|
+
metadata: import_v421.z.any().nullish(),
|
|
3911
4026
|
/**
|
|
3912
4027
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
3913
4028
|
*/
|
|
3914
|
-
parallelToolCalls:
|
|
4029
|
+
parallelToolCalls: import_v421.z.boolean().nullish(),
|
|
3915
4030
|
/**
|
|
3916
4031
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
3917
4032
|
* Defaults to `undefined`.
|
|
3918
4033
|
*/
|
|
3919
|
-
previousResponseId:
|
|
4034
|
+
previousResponseId: import_v421.z.string().nullish(),
|
|
3920
4035
|
/**
|
|
3921
4036
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
3922
4037
|
*/
|
|
3923
|
-
promptCacheKey:
|
|
4038
|
+
promptCacheKey: import_v421.z.string().nullish(),
|
|
3924
4039
|
/**
|
|
3925
4040
|
* The retention policy for the prompt cache.
|
|
3926
4041
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -3929,7 +4044,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3929
4044
|
*
|
|
3930
4045
|
* @default 'in_memory'
|
|
3931
4046
|
*/
|
|
3932
|
-
promptCacheRetention:
|
|
4047
|
+
promptCacheRetention: import_v421.z.enum(["in_memory", "24h"]).nullish(),
|
|
3933
4048
|
/**
|
|
3934
4049
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3935
4050
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -3940,17 +4055,17 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3940
4055
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
3941
4056
|
* an error.
|
|
3942
4057
|
*/
|
|
3943
|
-
reasoningEffort:
|
|
4058
|
+
reasoningEffort: import_v421.z.string().nullish(),
|
|
3944
4059
|
/**
|
|
3945
4060
|
* Controls reasoning summary output from the model.
|
|
3946
4061
|
* Set to "auto" to automatically receive the richest level available,
|
|
3947
4062
|
* or "detailed" for comprehensive summaries.
|
|
3948
4063
|
*/
|
|
3949
|
-
reasoningSummary:
|
|
4064
|
+
reasoningSummary: import_v421.z.string().nullish(),
|
|
3950
4065
|
/**
|
|
3951
4066
|
* The identifier for safety monitoring and tracking.
|
|
3952
4067
|
*/
|
|
3953
|
-
safetyIdentifier:
|
|
4068
|
+
safetyIdentifier: import_v421.z.string().nullish(),
|
|
3954
4069
|
/**
|
|
3955
4070
|
* Service tier for the request.
|
|
3956
4071
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -3958,34 +4073,34 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3958
4073
|
*
|
|
3959
4074
|
* Defaults to 'auto'.
|
|
3960
4075
|
*/
|
|
3961
|
-
serviceTier:
|
|
4076
|
+
serviceTier: import_v421.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3962
4077
|
/**
|
|
3963
4078
|
* Whether to store the generation. Defaults to `true`.
|
|
3964
4079
|
*/
|
|
3965
|
-
store:
|
|
4080
|
+
store: import_v421.z.boolean().nullish(),
|
|
3966
4081
|
/**
|
|
3967
4082
|
* Whether to use strict JSON schema validation.
|
|
3968
4083
|
* Defaults to `true`.
|
|
3969
4084
|
*/
|
|
3970
|
-
strictJsonSchema:
|
|
4085
|
+
strictJsonSchema: import_v421.z.boolean().nullish(),
|
|
3971
4086
|
/**
|
|
3972
4087
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
3973
4088
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
3974
4089
|
* Valid values: 'low', 'medium', 'high'.
|
|
3975
4090
|
*/
|
|
3976
|
-
textVerbosity:
|
|
4091
|
+
textVerbosity: import_v421.z.enum(["low", "medium", "high"]).nullish(),
|
|
3977
4092
|
/**
|
|
3978
4093
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
3979
4094
|
* 'disabled' turns truncation off.
|
|
3980
4095
|
*/
|
|
3981
|
-
truncation:
|
|
4096
|
+
truncation: import_v421.z.enum(["auto", "disabled"]).nullish(),
|
|
3982
4097
|
/**
|
|
3983
4098
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
3984
4099
|
* monitor and detect abuse.
|
|
3985
4100
|
* Defaults to `undefined`.
|
|
3986
4101
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
3987
4102
|
*/
|
|
3988
|
-
user:
|
|
4103
|
+
user: import_v421.z.string().nullish(),
|
|
3989
4104
|
/**
|
|
3990
4105
|
* Override the system message mode for this model.
|
|
3991
4106
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -3994,7 +4109,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3994
4109
|
*
|
|
3995
4110
|
* If not specified, the mode is automatically determined based on the model.
|
|
3996
4111
|
*/
|
|
3997
|
-
systemMessageMode:
|
|
4112
|
+
systemMessageMode: import_v421.z.enum(["system", "developer", "remove"]).optional(),
|
|
3998
4113
|
/**
|
|
3999
4114
|
* Force treating this model as a reasoning model.
|
|
4000
4115
|
*
|
|
@@ -4004,24 +4119,28 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
4004
4119
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4005
4120
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4006
4121
|
*/
|
|
4007
|
-
forceReasoning:
|
|
4122
|
+
forceReasoning: import_v421.z.boolean().optional()
|
|
4008
4123
|
})
|
|
4009
4124
|
)
|
|
4010
4125
|
);
|
|
4011
4126
|
|
|
4012
4127
|
// src/responses/openai-responses-prepare-tools.ts
|
|
4013
4128
|
var import_provider7 = require("@ai-sdk/provider");
|
|
4014
|
-
var
|
|
4129
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
4015
4130
|
async function prepareResponsesTools({
|
|
4016
4131
|
tools,
|
|
4017
|
-
toolChoice
|
|
4132
|
+
toolChoice,
|
|
4133
|
+
toolNameMapping,
|
|
4134
|
+
customProviderToolNames
|
|
4018
4135
|
}) {
|
|
4136
|
+
var _a;
|
|
4019
4137
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
4020
4138
|
const toolWarnings = [];
|
|
4021
4139
|
if (tools == null) {
|
|
4022
4140
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
4023
4141
|
}
|
|
4024
4142
|
const openaiTools2 = [];
|
|
4143
|
+
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
4025
4144
|
for (const tool of tools) {
|
|
4026
4145
|
switch (tool.type) {
|
|
4027
4146
|
case "function":
|
|
@@ -4036,7 +4155,7 @@ async function prepareResponsesTools({
|
|
|
4036
4155
|
case "provider": {
|
|
4037
4156
|
switch (tool.id) {
|
|
4038
4157
|
case "openai.file_search": {
|
|
4039
|
-
const args = await (0,
|
|
4158
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4040
4159
|
value: tool.args,
|
|
4041
4160
|
schema: fileSearchArgsSchema
|
|
4042
4161
|
});
|
|
@@ -4059,7 +4178,7 @@ async function prepareResponsesTools({
|
|
|
4059
4178
|
break;
|
|
4060
4179
|
}
|
|
4061
4180
|
case "openai.shell": {
|
|
4062
|
-
const args = await (0,
|
|
4181
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4063
4182
|
value: tool.args,
|
|
4064
4183
|
schema: shellArgsSchema
|
|
4065
4184
|
});
|
|
@@ -4078,7 +4197,7 @@ async function prepareResponsesTools({
|
|
|
4078
4197
|
break;
|
|
4079
4198
|
}
|
|
4080
4199
|
case "openai.web_search_preview": {
|
|
4081
|
-
const args = await (0,
|
|
4200
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4082
4201
|
value: tool.args,
|
|
4083
4202
|
schema: webSearchPreviewArgsSchema
|
|
4084
4203
|
});
|
|
@@ -4090,7 +4209,7 @@ async function prepareResponsesTools({
|
|
|
4090
4209
|
break;
|
|
4091
4210
|
}
|
|
4092
4211
|
case "openai.web_search": {
|
|
4093
|
-
const args = await (0,
|
|
4212
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4094
4213
|
value: tool.args,
|
|
4095
4214
|
schema: webSearchArgsSchema
|
|
4096
4215
|
});
|
|
@@ -4104,7 +4223,7 @@ async function prepareResponsesTools({
|
|
|
4104
4223
|
break;
|
|
4105
4224
|
}
|
|
4106
4225
|
case "openai.code_interpreter": {
|
|
4107
|
-
const args = await (0,
|
|
4226
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4108
4227
|
value: tool.args,
|
|
4109
4228
|
schema: codeInterpreterArgsSchema
|
|
4110
4229
|
});
|
|
@@ -4115,7 +4234,7 @@ async function prepareResponsesTools({
|
|
|
4115
4234
|
break;
|
|
4116
4235
|
}
|
|
4117
4236
|
case "openai.image_generation": {
|
|
4118
|
-
const args = await (0,
|
|
4237
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4119
4238
|
value: tool.args,
|
|
4120
4239
|
schema: imageGenerationArgsSchema
|
|
4121
4240
|
});
|
|
@@ -4138,7 +4257,7 @@ async function prepareResponsesTools({
|
|
|
4138
4257
|
break;
|
|
4139
4258
|
}
|
|
4140
4259
|
case "openai.mcp": {
|
|
4141
|
-
const args = await (0,
|
|
4260
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4142
4261
|
value: tool.args,
|
|
4143
4262
|
schema: mcpArgsSchema
|
|
4144
4263
|
});
|
|
@@ -4163,6 +4282,20 @@ async function prepareResponsesTools({
|
|
|
4163
4282
|
});
|
|
4164
4283
|
break;
|
|
4165
4284
|
}
|
|
4285
|
+
case "openai.custom": {
|
|
4286
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4287
|
+
value: tool.args,
|
|
4288
|
+
schema: customArgsSchema
|
|
4289
|
+
});
|
|
4290
|
+
openaiTools2.push({
|
|
4291
|
+
type: "custom",
|
|
4292
|
+
name: args.name,
|
|
4293
|
+
description: args.description,
|
|
4294
|
+
format: args.format
|
|
4295
|
+
});
|
|
4296
|
+
resolvedCustomProviderToolNames.add(args.name);
|
|
4297
|
+
break;
|
|
4298
|
+
}
|
|
4166
4299
|
}
|
|
4167
4300
|
break;
|
|
4168
4301
|
}
|
|
@@ -4183,12 +4316,14 @@ async function prepareResponsesTools({
|
|
|
4183
4316
|
case "none":
|
|
4184
4317
|
case "required":
|
|
4185
4318
|
return { tools: openaiTools2, toolChoice: type, toolWarnings };
|
|
4186
|
-
case "tool":
|
|
4319
|
+
case "tool": {
|
|
4320
|
+
const resolvedToolName = (_a = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a : toolChoice.toolName;
|
|
4187
4321
|
return {
|
|
4188
4322
|
tools: openaiTools2,
|
|
4189
|
-
toolChoice:
|
|
4323
|
+
toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
|
|
4190
4324
|
toolWarnings
|
|
4191
4325
|
};
|
|
4326
|
+
}
|
|
4192
4327
|
default: {
|
|
4193
4328
|
const _exhaustiveCheck = type;
|
|
4194
4329
|
throw new import_provider7.UnsupportedFunctionalityError({
|
|
@@ -4307,13 +4442,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4307
4442
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
4308
4443
|
}
|
|
4309
4444
|
const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
|
|
4310
|
-
let openaiOptions = await (0,
|
|
4445
|
+
let openaiOptions = await (0, import_provider_utils28.parseProviderOptions)({
|
|
4311
4446
|
provider: providerOptionsName,
|
|
4312
4447
|
providerOptions,
|
|
4313
4448
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4314
4449
|
});
|
|
4315
4450
|
if (openaiOptions == null && providerOptionsName !== "openai") {
|
|
4316
|
-
openaiOptions = await (0,
|
|
4451
|
+
openaiOptions = await (0, import_provider_utils28.parseProviderOptions)({
|
|
4317
4452
|
provider: "openai",
|
|
4318
4453
|
providerOptions,
|
|
4319
4454
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
@@ -4327,7 +4462,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4327
4462
|
details: "conversation and previousResponseId cannot be used together"
|
|
4328
4463
|
});
|
|
4329
4464
|
}
|
|
4330
|
-
const toolNameMapping = (0,
|
|
4465
|
+
const toolNameMapping = (0, import_provider_utils28.createToolNameMapping)({
|
|
4331
4466
|
tools,
|
|
4332
4467
|
providerToolNames: {
|
|
4333
4468
|
"openai.code_interpreter": "code_interpreter",
|
|
@@ -4339,7 +4474,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4339
4474
|
"openai.web_search_preview": "web_search_preview",
|
|
4340
4475
|
"openai.mcp": "mcp",
|
|
4341
4476
|
"openai.apply_patch": "apply_patch"
|
|
4342
|
-
}
|
|
4477
|
+
},
|
|
4478
|
+
resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
|
|
4479
|
+
});
|
|
4480
|
+
const customProviderToolNames = /* @__PURE__ */ new Set();
|
|
4481
|
+
const {
|
|
4482
|
+
tools: openaiTools2,
|
|
4483
|
+
toolChoice: openaiToolChoice,
|
|
4484
|
+
toolWarnings
|
|
4485
|
+
} = await prepareResponsesTools({
|
|
4486
|
+
tools,
|
|
4487
|
+
toolChoice,
|
|
4488
|
+
toolNameMapping,
|
|
4489
|
+
customProviderToolNames
|
|
4343
4490
|
});
|
|
4344
4491
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
4345
4492
|
prompt,
|
|
@@ -4351,7 +4498,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4351
4498
|
hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
|
|
4352
4499
|
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
4353
4500
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
4354
|
-
hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
|
|
4501
|
+
hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
|
|
4502
|
+
customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0
|
|
4355
4503
|
});
|
|
4356
4504
|
warnings.push(...inputWarnings);
|
|
4357
4505
|
const strictJsonSchema = (_d = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _d : true;
|
|
@@ -4484,14 +4632,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4484
4632
|
});
|
|
4485
4633
|
delete baseArgs.service_tier;
|
|
4486
4634
|
}
|
|
4487
|
-
const {
|
|
4488
|
-
tools: openaiTools2,
|
|
4489
|
-
toolChoice: openaiToolChoice,
|
|
4490
|
-
toolWarnings
|
|
4491
|
-
} = await prepareResponsesTools({
|
|
4492
|
-
tools,
|
|
4493
|
-
toolChoice
|
|
4494
|
-
});
|
|
4495
4635
|
const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
|
|
4496
4636
|
(tool) => tool.type === "provider" && tool.id === "openai.shell"
|
|
4497
4637
|
)) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
|
|
@@ -4529,12 +4669,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4529
4669
|
responseHeaders,
|
|
4530
4670
|
value: response,
|
|
4531
4671
|
rawValue: rawResponse
|
|
4532
|
-
} = await (0,
|
|
4672
|
+
} = await (0, import_provider_utils28.postJsonToApi)({
|
|
4533
4673
|
url,
|
|
4534
|
-
headers: (0,
|
|
4674
|
+
headers: (0, import_provider_utils28.combineHeaders)(this.config.headers(), options.headers),
|
|
4535
4675
|
body,
|
|
4536
4676
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4537
|
-
successfulResponseHandler: (0,
|
|
4677
|
+
successfulResponseHandler: (0, import_provider_utils28.createJsonResponseHandler)(
|
|
4538
4678
|
openaiResponsesResponseSchema
|
|
4539
4679
|
),
|
|
4540
4680
|
abortSignal: options.abortSignal,
|
|
@@ -4669,7 +4809,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4669
4809
|
content.push({
|
|
4670
4810
|
type: "source",
|
|
4671
4811
|
sourceType: "url",
|
|
4672
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
4812
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils28.generateId)(),
|
|
4673
4813
|
url: annotation.url,
|
|
4674
4814
|
title: annotation.title
|
|
4675
4815
|
});
|
|
@@ -4677,7 +4817,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4677
4817
|
content.push({
|
|
4678
4818
|
type: "source",
|
|
4679
4819
|
sourceType: "document",
|
|
4680
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
4820
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils28.generateId)(),
|
|
4681
4821
|
mediaType: "text/plain",
|
|
4682
4822
|
title: annotation.filename,
|
|
4683
4823
|
filename: annotation.filename,
|
|
@@ -4693,7 +4833,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4693
4833
|
content.push({
|
|
4694
4834
|
type: "source",
|
|
4695
4835
|
sourceType: "document",
|
|
4696
|
-
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0,
|
|
4836
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils28.generateId)(),
|
|
4697
4837
|
mediaType: "text/plain",
|
|
4698
4838
|
title: annotation.filename,
|
|
4699
4839
|
filename: annotation.filename,
|
|
@@ -4709,7 +4849,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4709
4849
|
content.push({
|
|
4710
4850
|
type: "source",
|
|
4711
4851
|
sourceType: "document",
|
|
4712
|
-
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
4852
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils28.generateId)(),
|
|
4713
4853
|
mediaType: "application/octet-stream",
|
|
4714
4854
|
title: annotation.file_id,
|
|
4715
4855
|
filename: annotation.file_id,
|
|
@@ -4741,6 +4881,22 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4741
4881
|
});
|
|
4742
4882
|
break;
|
|
4743
4883
|
}
|
|
4884
|
+
case "custom_tool_call": {
|
|
4885
|
+
hasFunctionCall = true;
|
|
4886
|
+
const toolName = toolNameMapping.toCustomToolName(part.name);
|
|
4887
|
+
content.push({
|
|
4888
|
+
type: "tool-call",
|
|
4889
|
+
toolCallId: part.call_id,
|
|
4890
|
+
toolName,
|
|
4891
|
+
input: JSON.stringify(part.input),
|
|
4892
|
+
providerMetadata: {
|
|
4893
|
+
[providerOptionsName]: {
|
|
4894
|
+
itemId: part.id
|
|
4895
|
+
}
|
|
4896
|
+
}
|
|
4897
|
+
});
|
|
4898
|
+
break;
|
|
4899
|
+
}
|
|
4744
4900
|
case "web_search_call": {
|
|
4745
4901
|
content.push({
|
|
4746
4902
|
type: "tool-call",
|
|
@@ -4797,7 +4953,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4797
4953
|
}
|
|
4798
4954
|
case "mcp_approval_request": {
|
|
4799
4955
|
const approvalRequestId = (_q = part.approval_request_id) != null ? _q : part.id;
|
|
4800
|
-
const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0,
|
|
4956
|
+
const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils28.generateId)();
|
|
4801
4957
|
const toolName = `mcp.${part.name}`;
|
|
4802
4958
|
content.push({
|
|
4803
4959
|
type: "tool-call",
|
|
@@ -4938,18 +5094,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4938
5094
|
providerOptionsName,
|
|
4939
5095
|
isShellProviderExecuted
|
|
4940
5096
|
} = await this.getArgs(options);
|
|
4941
|
-
const { responseHeaders, value: response } = await (0,
|
|
5097
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils28.postJsonToApi)({
|
|
4942
5098
|
url: this.config.url({
|
|
4943
5099
|
path: "/responses",
|
|
4944
5100
|
modelId: this.modelId
|
|
4945
5101
|
}),
|
|
4946
|
-
headers: (0,
|
|
5102
|
+
headers: (0, import_provider_utils28.combineHeaders)(this.config.headers(), options.headers),
|
|
4947
5103
|
body: {
|
|
4948
5104
|
...body,
|
|
4949
5105
|
stream: true
|
|
4950
5106
|
},
|
|
4951
5107
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4952
|
-
successfulResponseHandler: (0,
|
|
5108
|
+
successfulResponseHandler: (0, import_provider_utils28.createEventSourceResponseHandler)(
|
|
4953
5109
|
openaiResponsesChunkSchema
|
|
4954
5110
|
),
|
|
4955
5111
|
abortSignal: options.abortSignal,
|
|
@@ -4999,6 +5155,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4999
5155
|
id: value.item.call_id,
|
|
5000
5156
|
toolName: value.item.name
|
|
5001
5157
|
});
|
|
5158
|
+
} else if (value.item.type === "custom_tool_call") {
|
|
5159
|
+
const toolName = toolNameMapping.toCustomToolName(
|
|
5160
|
+
value.item.name
|
|
5161
|
+
);
|
|
5162
|
+
ongoingToolCalls[value.output_index] = {
|
|
5163
|
+
toolName,
|
|
5164
|
+
toolCallId: value.item.call_id
|
|
5165
|
+
};
|
|
5166
|
+
controller.enqueue({
|
|
5167
|
+
type: "tool-input-start",
|
|
5168
|
+
id: value.item.call_id,
|
|
5169
|
+
toolName
|
|
5170
|
+
});
|
|
5002
5171
|
} else if (value.item.type === "web_search_call") {
|
|
5003
5172
|
ongoingToolCalls[value.output_index] = {
|
|
5004
5173
|
toolName: toolNameMapping.toCustomToolName(
|
|
@@ -5183,6 +5352,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5183
5352
|
}
|
|
5184
5353
|
}
|
|
5185
5354
|
});
|
|
5355
|
+
} else if (value.item.type === "custom_tool_call") {
|
|
5356
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
5357
|
+
hasFunctionCall = true;
|
|
5358
|
+
const toolName = toolNameMapping.toCustomToolName(
|
|
5359
|
+
value.item.name
|
|
5360
|
+
);
|
|
5361
|
+
controller.enqueue({
|
|
5362
|
+
type: "tool-input-end",
|
|
5363
|
+
id: value.item.call_id
|
|
5364
|
+
});
|
|
5365
|
+
controller.enqueue({
|
|
5366
|
+
type: "tool-call",
|
|
5367
|
+
toolCallId: value.item.call_id,
|
|
5368
|
+
toolName,
|
|
5369
|
+
input: JSON.stringify(value.item.input),
|
|
5370
|
+
providerMetadata: {
|
|
5371
|
+
[providerOptionsName]: {
|
|
5372
|
+
itemId: value.item.id
|
|
5373
|
+
}
|
|
5374
|
+
}
|
|
5375
|
+
});
|
|
5186
5376
|
} else if (value.item.type === "web_search_call") {
|
|
5187
5377
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5188
5378
|
controller.enqueue({
|
|
@@ -5326,7 +5516,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5326
5516
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5327
5517
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5328
5518
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5329
|
-
const dummyToolCallId = (_k = (_j = (_i = self.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : (0,
|
|
5519
|
+
const dummyToolCallId = (_k = (_j = (_i = self.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : (0, import_provider_utils28.generateId)();
|
|
5330
5520
|
const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
|
|
5331
5521
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5332
5522
|
approvalRequestId,
|
|
@@ -5432,6 +5622,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5432
5622
|
delta: value.delta
|
|
5433
5623
|
});
|
|
5434
5624
|
}
|
|
5625
|
+
} else if (isResponseCustomToolCallInputDeltaChunk(value)) {
|
|
5626
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
5627
|
+
if (toolCall != null) {
|
|
5628
|
+
controller.enqueue({
|
|
5629
|
+
type: "tool-input-delta",
|
|
5630
|
+
id: toolCall.toolCallId,
|
|
5631
|
+
delta: value.delta
|
|
5632
|
+
});
|
|
5633
|
+
}
|
|
5435
5634
|
} else if (isResponseApplyPatchCallOperationDiffDeltaChunk(value)) {
|
|
5436
5635
|
const toolCall = ongoingToolCalls[value.output_index];
|
|
5437
5636
|
if (toolCall == null ? void 0 : toolCall.applyPatch) {
|
|
@@ -5598,7 +5797,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5598
5797
|
controller.enqueue({
|
|
5599
5798
|
type: "source",
|
|
5600
5799
|
sourceType: "url",
|
|
5601
|
-
id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0,
|
|
5800
|
+
id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils28.generateId)(),
|
|
5602
5801
|
url: value.annotation.url,
|
|
5603
5802
|
title: value.annotation.title
|
|
5604
5803
|
});
|
|
@@ -5606,7 +5805,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5606
5805
|
controller.enqueue({
|
|
5607
5806
|
type: "source",
|
|
5608
5807
|
sourceType: "document",
|
|
5609
|
-
id: (_z = (_y = (_x = self.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : (0,
|
|
5808
|
+
id: (_z = (_y = (_x = self.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : (0, import_provider_utils28.generateId)(),
|
|
5610
5809
|
mediaType: "text/plain",
|
|
5611
5810
|
title: value.annotation.filename,
|
|
5612
5811
|
filename: value.annotation.filename,
|
|
@@ -5622,7 +5821,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5622
5821
|
controller.enqueue({
|
|
5623
5822
|
type: "source",
|
|
5624
5823
|
sourceType: "document",
|
|
5625
|
-
id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0,
|
|
5824
|
+
id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0, import_provider_utils28.generateId)(),
|
|
5626
5825
|
mediaType: "text/plain",
|
|
5627
5826
|
title: value.annotation.filename,
|
|
5628
5827
|
filename: value.annotation.filename,
|
|
@@ -5638,7 +5837,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5638
5837
|
controller.enqueue({
|
|
5639
5838
|
type: "source",
|
|
5640
5839
|
sourceType: "document",
|
|
5641
|
-
id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0,
|
|
5840
|
+
id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0, import_provider_utils28.generateId)(),
|
|
5642
5841
|
mediaType: "application/octet-stream",
|
|
5643
5842
|
title: value.annotation.file_id,
|
|
5644
5843
|
filename: value.annotation.file_id,
|
|
@@ -5692,6 +5891,9 @@ function isResponseCreatedChunk(chunk) {
|
|
|
5692
5891
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
5693
5892
|
return chunk.type === "response.function_call_arguments.delta";
|
|
5694
5893
|
}
|
|
5894
|
+
function isResponseCustomToolCallInputDeltaChunk(chunk) {
|
|
5895
|
+
return chunk.type === "response.custom_tool_call_input.delta";
|
|
5896
|
+
}
|
|
5695
5897
|
function isResponseImageGenerationCallPartialImageChunk(chunk) {
|
|
5696
5898
|
return chunk.type === "response.image_generation_call.partial_image";
|
|
5697
5899
|
}
|
|
@@ -5745,16 +5947,16 @@ function escapeJSONDelta(delta) {
|
|
|
5745
5947
|
}
|
|
5746
5948
|
|
|
5747
5949
|
// src/speech/openai-speech-model.ts
|
|
5748
|
-
var
|
|
5950
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
5749
5951
|
|
|
5750
5952
|
// src/speech/openai-speech-options.ts
|
|
5751
|
-
var
|
|
5752
|
-
var
|
|
5753
|
-
var openaiSpeechModelOptionsSchema = (0,
|
|
5754
|
-
() => (0,
|
|
5755
|
-
|
|
5756
|
-
instructions:
|
|
5757
|
-
speed:
|
|
5953
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
5954
|
+
var import_v422 = require("zod/v4");
|
|
5955
|
+
var openaiSpeechModelOptionsSchema = (0, import_provider_utils29.lazySchema)(
|
|
5956
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
5957
|
+
import_v422.z.object({
|
|
5958
|
+
instructions: import_v422.z.string().nullish(),
|
|
5959
|
+
speed: import_v422.z.number().min(0.25).max(4).default(1).nullish()
|
|
5758
5960
|
})
|
|
5759
5961
|
)
|
|
5760
5962
|
);
|
|
@@ -5779,7 +5981,7 @@ var OpenAISpeechModel = class {
|
|
|
5779
5981
|
providerOptions
|
|
5780
5982
|
}) {
|
|
5781
5983
|
const warnings = [];
|
|
5782
|
-
const openAIOptions = await (0,
|
|
5984
|
+
const openAIOptions = await (0, import_provider_utils30.parseProviderOptions)({
|
|
5783
5985
|
provider: "openai",
|
|
5784
5986
|
providerOptions,
|
|
5785
5987
|
schema: openaiSpeechModelOptionsSchema
|
|
@@ -5832,15 +6034,15 @@ var OpenAISpeechModel = class {
|
|
|
5832
6034
|
value: audio,
|
|
5833
6035
|
responseHeaders,
|
|
5834
6036
|
rawValue: rawResponse
|
|
5835
|
-
} = await (0,
|
|
6037
|
+
} = await (0, import_provider_utils30.postJsonToApi)({
|
|
5836
6038
|
url: this.config.url({
|
|
5837
6039
|
path: "/audio/speech",
|
|
5838
6040
|
modelId: this.modelId
|
|
5839
6041
|
}),
|
|
5840
|
-
headers: (0,
|
|
6042
|
+
headers: (0, import_provider_utils30.combineHeaders)(this.config.headers(), options.headers),
|
|
5841
6043
|
body: requestBody,
|
|
5842
6044
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
5843
|
-
successfulResponseHandler: (0,
|
|
6045
|
+
successfulResponseHandler: (0, import_provider_utils30.createBinaryResponseHandler)(),
|
|
5844
6046
|
abortSignal: options.abortSignal,
|
|
5845
6047
|
fetch: this.config.fetch
|
|
5846
6048
|
});
|
|
@@ -5861,36 +6063,36 @@ var OpenAISpeechModel = class {
|
|
|
5861
6063
|
};
|
|
5862
6064
|
|
|
5863
6065
|
// src/transcription/openai-transcription-model.ts
|
|
5864
|
-
var
|
|
6066
|
+
var import_provider_utils33 = require("@ai-sdk/provider-utils");
|
|
5865
6067
|
|
|
5866
6068
|
// src/transcription/openai-transcription-api.ts
|
|
5867
|
-
var
|
|
5868
|
-
var
|
|
5869
|
-
var openaiTranscriptionResponseSchema = (0,
|
|
5870
|
-
() => (0,
|
|
5871
|
-
|
|
5872
|
-
text:
|
|
5873
|
-
language:
|
|
5874
|
-
duration:
|
|
5875
|
-
words:
|
|
5876
|
-
|
|
5877
|
-
word:
|
|
5878
|
-
start:
|
|
5879
|
-
end:
|
|
6069
|
+
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
6070
|
+
var import_v423 = require("zod/v4");
|
|
6071
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils31.lazySchema)(
|
|
6072
|
+
() => (0, import_provider_utils31.zodSchema)(
|
|
6073
|
+
import_v423.z.object({
|
|
6074
|
+
text: import_v423.z.string(),
|
|
6075
|
+
language: import_v423.z.string().nullish(),
|
|
6076
|
+
duration: import_v423.z.number().nullish(),
|
|
6077
|
+
words: import_v423.z.array(
|
|
6078
|
+
import_v423.z.object({
|
|
6079
|
+
word: import_v423.z.string(),
|
|
6080
|
+
start: import_v423.z.number(),
|
|
6081
|
+
end: import_v423.z.number()
|
|
5880
6082
|
})
|
|
5881
6083
|
).nullish(),
|
|
5882
|
-
segments:
|
|
5883
|
-
|
|
5884
|
-
id:
|
|
5885
|
-
seek:
|
|
5886
|
-
start:
|
|
5887
|
-
end:
|
|
5888
|
-
text:
|
|
5889
|
-
tokens:
|
|
5890
|
-
temperature:
|
|
5891
|
-
avg_logprob:
|
|
5892
|
-
compression_ratio:
|
|
5893
|
-
no_speech_prob:
|
|
6084
|
+
segments: import_v423.z.array(
|
|
6085
|
+
import_v423.z.object({
|
|
6086
|
+
id: import_v423.z.number(),
|
|
6087
|
+
seek: import_v423.z.number(),
|
|
6088
|
+
start: import_v423.z.number(),
|
|
6089
|
+
end: import_v423.z.number(),
|
|
6090
|
+
text: import_v423.z.string(),
|
|
6091
|
+
tokens: import_v423.z.array(import_v423.z.number()),
|
|
6092
|
+
temperature: import_v423.z.number(),
|
|
6093
|
+
avg_logprob: import_v423.z.number(),
|
|
6094
|
+
compression_ratio: import_v423.z.number(),
|
|
6095
|
+
no_speech_prob: import_v423.z.number()
|
|
5894
6096
|
})
|
|
5895
6097
|
).nullish()
|
|
5896
6098
|
})
|
|
@@ -5898,33 +6100,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils30.lazySchema)(
|
|
|
5898
6100
|
);
|
|
5899
6101
|
|
|
5900
6102
|
// src/transcription/openai-transcription-options.ts
|
|
5901
|
-
var
|
|
5902
|
-
var
|
|
5903
|
-
var openAITranscriptionModelOptions = (0,
|
|
5904
|
-
() => (0,
|
|
5905
|
-
|
|
6103
|
+
var import_provider_utils32 = require("@ai-sdk/provider-utils");
|
|
6104
|
+
var import_v424 = require("zod/v4");
|
|
6105
|
+
var openAITranscriptionModelOptions = (0, import_provider_utils32.lazySchema)(
|
|
6106
|
+
() => (0, import_provider_utils32.zodSchema)(
|
|
6107
|
+
import_v424.z.object({
|
|
5906
6108
|
/**
|
|
5907
6109
|
* Additional information to include in the transcription response.
|
|
5908
6110
|
*/
|
|
5909
|
-
include:
|
|
6111
|
+
include: import_v424.z.array(import_v424.z.string()).optional(),
|
|
5910
6112
|
/**
|
|
5911
6113
|
* The language of the input audio in ISO-639-1 format.
|
|
5912
6114
|
*/
|
|
5913
|
-
language:
|
|
6115
|
+
language: import_v424.z.string().optional(),
|
|
5914
6116
|
/**
|
|
5915
6117
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
5916
6118
|
*/
|
|
5917
|
-
prompt:
|
|
6119
|
+
prompt: import_v424.z.string().optional(),
|
|
5918
6120
|
/**
|
|
5919
6121
|
* The sampling temperature, between 0 and 1.
|
|
5920
6122
|
* @default 0
|
|
5921
6123
|
*/
|
|
5922
|
-
temperature:
|
|
6124
|
+
temperature: import_v424.z.number().min(0).max(1).default(0).optional(),
|
|
5923
6125
|
/**
|
|
5924
6126
|
* The timestamp granularities to populate for this transcription.
|
|
5925
6127
|
* @default ['segment']
|
|
5926
6128
|
*/
|
|
5927
|
-
timestampGranularities:
|
|
6129
|
+
timestampGranularities: import_v424.z.array(import_v424.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
5928
6130
|
})
|
|
5929
6131
|
)
|
|
5930
6132
|
);
|
|
@@ -6004,15 +6206,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6004
6206
|
providerOptions
|
|
6005
6207
|
}) {
|
|
6006
6208
|
const warnings = [];
|
|
6007
|
-
const openAIOptions = await (0,
|
|
6209
|
+
const openAIOptions = await (0, import_provider_utils33.parseProviderOptions)({
|
|
6008
6210
|
provider: "openai",
|
|
6009
6211
|
providerOptions,
|
|
6010
6212
|
schema: openAITranscriptionModelOptions
|
|
6011
6213
|
});
|
|
6012
6214
|
const formData = new FormData();
|
|
6013
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
6215
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils33.convertBase64ToUint8Array)(audio)]);
|
|
6014
6216
|
formData.append("model", this.modelId);
|
|
6015
|
-
const fileExtension = (0,
|
|
6217
|
+
const fileExtension = (0, import_provider_utils33.mediaTypeToExtension)(mediaType);
|
|
6016
6218
|
formData.append(
|
|
6017
6219
|
"file",
|
|
6018
6220
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -6057,15 +6259,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6057
6259
|
value: response,
|
|
6058
6260
|
responseHeaders,
|
|
6059
6261
|
rawValue: rawResponse
|
|
6060
|
-
} = await (0,
|
|
6262
|
+
} = await (0, import_provider_utils33.postFormDataToApi)({
|
|
6061
6263
|
url: this.config.url({
|
|
6062
6264
|
path: "/audio/transcriptions",
|
|
6063
6265
|
modelId: this.modelId
|
|
6064
6266
|
}),
|
|
6065
|
-
headers: (0,
|
|
6267
|
+
headers: (0, import_provider_utils33.combineHeaders)(this.config.headers(), options.headers),
|
|
6066
6268
|
formData,
|
|
6067
6269
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6068
|
-
successfulResponseHandler: (0,
|
|
6270
|
+
successfulResponseHandler: (0, import_provider_utils33.createJsonResponseHandler)(
|
|
6069
6271
|
openaiTranscriptionResponseSchema
|
|
6070
6272
|
),
|
|
6071
6273
|
abortSignal: options.abortSignal,
|
|
@@ -6097,21 +6299,21 @@ var OpenAITranscriptionModel = class {
|
|
|
6097
6299
|
};
|
|
6098
6300
|
|
|
6099
6301
|
// src/version.ts
|
|
6100
|
-
var VERSION = true ? "3.0.
|
|
6302
|
+
var VERSION = true ? "3.0.38" : "0.0.0-test";
|
|
6101
6303
|
|
|
6102
6304
|
// src/openai-provider.ts
|
|
6103
6305
|
function createOpenAI(options = {}) {
|
|
6104
6306
|
var _a, _b;
|
|
6105
|
-
const baseURL = (_a = (0,
|
|
6106
|
-
(0,
|
|
6307
|
+
const baseURL = (_a = (0, import_provider_utils34.withoutTrailingSlash)(
|
|
6308
|
+
(0, import_provider_utils34.loadOptionalSetting)({
|
|
6107
6309
|
settingValue: options.baseURL,
|
|
6108
6310
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
6109
6311
|
})
|
|
6110
6312
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
6111
6313
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
6112
|
-
const getHeaders = () => (0,
|
|
6314
|
+
const getHeaders = () => (0, import_provider_utils34.withUserAgentSuffix)(
|
|
6113
6315
|
{
|
|
6114
|
-
Authorization: `Bearer ${(0,
|
|
6316
|
+
Authorization: `Bearer ${(0, import_provider_utils34.loadApiKey)({
|
|
6115
6317
|
apiKey: options.apiKey,
|
|
6116
6318
|
environmentVariableName: "OPENAI_API_KEY",
|
|
6117
6319
|
description: "OpenAI"
|