@ai-sdk/openai 3.0.35 → 3.0.37
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 +21 -0
- package/dist/index.d.mts +50 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +1167 -948
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1117 -894
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +18 -0
- package/dist/internal/index.d.ts +18 -0
- package/dist/internal/index.js +349 -141
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +327 -115
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +78 -0
- package/package.json +2 -2
- package/src/chat/openai-chat-language-model.ts +4 -1
- package/src/openai-tools.ts +12 -0
- 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-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");
|
|
@@ -1014,7 +1014,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1014
1014
|
for (const toolCallDelta of delta.tool_calls) {
|
|
1015
1015
|
const index = toolCallDelta.index;
|
|
1016
1016
|
if (toolCalls[index] == null) {
|
|
1017
|
-
if (toolCallDelta.type !== "function") {
|
|
1017
|
+
if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
|
|
1018
1018
|
throw new import_provider3.InvalidResponseDataError({
|
|
1019
1019
|
data: toolCallDelta,
|
|
1020
1020
|
message: `Expected 'function' type.`
|
|
@@ -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,
|
|
@@ -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,21 +3899,21 @@ 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",
|
|
@@ -3854,9 +3986,9 @@ var openaiResponsesModelIds = [
|
|
|
3854
3986
|
"gpt-5-chat-latest",
|
|
3855
3987
|
...openaiResponsesReasoningModelIds
|
|
3856
3988
|
];
|
|
3857
|
-
var openaiLanguageModelResponsesOptionsSchema = (0,
|
|
3858
|
-
() => (0,
|
|
3859
|
-
|
|
3989
|
+
var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazySchema)(
|
|
3990
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
3991
|
+
import_v421.z.object({
|
|
3860
3992
|
/**
|
|
3861
3993
|
* The ID of the OpenAI Conversation to continue.
|
|
3862
3994
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -3864,13 +3996,13 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3864
3996
|
* Defaults to `undefined`.
|
|
3865
3997
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3866
3998
|
*/
|
|
3867
|
-
conversation:
|
|
3999
|
+
conversation: import_v421.z.string().nullish(),
|
|
3868
4000
|
/**
|
|
3869
4001
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
3870
4002
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
3871
4003
|
*/
|
|
3872
|
-
include:
|
|
3873
|
-
|
|
4004
|
+
include: import_v421.z.array(
|
|
4005
|
+
import_v421.z.enum([
|
|
3874
4006
|
"reasoning.encrypted_content",
|
|
3875
4007
|
// handled internally by default, only needed for unknown reasoning models
|
|
3876
4008
|
"file_search_call.results",
|
|
@@ -3882,7 +4014,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3882
4014
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
3883
4015
|
* Defaults to `undefined`.
|
|
3884
4016
|
*/
|
|
3885
|
-
instructions:
|
|
4017
|
+
instructions: import_v421.z.string().nullish(),
|
|
3886
4018
|
/**
|
|
3887
4019
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
3888
4020
|
* the response size and can slow down response times. However, it can
|
|
@@ -3897,30 +4029,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3897
4029
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3898
4030
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3899
4031
|
*/
|
|
3900
|
-
logprobs:
|
|
4032
|
+
logprobs: import_v421.z.union([import_v421.z.boolean(), import_v421.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3901
4033
|
/**
|
|
3902
4034
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3903
4035
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3904
4036
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3905
4037
|
*/
|
|
3906
|
-
maxToolCalls:
|
|
4038
|
+
maxToolCalls: import_v421.z.number().nullish(),
|
|
3907
4039
|
/**
|
|
3908
4040
|
* Additional metadata to store with the generation.
|
|
3909
4041
|
*/
|
|
3910
|
-
metadata:
|
|
4042
|
+
metadata: import_v421.z.any().nullish(),
|
|
3911
4043
|
/**
|
|
3912
4044
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
3913
4045
|
*/
|
|
3914
|
-
parallelToolCalls:
|
|
4046
|
+
parallelToolCalls: import_v421.z.boolean().nullish(),
|
|
3915
4047
|
/**
|
|
3916
4048
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
3917
4049
|
* Defaults to `undefined`.
|
|
3918
4050
|
*/
|
|
3919
|
-
previousResponseId:
|
|
4051
|
+
previousResponseId: import_v421.z.string().nullish(),
|
|
3920
4052
|
/**
|
|
3921
4053
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
3922
4054
|
*/
|
|
3923
|
-
promptCacheKey:
|
|
4055
|
+
promptCacheKey: import_v421.z.string().nullish(),
|
|
3924
4056
|
/**
|
|
3925
4057
|
* The retention policy for the prompt cache.
|
|
3926
4058
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -3929,7 +4061,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3929
4061
|
*
|
|
3930
4062
|
* @default 'in_memory'
|
|
3931
4063
|
*/
|
|
3932
|
-
promptCacheRetention:
|
|
4064
|
+
promptCacheRetention: import_v421.z.enum(["in_memory", "24h"]).nullish(),
|
|
3933
4065
|
/**
|
|
3934
4066
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3935
4067
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -3940,17 +4072,17 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3940
4072
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
3941
4073
|
* an error.
|
|
3942
4074
|
*/
|
|
3943
|
-
reasoningEffort:
|
|
4075
|
+
reasoningEffort: import_v421.z.string().nullish(),
|
|
3944
4076
|
/**
|
|
3945
4077
|
* Controls reasoning summary output from the model.
|
|
3946
4078
|
* Set to "auto" to automatically receive the richest level available,
|
|
3947
4079
|
* or "detailed" for comprehensive summaries.
|
|
3948
4080
|
*/
|
|
3949
|
-
reasoningSummary:
|
|
4081
|
+
reasoningSummary: import_v421.z.string().nullish(),
|
|
3950
4082
|
/**
|
|
3951
4083
|
* The identifier for safety monitoring and tracking.
|
|
3952
4084
|
*/
|
|
3953
|
-
safetyIdentifier:
|
|
4085
|
+
safetyIdentifier: import_v421.z.string().nullish(),
|
|
3954
4086
|
/**
|
|
3955
4087
|
* Service tier for the request.
|
|
3956
4088
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -3958,34 +4090,34 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3958
4090
|
*
|
|
3959
4091
|
* Defaults to 'auto'.
|
|
3960
4092
|
*/
|
|
3961
|
-
serviceTier:
|
|
4093
|
+
serviceTier: import_v421.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3962
4094
|
/**
|
|
3963
4095
|
* Whether to store the generation. Defaults to `true`.
|
|
3964
4096
|
*/
|
|
3965
|
-
store:
|
|
4097
|
+
store: import_v421.z.boolean().nullish(),
|
|
3966
4098
|
/**
|
|
3967
4099
|
* Whether to use strict JSON schema validation.
|
|
3968
4100
|
* Defaults to `true`.
|
|
3969
4101
|
*/
|
|
3970
|
-
strictJsonSchema:
|
|
4102
|
+
strictJsonSchema: import_v421.z.boolean().nullish(),
|
|
3971
4103
|
/**
|
|
3972
4104
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
3973
4105
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
3974
4106
|
* Valid values: 'low', 'medium', 'high'.
|
|
3975
4107
|
*/
|
|
3976
|
-
textVerbosity:
|
|
4108
|
+
textVerbosity: import_v421.z.enum(["low", "medium", "high"]).nullish(),
|
|
3977
4109
|
/**
|
|
3978
4110
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
3979
4111
|
* 'disabled' turns truncation off.
|
|
3980
4112
|
*/
|
|
3981
|
-
truncation:
|
|
4113
|
+
truncation: import_v421.z.enum(["auto", "disabled"]).nullish(),
|
|
3982
4114
|
/**
|
|
3983
4115
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
3984
4116
|
* monitor and detect abuse.
|
|
3985
4117
|
* Defaults to `undefined`.
|
|
3986
4118
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
3987
4119
|
*/
|
|
3988
|
-
user:
|
|
4120
|
+
user: import_v421.z.string().nullish(),
|
|
3989
4121
|
/**
|
|
3990
4122
|
* Override the system message mode for this model.
|
|
3991
4123
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -3994,7 +4126,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
3994
4126
|
*
|
|
3995
4127
|
* If not specified, the mode is automatically determined based on the model.
|
|
3996
4128
|
*/
|
|
3997
|
-
systemMessageMode:
|
|
4129
|
+
systemMessageMode: import_v421.z.enum(["system", "developer", "remove"]).optional(),
|
|
3998
4130
|
/**
|
|
3999
4131
|
* Force treating this model as a reasoning model.
|
|
4000
4132
|
*
|
|
@@ -4004,24 +4136,28 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazy
|
|
|
4004
4136
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4005
4137
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4006
4138
|
*/
|
|
4007
|
-
forceReasoning:
|
|
4139
|
+
forceReasoning: import_v421.z.boolean().optional()
|
|
4008
4140
|
})
|
|
4009
4141
|
)
|
|
4010
4142
|
);
|
|
4011
4143
|
|
|
4012
4144
|
// src/responses/openai-responses-prepare-tools.ts
|
|
4013
4145
|
var import_provider7 = require("@ai-sdk/provider");
|
|
4014
|
-
var
|
|
4146
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
4015
4147
|
async function prepareResponsesTools({
|
|
4016
4148
|
tools,
|
|
4017
|
-
toolChoice
|
|
4149
|
+
toolChoice,
|
|
4150
|
+
toolNameMapping,
|
|
4151
|
+
customProviderToolNames
|
|
4018
4152
|
}) {
|
|
4153
|
+
var _a;
|
|
4019
4154
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
4020
4155
|
const toolWarnings = [];
|
|
4021
4156
|
if (tools == null) {
|
|
4022
4157
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
4023
4158
|
}
|
|
4024
4159
|
const openaiTools2 = [];
|
|
4160
|
+
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
4025
4161
|
for (const tool of tools) {
|
|
4026
4162
|
switch (tool.type) {
|
|
4027
4163
|
case "function":
|
|
@@ -4036,7 +4172,7 @@ async function prepareResponsesTools({
|
|
|
4036
4172
|
case "provider": {
|
|
4037
4173
|
switch (tool.id) {
|
|
4038
4174
|
case "openai.file_search": {
|
|
4039
|
-
const args = await (0,
|
|
4175
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4040
4176
|
value: tool.args,
|
|
4041
4177
|
schema: fileSearchArgsSchema
|
|
4042
4178
|
});
|
|
@@ -4059,7 +4195,7 @@ async function prepareResponsesTools({
|
|
|
4059
4195
|
break;
|
|
4060
4196
|
}
|
|
4061
4197
|
case "openai.shell": {
|
|
4062
|
-
const args = await (0,
|
|
4198
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4063
4199
|
value: tool.args,
|
|
4064
4200
|
schema: shellArgsSchema
|
|
4065
4201
|
});
|
|
@@ -4078,7 +4214,7 @@ async function prepareResponsesTools({
|
|
|
4078
4214
|
break;
|
|
4079
4215
|
}
|
|
4080
4216
|
case "openai.web_search_preview": {
|
|
4081
|
-
const args = await (0,
|
|
4217
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4082
4218
|
value: tool.args,
|
|
4083
4219
|
schema: webSearchPreviewArgsSchema
|
|
4084
4220
|
});
|
|
@@ -4090,7 +4226,7 @@ async function prepareResponsesTools({
|
|
|
4090
4226
|
break;
|
|
4091
4227
|
}
|
|
4092
4228
|
case "openai.web_search": {
|
|
4093
|
-
const args = await (0,
|
|
4229
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4094
4230
|
value: tool.args,
|
|
4095
4231
|
schema: webSearchArgsSchema
|
|
4096
4232
|
});
|
|
@@ -4104,7 +4240,7 @@ async function prepareResponsesTools({
|
|
|
4104
4240
|
break;
|
|
4105
4241
|
}
|
|
4106
4242
|
case "openai.code_interpreter": {
|
|
4107
|
-
const args = await (0,
|
|
4243
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4108
4244
|
value: tool.args,
|
|
4109
4245
|
schema: codeInterpreterArgsSchema
|
|
4110
4246
|
});
|
|
@@ -4115,7 +4251,7 @@ async function prepareResponsesTools({
|
|
|
4115
4251
|
break;
|
|
4116
4252
|
}
|
|
4117
4253
|
case "openai.image_generation": {
|
|
4118
|
-
const args = await (0,
|
|
4254
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4119
4255
|
value: tool.args,
|
|
4120
4256
|
schema: imageGenerationArgsSchema
|
|
4121
4257
|
});
|
|
@@ -4138,7 +4274,7 @@ async function prepareResponsesTools({
|
|
|
4138
4274
|
break;
|
|
4139
4275
|
}
|
|
4140
4276
|
case "openai.mcp": {
|
|
4141
|
-
const args = await (0,
|
|
4277
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4142
4278
|
value: tool.args,
|
|
4143
4279
|
schema: mcpArgsSchema
|
|
4144
4280
|
});
|
|
@@ -4163,6 +4299,20 @@ async function prepareResponsesTools({
|
|
|
4163
4299
|
});
|
|
4164
4300
|
break;
|
|
4165
4301
|
}
|
|
4302
|
+
case "openai.custom": {
|
|
4303
|
+
const args = await (0, import_provider_utils27.validateTypes)({
|
|
4304
|
+
value: tool.args,
|
|
4305
|
+
schema: customArgsSchema
|
|
4306
|
+
});
|
|
4307
|
+
openaiTools2.push({
|
|
4308
|
+
type: "custom",
|
|
4309
|
+
name: args.name,
|
|
4310
|
+
description: args.description,
|
|
4311
|
+
format: args.format
|
|
4312
|
+
});
|
|
4313
|
+
resolvedCustomProviderToolNames.add(args.name);
|
|
4314
|
+
break;
|
|
4315
|
+
}
|
|
4166
4316
|
}
|
|
4167
4317
|
break;
|
|
4168
4318
|
}
|
|
@@ -4183,12 +4333,14 @@ async function prepareResponsesTools({
|
|
|
4183
4333
|
case "none":
|
|
4184
4334
|
case "required":
|
|
4185
4335
|
return { tools: openaiTools2, toolChoice: type, toolWarnings };
|
|
4186
|
-
case "tool":
|
|
4336
|
+
case "tool": {
|
|
4337
|
+
const resolvedToolName = (_a = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a : toolChoice.toolName;
|
|
4187
4338
|
return {
|
|
4188
4339
|
tools: openaiTools2,
|
|
4189
|
-
toolChoice:
|
|
4340
|
+
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
4341
|
toolWarnings
|
|
4191
4342
|
};
|
|
4343
|
+
}
|
|
4192
4344
|
default: {
|
|
4193
4345
|
const _exhaustiveCheck = type;
|
|
4194
4346
|
throw new import_provider7.UnsupportedFunctionalityError({
|
|
@@ -4307,13 +4459,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4307
4459
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
4308
4460
|
}
|
|
4309
4461
|
const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
|
|
4310
|
-
let openaiOptions = await (0,
|
|
4462
|
+
let openaiOptions = await (0, import_provider_utils28.parseProviderOptions)({
|
|
4311
4463
|
provider: providerOptionsName,
|
|
4312
4464
|
providerOptions,
|
|
4313
4465
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4314
4466
|
});
|
|
4315
4467
|
if (openaiOptions == null && providerOptionsName !== "openai") {
|
|
4316
|
-
openaiOptions = await (0,
|
|
4468
|
+
openaiOptions = await (0, import_provider_utils28.parseProviderOptions)({
|
|
4317
4469
|
provider: "openai",
|
|
4318
4470
|
providerOptions,
|
|
4319
4471
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
@@ -4327,7 +4479,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4327
4479
|
details: "conversation and previousResponseId cannot be used together"
|
|
4328
4480
|
});
|
|
4329
4481
|
}
|
|
4330
|
-
const toolNameMapping = (0,
|
|
4482
|
+
const toolNameMapping = (0, import_provider_utils28.createToolNameMapping)({
|
|
4331
4483
|
tools,
|
|
4332
4484
|
providerToolNames: {
|
|
4333
4485
|
"openai.code_interpreter": "code_interpreter",
|
|
@@ -4339,7 +4491,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4339
4491
|
"openai.web_search_preview": "web_search_preview",
|
|
4340
4492
|
"openai.mcp": "mcp",
|
|
4341
4493
|
"openai.apply_patch": "apply_patch"
|
|
4342
|
-
}
|
|
4494
|
+
},
|
|
4495
|
+
resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
|
|
4496
|
+
});
|
|
4497
|
+
const customProviderToolNames = /* @__PURE__ */ new Set();
|
|
4498
|
+
const {
|
|
4499
|
+
tools: openaiTools2,
|
|
4500
|
+
toolChoice: openaiToolChoice,
|
|
4501
|
+
toolWarnings
|
|
4502
|
+
} = await prepareResponsesTools({
|
|
4503
|
+
tools,
|
|
4504
|
+
toolChoice,
|
|
4505
|
+
toolNameMapping,
|
|
4506
|
+
customProviderToolNames
|
|
4343
4507
|
});
|
|
4344
4508
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
4345
4509
|
prompt,
|
|
@@ -4351,7 +4515,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4351
4515
|
hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
|
|
4352
4516
|
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
4353
4517
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
4354
|
-
hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
|
|
4518
|
+
hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
|
|
4519
|
+
customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0
|
|
4355
4520
|
});
|
|
4356
4521
|
warnings.push(...inputWarnings);
|
|
4357
4522
|
const strictJsonSchema = (_d = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _d : true;
|
|
@@ -4484,14 +4649,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4484
4649
|
});
|
|
4485
4650
|
delete baseArgs.service_tier;
|
|
4486
4651
|
}
|
|
4487
|
-
const {
|
|
4488
|
-
tools: openaiTools2,
|
|
4489
|
-
toolChoice: openaiToolChoice,
|
|
4490
|
-
toolWarnings
|
|
4491
|
-
} = await prepareResponsesTools({
|
|
4492
|
-
tools,
|
|
4493
|
-
toolChoice
|
|
4494
|
-
});
|
|
4495
4652
|
const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
|
|
4496
4653
|
(tool) => tool.type === "provider" && tool.id === "openai.shell"
|
|
4497
4654
|
)) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
|
|
@@ -4529,12 +4686,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4529
4686
|
responseHeaders,
|
|
4530
4687
|
value: response,
|
|
4531
4688
|
rawValue: rawResponse
|
|
4532
|
-
} = await (0,
|
|
4689
|
+
} = await (0, import_provider_utils28.postJsonToApi)({
|
|
4533
4690
|
url,
|
|
4534
|
-
headers: (0,
|
|
4691
|
+
headers: (0, import_provider_utils28.combineHeaders)(this.config.headers(), options.headers),
|
|
4535
4692
|
body,
|
|
4536
4693
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4537
|
-
successfulResponseHandler: (0,
|
|
4694
|
+
successfulResponseHandler: (0, import_provider_utils28.createJsonResponseHandler)(
|
|
4538
4695
|
openaiResponsesResponseSchema
|
|
4539
4696
|
),
|
|
4540
4697
|
abortSignal: options.abortSignal,
|
|
@@ -4669,7 +4826,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4669
4826
|
content.push({
|
|
4670
4827
|
type: "source",
|
|
4671
4828
|
sourceType: "url",
|
|
4672
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
4829
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils28.generateId)(),
|
|
4673
4830
|
url: annotation.url,
|
|
4674
4831
|
title: annotation.title
|
|
4675
4832
|
});
|
|
@@ -4677,7 +4834,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4677
4834
|
content.push({
|
|
4678
4835
|
type: "source",
|
|
4679
4836
|
sourceType: "document",
|
|
4680
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
4837
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils28.generateId)(),
|
|
4681
4838
|
mediaType: "text/plain",
|
|
4682
4839
|
title: annotation.filename,
|
|
4683
4840
|
filename: annotation.filename,
|
|
@@ -4693,7 +4850,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4693
4850
|
content.push({
|
|
4694
4851
|
type: "source",
|
|
4695
4852
|
sourceType: "document",
|
|
4696
|
-
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0,
|
|
4853
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils28.generateId)(),
|
|
4697
4854
|
mediaType: "text/plain",
|
|
4698
4855
|
title: annotation.filename,
|
|
4699
4856
|
filename: annotation.filename,
|
|
@@ -4709,7 +4866,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4709
4866
|
content.push({
|
|
4710
4867
|
type: "source",
|
|
4711
4868
|
sourceType: "document",
|
|
4712
|
-
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
4869
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils28.generateId)(),
|
|
4713
4870
|
mediaType: "application/octet-stream",
|
|
4714
4871
|
title: annotation.file_id,
|
|
4715
4872
|
filename: annotation.file_id,
|
|
@@ -4741,6 +4898,22 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4741
4898
|
});
|
|
4742
4899
|
break;
|
|
4743
4900
|
}
|
|
4901
|
+
case "custom_tool_call": {
|
|
4902
|
+
hasFunctionCall = true;
|
|
4903
|
+
const toolName = toolNameMapping.toCustomToolName(part.name);
|
|
4904
|
+
content.push({
|
|
4905
|
+
type: "tool-call",
|
|
4906
|
+
toolCallId: part.call_id,
|
|
4907
|
+
toolName,
|
|
4908
|
+
input: JSON.stringify(part.input),
|
|
4909
|
+
providerMetadata: {
|
|
4910
|
+
[providerOptionsName]: {
|
|
4911
|
+
itemId: part.id
|
|
4912
|
+
}
|
|
4913
|
+
}
|
|
4914
|
+
});
|
|
4915
|
+
break;
|
|
4916
|
+
}
|
|
4744
4917
|
case "web_search_call": {
|
|
4745
4918
|
content.push({
|
|
4746
4919
|
type: "tool-call",
|
|
@@ -4797,7 +4970,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4797
4970
|
}
|
|
4798
4971
|
case "mcp_approval_request": {
|
|
4799
4972
|
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,
|
|
4973
|
+
const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils28.generateId)();
|
|
4801
4974
|
const toolName = `mcp.${part.name}`;
|
|
4802
4975
|
content.push({
|
|
4803
4976
|
type: "tool-call",
|
|
@@ -4938,18 +5111,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4938
5111
|
providerOptionsName,
|
|
4939
5112
|
isShellProviderExecuted
|
|
4940
5113
|
} = await this.getArgs(options);
|
|
4941
|
-
const { responseHeaders, value: response } = await (0,
|
|
5114
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils28.postJsonToApi)({
|
|
4942
5115
|
url: this.config.url({
|
|
4943
5116
|
path: "/responses",
|
|
4944
5117
|
modelId: this.modelId
|
|
4945
5118
|
}),
|
|
4946
|
-
headers: (0,
|
|
5119
|
+
headers: (0, import_provider_utils28.combineHeaders)(this.config.headers(), options.headers),
|
|
4947
5120
|
body: {
|
|
4948
5121
|
...body,
|
|
4949
5122
|
stream: true
|
|
4950
5123
|
},
|
|
4951
5124
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4952
|
-
successfulResponseHandler: (0,
|
|
5125
|
+
successfulResponseHandler: (0, import_provider_utils28.createEventSourceResponseHandler)(
|
|
4953
5126
|
openaiResponsesChunkSchema
|
|
4954
5127
|
),
|
|
4955
5128
|
abortSignal: options.abortSignal,
|
|
@@ -4999,6 +5172,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4999
5172
|
id: value.item.call_id,
|
|
5000
5173
|
toolName: value.item.name
|
|
5001
5174
|
});
|
|
5175
|
+
} else if (value.item.type === "custom_tool_call") {
|
|
5176
|
+
const toolName = toolNameMapping.toCustomToolName(
|
|
5177
|
+
value.item.name
|
|
5178
|
+
);
|
|
5179
|
+
ongoingToolCalls[value.output_index] = {
|
|
5180
|
+
toolName,
|
|
5181
|
+
toolCallId: value.item.call_id
|
|
5182
|
+
};
|
|
5183
|
+
controller.enqueue({
|
|
5184
|
+
type: "tool-input-start",
|
|
5185
|
+
id: value.item.call_id,
|
|
5186
|
+
toolName
|
|
5187
|
+
});
|
|
5002
5188
|
} else if (value.item.type === "web_search_call") {
|
|
5003
5189
|
ongoingToolCalls[value.output_index] = {
|
|
5004
5190
|
toolName: toolNameMapping.toCustomToolName(
|
|
@@ -5183,6 +5369,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5183
5369
|
}
|
|
5184
5370
|
}
|
|
5185
5371
|
});
|
|
5372
|
+
} else if (value.item.type === "custom_tool_call") {
|
|
5373
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
5374
|
+
hasFunctionCall = true;
|
|
5375
|
+
const toolName = toolNameMapping.toCustomToolName(
|
|
5376
|
+
value.item.name
|
|
5377
|
+
);
|
|
5378
|
+
controller.enqueue({
|
|
5379
|
+
type: "tool-input-end",
|
|
5380
|
+
id: value.item.call_id
|
|
5381
|
+
});
|
|
5382
|
+
controller.enqueue({
|
|
5383
|
+
type: "tool-call",
|
|
5384
|
+
toolCallId: value.item.call_id,
|
|
5385
|
+
toolName,
|
|
5386
|
+
input: JSON.stringify(value.item.input),
|
|
5387
|
+
providerMetadata: {
|
|
5388
|
+
[providerOptionsName]: {
|
|
5389
|
+
itemId: value.item.id
|
|
5390
|
+
}
|
|
5391
|
+
}
|
|
5392
|
+
});
|
|
5186
5393
|
} else if (value.item.type === "web_search_call") {
|
|
5187
5394
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5188
5395
|
controller.enqueue({
|
|
@@ -5326,7 +5533,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5326
5533
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5327
5534
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5328
5535
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5329
|
-
const dummyToolCallId = (_k = (_j = (_i = self.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : (0,
|
|
5536
|
+
const dummyToolCallId = (_k = (_j = (_i = self.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : (0, import_provider_utils28.generateId)();
|
|
5330
5537
|
const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
|
|
5331
5538
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5332
5539
|
approvalRequestId,
|
|
@@ -5432,6 +5639,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5432
5639
|
delta: value.delta
|
|
5433
5640
|
});
|
|
5434
5641
|
}
|
|
5642
|
+
} else if (isResponseCustomToolCallInputDeltaChunk(value)) {
|
|
5643
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
5644
|
+
if (toolCall != null) {
|
|
5645
|
+
controller.enqueue({
|
|
5646
|
+
type: "tool-input-delta",
|
|
5647
|
+
id: toolCall.toolCallId,
|
|
5648
|
+
delta: value.delta
|
|
5649
|
+
});
|
|
5650
|
+
}
|
|
5435
5651
|
} else if (isResponseApplyPatchCallOperationDiffDeltaChunk(value)) {
|
|
5436
5652
|
const toolCall = ongoingToolCalls[value.output_index];
|
|
5437
5653
|
if (toolCall == null ? void 0 : toolCall.applyPatch) {
|
|
@@ -5598,7 +5814,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5598
5814
|
controller.enqueue({
|
|
5599
5815
|
type: "source",
|
|
5600
5816
|
sourceType: "url",
|
|
5601
|
-
id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0,
|
|
5817
|
+
id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils28.generateId)(),
|
|
5602
5818
|
url: value.annotation.url,
|
|
5603
5819
|
title: value.annotation.title
|
|
5604
5820
|
});
|
|
@@ -5606,7 +5822,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5606
5822
|
controller.enqueue({
|
|
5607
5823
|
type: "source",
|
|
5608
5824
|
sourceType: "document",
|
|
5609
|
-
id: (_z = (_y = (_x = self.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : (0,
|
|
5825
|
+
id: (_z = (_y = (_x = self.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : (0, import_provider_utils28.generateId)(),
|
|
5610
5826
|
mediaType: "text/plain",
|
|
5611
5827
|
title: value.annotation.filename,
|
|
5612
5828
|
filename: value.annotation.filename,
|
|
@@ -5622,7 +5838,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5622
5838
|
controller.enqueue({
|
|
5623
5839
|
type: "source",
|
|
5624
5840
|
sourceType: "document",
|
|
5625
|
-
id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0,
|
|
5841
|
+
id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0, import_provider_utils28.generateId)(),
|
|
5626
5842
|
mediaType: "text/plain",
|
|
5627
5843
|
title: value.annotation.filename,
|
|
5628
5844
|
filename: value.annotation.filename,
|
|
@@ -5638,7 +5854,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5638
5854
|
controller.enqueue({
|
|
5639
5855
|
type: "source",
|
|
5640
5856
|
sourceType: "document",
|
|
5641
|
-
id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0,
|
|
5857
|
+
id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0, import_provider_utils28.generateId)(),
|
|
5642
5858
|
mediaType: "application/octet-stream",
|
|
5643
5859
|
title: value.annotation.file_id,
|
|
5644
5860
|
filename: value.annotation.file_id,
|
|
@@ -5692,6 +5908,9 @@ function isResponseCreatedChunk(chunk) {
|
|
|
5692
5908
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
5693
5909
|
return chunk.type === "response.function_call_arguments.delta";
|
|
5694
5910
|
}
|
|
5911
|
+
function isResponseCustomToolCallInputDeltaChunk(chunk) {
|
|
5912
|
+
return chunk.type === "response.custom_tool_call_input.delta";
|
|
5913
|
+
}
|
|
5695
5914
|
function isResponseImageGenerationCallPartialImageChunk(chunk) {
|
|
5696
5915
|
return chunk.type === "response.image_generation_call.partial_image";
|
|
5697
5916
|
}
|
|
@@ -5745,16 +5964,16 @@ function escapeJSONDelta(delta) {
|
|
|
5745
5964
|
}
|
|
5746
5965
|
|
|
5747
5966
|
// src/speech/openai-speech-model.ts
|
|
5748
|
-
var
|
|
5967
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
5749
5968
|
|
|
5750
5969
|
// src/speech/openai-speech-options.ts
|
|
5751
|
-
var
|
|
5752
|
-
var
|
|
5753
|
-
var openaiSpeechModelOptionsSchema = (0,
|
|
5754
|
-
() => (0,
|
|
5755
|
-
|
|
5756
|
-
instructions:
|
|
5757
|
-
speed:
|
|
5970
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
5971
|
+
var import_v422 = require("zod/v4");
|
|
5972
|
+
var openaiSpeechModelOptionsSchema = (0, import_provider_utils29.lazySchema)(
|
|
5973
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
5974
|
+
import_v422.z.object({
|
|
5975
|
+
instructions: import_v422.z.string().nullish(),
|
|
5976
|
+
speed: import_v422.z.number().min(0.25).max(4).default(1).nullish()
|
|
5758
5977
|
})
|
|
5759
5978
|
)
|
|
5760
5979
|
);
|
|
@@ -5779,7 +5998,7 @@ var OpenAISpeechModel = class {
|
|
|
5779
5998
|
providerOptions
|
|
5780
5999
|
}) {
|
|
5781
6000
|
const warnings = [];
|
|
5782
|
-
const openAIOptions = await (0,
|
|
6001
|
+
const openAIOptions = await (0, import_provider_utils30.parseProviderOptions)({
|
|
5783
6002
|
provider: "openai",
|
|
5784
6003
|
providerOptions,
|
|
5785
6004
|
schema: openaiSpeechModelOptionsSchema
|
|
@@ -5832,15 +6051,15 @@ var OpenAISpeechModel = class {
|
|
|
5832
6051
|
value: audio,
|
|
5833
6052
|
responseHeaders,
|
|
5834
6053
|
rawValue: rawResponse
|
|
5835
|
-
} = await (0,
|
|
6054
|
+
} = await (0, import_provider_utils30.postJsonToApi)({
|
|
5836
6055
|
url: this.config.url({
|
|
5837
6056
|
path: "/audio/speech",
|
|
5838
6057
|
modelId: this.modelId
|
|
5839
6058
|
}),
|
|
5840
|
-
headers: (0,
|
|
6059
|
+
headers: (0, import_provider_utils30.combineHeaders)(this.config.headers(), options.headers),
|
|
5841
6060
|
body: requestBody,
|
|
5842
6061
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
5843
|
-
successfulResponseHandler: (0,
|
|
6062
|
+
successfulResponseHandler: (0, import_provider_utils30.createBinaryResponseHandler)(),
|
|
5844
6063
|
abortSignal: options.abortSignal,
|
|
5845
6064
|
fetch: this.config.fetch
|
|
5846
6065
|
});
|
|
@@ -5861,36 +6080,36 @@ var OpenAISpeechModel = class {
|
|
|
5861
6080
|
};
|
|
5862
6081
|
|
|
5863
6082
|
// src/transcription/openai-transcription-model.ts
|
|
5864
|
-
var
|
|
6083
|
+
var import_provider_utils33 = require("@ai-sdk/provider-utils");
|
|
5865
6084
|
|
|
5866
6085
|
// 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:
|
|
6086
|
+
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
6087
|
+
var import_v423 = require("zod/v4");
|
|
6088
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils31.lazySchema)(
|
|
6089
|
+
() => (0, import_provider_utils31.zodSchema)(
|
|
6090
|
+
import_v423.z.object({
|
|
6091
|
+
text: import_v423.z.string(),
|
|
6092
|
+
language: import_v423.z.string().nullish(),
|
|
6093
|
+
duration: import_v423.z.number().nullish(),
|
|
6094
|
+
words: import_v423.z.array(
|
|
6095
|
+
import_v423.z.object({
|
|
6096
|
+
word: import_v423.z.string(),
|
|
6097
|
+
start: import_v423.z.number(),
|
|
6098
|
+
end: import_v423.z.number()
|
|
5880
6099
|
})
|
|
5881
6100
|
).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:
|
|
6101
|
+
segments: import_v423.z.array(
|
|
6102
|
+
import_v423.z.object({
|
|
6103
|
+
id: import_v423.z.number(),
|
|
6104
|
+
seek: import_v423.z.number(),
|
|
6105
|
+
start: import_v423.z.number(),
|
|
6106
|
+
end: import_v423.z.number(),
|
|
6107
|
+
text: import_v423.z.string(),
|
|
6108
|
+
tokens: import_v423.z.array(import_v423.z.number()),
|
|
6109
|
+
temperature: import_v423.z.number(),
|
|
6110
|
+
avg_logprob: import_v423.z.number(),
|
|
6111
|
+
compression_ratio: import_v423.z.number(),
|
|
6112
|
+
no_speech_prob: import_v423.z.number()
|
|
5894
6113
|
})
|
|
5895
6114
|
).nullish()
|
|
5896
6115
|
})
|
|
@@ -5898,33 +6117,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils30.lazySchema)(
|
|
|
5898
6117
|
);
|
|
5899
6118
|
|
|
5900
6119
|
// src/transcription/openai-transcription-options.ts
|
|
5901
|
-
var
|
|
5902
|
-
var
|
|
5903
|
-
var openAITranscriptionModelOptions = (0,
|
|
5904
|
-
() => (0,
|
|
5905
|
-
|
|
6120
|
+
var import_provider_utils32 = require("@ai-sdk/provider-utils");
|
|
6121
|
+
var import_v424 = require("zod/v4");
|
|
6122
|
+
var openAITranscriptionModelOptions = (0, import_provider_utils32.lazySchema)(
|
|
6123
|
+
() => (0, import_provider_utils32.zodSchema)(
|
|
6124
|
+
import_v424.z.object({
|
|
5906
6125
|
/**
|
|
5907
6126
|
* Additional information to include in the transcription response.
|
|
5908
6127
|
*/
|
|
5909
|
-
include:
|
|
6128
|
+
include: import_v424.z.array(import_v424.z.string()).optional(),
|
|
5910
6129
|
/**
|
|
5911
6130
|
* The language of the input audio in ISO-639-1 format.
|
|
5912
6131
|
*/
|
|
5913
|
-
language:
|
|
6132
|
+
language: import_v424.z.string().optional(),
|
|
5914
6133
|
/**
|
|
5915
6134
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
5916
6135
|
*/
|
|
5917
|
-
prompt:
|
|
6136
|
+
prompt: import_v424.z.string().optional(),
|
|
5918
6137
|
/**
|
|
5919
6138
|
* The sampling temperature, between 0 and 1.
|
|
5920
6139
|
* @default 0
|
|
5921
6140
|
*/
|
|
5922
|
-
temperature:
|
|
6141
|
+
temperature: import_v424.z.number().min(0).max(1).default(0).optional(),
|
|
5923
6142
|
/**
|
|
5924
6143
|
* The timestamp granularities to populate for this transcription.
|
|
5925
6144
|
* @default ['segment']
|
|
5926
6145
|
*/
|
|
5927
|
-
timestampGranularities:
|
|
6146
|
+
timestampGranularities: import_v424.z.array(import_v424.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
5928
6147
|
})
|
|
5929
6148
|
)
|
|
5930
6149
|
);
|
|
@@ -6004,15 +6223,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6004
6223
|
providerOptions
|
|
6005
6224
|
}) {
|
|
6006
6225
|
const warnings = [];
|
|
6007
|
-
const openAIOptions = await (0,
|
|
6226
|
+
const openAIOptions = await (0, import_provider_utils33.parseProviderOptions)({
|
|
6008
6227
|
provider: "openai",
|
|
6009
6228
|
providerOptions,
|
|
6010
6229
|
schema: openAITranscriptionModelOptions
|
|
6011
6230
|
});
|
|
6012
6231
|
const formData = new FormData();
|
|
6013
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
6232
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils33.convertBase64ToUint8Array)(audio)]);
|
|
6014
6233
|
formData.append("model", this.modelId);
|
|
6015
|
-
const fileExtension = (0,
|
|
6234
|
+
const fileExtension = (0, import_provider_utils33.mediaTypeToExtension)(mediaType);
|
|
6016
6235
|
formData.append(
|
|
6017
6236
|
"file",
|
|
6018
6237
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -6057,15 +6276,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6057
6276
|
value: response,
|
|
6058
6277
|
responseHeaders,
|
|
6059
6278
|
rawValue: rawResponse
|
|
6060
|
-
} = await (0,
|
|
6279
|
+
} = await (0, import_provider_utils33.postFormDataToApi)({
|
|
6061
6280
|
url: this.config.url({
|
|
6062
6281
|
path: "/audio/transcriptions",
|
|
6063
6282
|
modelId: this.modelId
|
|
6064
6283
|
}),
|
|
6065
|
-
headers: (0,
|
|
6284
|
+
headers: (0, import_provider_utils33.combineHeaders)(this.config.headers(), options.headers),
|
|
6066
6285
|
formData,
|
|
6067
6286
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6068
|
-
successfulResponseHandler: (0,
|
|
6287
|
+
successfulResponseHandler: (0, import_provider_utils33.createJsonResponseHandler)(
|
|
6069
6288
|
openaiTranscriptionResponseSchema
|
|
6070
6289
|
),
|
|
6071
6290
|
abortSignal: options.abortSignal,
|
|
@@ -6097,21 +6316,21 @@ var OpenAITranscriptionModel = class {
|
|
|
6097
6316
|
};
|
|
6098
6317
|
|
|
6099
6318
|
// src/version.ts
|
|
6100
|
-
var VERSION = true ? "3.0.
|
|
6319
|
+
var VERSION = true ? "3.0.37" : "0.0.0-test";
|
|
6101
6320
|
|
|
6102
6321
|
// src/openai-provider.ts
|
|
6103
6322
|
function createOpenAI(options = {}) {
|
|
6104
6323
|
var _a, _b;
|
|
6105
|
-
const baseURL = (_a = (0,
|
|
6106
|
-
(0,
|
|
6324
|
+
const baseURL = (_a = (0, import_provider_utils34.withoutTrailingSlash)(
|
|
6325
|
+
(0, import_provider_utils34.loadOptionalSetting)({
|
|
6107
6326
|
settingValue: options.baseURL,
|
|
6108
6327
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
6109
6328
|
})
|
|
6110
6329
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
6111
6330
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
6112
|
-
const getHeaders = () => (0,
|
|
6331
|
+
const getHeaders = () => (0, import_provider_utils34.withUserAgentSuffix)(
|
|
6113
6332
|
{
|
|
6114
|
-
Authorization: `Bearer ${(0,
|
|
6333
|
+
Authorization: `Bearer ${(0, import_provider_utils34.loadApiKey)({
|
|
6115
6334
|
apiKey: options.apiKey,
|
|
6116
6335
|
environmentVariableName: "OPENAI_API_KEY",
|
|
6117
6336
|
description: "OpenAI"
|