@ai-sdk/openai 2.1.0-beta.6 → 2.1.0-beta.8
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 +19 -0
- package/dist/index.d.mts +27 -7
- package/dist/index.d.ts +27 -7
- package/dist/index.js +559 -369
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +524 -334
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +226 -15
- package/dist/internal/index.d.ts +226 -15
- package/dist/internal/index.js +582 -380
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +555 -361
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/internal/index.js
CHANGED
|
@@ -27,6 +27,14 @@ __export(internal_exports, {
|
|
|
27
27
|
OpenAIResponsesLanguageModel: () => OpenAIResponsesLanguageModel,
|
|
28
28
|
OpenAISpeechModel: () => OpenAISpeechModel,
|
|
29
29
|
OpenAITranscriptionModel: () => OpenAITranscriptionModel,
|
|
30
|
+
codeInterpreter: () => codeInterpreter,
|
|
31
|
+
codeInterpreterArgsSchema: () => codeInterpreterArgsSchema,
|
|
32
|
+
codeInterpreterInputSchema: () => codeInterpreterInputSchema,
|
|
33
|
+
codeInterpreterOutputSchema: () => codeInterpreterOutputSchema,
|
|
34
|
+
codeInterpreterToolFactory: () => codeInterpreterToolFactory,
|
|
35
|
+
fileSearch: () => fileSearch,
|
|
36
|
+
fileSearchArgsSchema: () => fileSearchArgsSchema,
|
|
37
|
+
fileSearchOutputSchema: () => fileSearchOutputSchema,
|
|
30
38
|
hasDefaultResponseFormat: () => hasDefaultResponseFormat,
|
|
31
39
|
modelMaxImagesPerCall: () => modelMaxImagesPerCall,
|
|
32
40
|
openAITranscriptionProviderOptions: () => openAITranscriptionProviderOptions,
|
|
@@ -422,7 +430,7 @@ function prepareChatTools({
|
|
|
422
430
|
// src/chat/openai-chat-language-model.ts
|
|
423
431
|
var OpenAIChatLanguageModel = class {
|
|
424
432
|
constructor(modelId, config) {
|
|
425
|
-
this.specificationVersion = "
|
|
433
|
+
this.specificationVersion = "v3";
|
|
426
434
|
this.supportedUrls = {
|
|
427
435
|
"image/*": [/^https?:\/\/.*$/]
|
|
428
436
|
};
|
|
@@ -1231,7 +1239,7 @@ var openaiCompletionProviderOptions = import_v44.z.object({
|
|
|
1231
1239
|
// src/completion/openai-completion-language-model.ts
|
|
1232
1240
|
var OpenAICompletionLanguageModel = class {
|
|
1233
1241
|
constructor(modelId, config) {
|
|
1234
|
-
this.specificationVersion = "
|
|
1242
|
+
this.specificationVersion = "v3";
|
|
1235
1243
|
this.supportedUrls = {
|
|
1236
1244
|
// No URLs are supported for completion models.
|
|
1237
1245
|
};
|
|
@@ -2018,13 +2026,38 @@ var OpenAISpeechModel = class {
|
|
|
2018
2026
|
|
|
2019
2027
|
// src/responses/openai-responses-language-model.ts
|
|
2020
2028
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2021
|
-
var
|
|
2022
|
-
var
|
|
2029
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2030
|
+
var import_v419 = require("zod/v4");
|
|
2023
2031
|
|
|
2024
2032
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2025
2033
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2034
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
2035
|
+
var import_v413 = require("zod/v4");
|
|
2036
|
+
|
|
2037
|
+
// src/tool/local-shell.ts
|
|
2026
2038
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
2027
2039
|
var import_v412 = require("zod/v4");
|
|
2040
|
+
var localShellInputSchema = import_v412.z.object({
|
|
2041
|
+
action: import_v412.z.object({
|
|
2042
|
+
type: import_v412.z.literal("exec"),
|
|
2043
|
+
command: import_v412.z.array(import_v412.z.string()),
|
|
2044
|
+
timeoutMs: import_v412.z.number().optional(),
|
|
2045
|
+
user: import_v412.z.string().optional(),
|
|
2046
|
+
workingDirectory: import_v412.z.string().optional(),
|
|
2047
|
+
env: import_v412.z.record(import_v412.z.string(), import_v412.z.string()).optional()
|
|
2048
|
+
})
|
|
2049
|
+
});
|
|
2050
|
+
var localShellOutputSchema = import_v412.z.object({
|
|
2051
|
+
output: import_v412.z.string()
|
|
2052
|
+
});
|
|
2053
|
+
var localShell = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2054
|
+
id: "openai.local_shell",
|
|
2055
|
+
name: "local_shell",
|
|
2056
|
+
inputSchema: localShellInputSchema,
|
|
2057
|
+
outputSchema: localShellOutputSchema
|
|
2058
|
+
});
|
|
2059
|
+
|
|
2060
|
+
// src/responses/convert-to-openai-responses-input.ts
|
|
2028
2061
|
function isFileId(data, prefixes) {
|
|
2029
2062
|
if (!prefixes) return false;
|
|
2030
2063
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2033,9 +2066,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2033
2066
|
prompt,
|
|
2034
2067
|
systemMessageMode,
|
|
2035
2068
|
fileIdPrefixes,
|
|
2036
|
-
store
|
|
2069
|
+
store,
|
|
2070
|
+
hasLocalShellTool = false
|
|
2037
2071
|
}) {
|
|
2038
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2072
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2039
2073
|
const input = [];
|
|
2040
2074
|
const warnings = [];
|
|
2041
2075
|
for (const { role, content } of prompt) {
|
|
@@ -2081,7 +2115,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2081
2115
|
return {
|
|
2082
2116
|
type: "input_image",
|
|
2083
2117
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2084
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2118
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils10.convertToBase64)(part.data)}`
|
|
2085
2119
|
},
|
|
2086
2120
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2087
2121
|
};
|
|
@@ -2096,7 +2130,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2096
2130
|
type: "input_file",
|
|
2097
2131
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2098
2132
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2099
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2133
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils10.convertToBase64)(part.data)}`
|
|
2100
2134
|
}
|
|
2101
2135
|
};
|
|
2102
2136
|
} else {
|
|
@@ -2128,12 +2162,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2128
2162
|
if (part.providerExecuted) {
|
|
2129
2163
|
break;
|
|
2130
2164
|
}
|
|
2165
|
+
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2166
|
+
const parsedInput = localShellInputSchema.parse(part.input);
|
|
2167
|
+
input.push({
|
|
2168
|
+
type: "local_shell_call",
|
|
2169
|
+
call_id: part.toolCallId,
|
|
2170
|
+
id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
|
|
2171
|
+
action: {
|
|
2172
|
+
type: "exec",
|
|
2173
|
+
command: parsedInput.action.command,
|
|
2174
|
+
timeout_ms: parsedInput.action.timeoutMs,
|
|
2175
|
+
user: parsedInput.action.user,
|
|
2176
|
+
working_directory: parsedInput.action.workingDirectory,
|
|
2177
|
+
env: parsedInput.action.env
|
|
2178
|
+
}
|
|
2179
|
+
});
|
|
2180
|
+
break;
|
|
2181
|
+
}
|
|
2131
2182
|
input.push({
|
|
2132
2183
|
type: "function_call",
|
|
2133
2184
|
call_id: part.toolCallId,
|
|
2134
2185
|
name: part.toolName,
|
|
2135
2186
|
arguments: JSON.stringify(part.input),
|
|
2136
|
-
id: (
|
|
2187
|
+
id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
|
|
2137
2188
|
});
|
|
2138
2189
|
break;
|
|
2139
2190
|
}
|
|
@@ -2150,7 +2201,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2150
2201
|
break;
|
|
2151
2202
|
}
|
|
2152
2203
|
case "reasoning": {
|
|
2153
|
-
const providerOptions = await (0,
|
|
2204
|
+
const providerOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
2154
2205
|
provider: "openai",
|
|
2155
2206
|
providerOptions: part.providerOptions,
|
|
2156
2207
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2207,6 +2258,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2207
2258
|
case "tool": {
|
|
2208
2259
|
for (const part of content) {
|
|
2209
2260
|
const output = part.output;
|
|
2261
|
+
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2262
|
+
input.push({
|
|
2263
|
+
type: "local_shell_call_output",
|
|
2264
|
+
call_id: part.toolCallId,
|
|
2265
|
+
output: localShellOutputSchema.parse(output.value).output
|
|
2266
|
+
});
|
|
2267
|
+
break;
|
|
2268
|
+
}
|
|
2210
2269
|
let contentValue;
|
|
2211
2270
|
switch (output.type) {
|
|
2212
2271
|
case "text":
|
|
@@ -2235,9 +2294,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2235
2294
|
}
|
|
2236
2295
|
return { input, warnings };
|
|
2237
2296
|
}
|
|
2238
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2239
|
-
itemId:
|
|
2240
|
-
reasoningEncryptedContent:
|
|
2297
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v413.z.object({
|
|
2298
|
+
itemId: import_v413.z.string().nullish(),
|
|
2299
|
+
reasoningEncryptedContent: import_v413.z.string().nullish()
|
|
2241
2300
|
});
|
|
2242
2301
|
|
|
2243
2302
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2262,198 +2321,201 @@ function mapOpenAIResponseFinishReason({
|
|
|
2262
2321
|
var import_provider7 = require("@ai-sdk/provider");
|
|
2263
2322
|
|
|
2264
2323
|
// src/tool/code-interpreter.ts
|
|
2265
|
-
var
|
|
2266
|
-
var
|
|
2267
|
-
var codeInterpreterInputSchema =
|
|
2268
|
-
code:
|
|
2269
|
-
containerId:
|
|
2324
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
2325
|
+
var import_v414 = require("zod/v4");
|
|
2326
|
+
var codeInterpreterInputSchema = import_v414.z.object({
|
|
2327
|
+
code: import_v414.z.string().nullish(),
|
|
2328
|
+
containerId: import_v414.z.string()
|
|
2270
2329
|
});
|
|
2271
|
-
var codeInterpreterOutputSchema =
|
|
2272
|
-
outputs:
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2330
|
+
var codeInterpreterOutputSchema = import_v414.z.object({
|
|
2331
|
+
outputs: import_v414.z.array(
|
|
2332
|
+
import_v414.z.discriminatedUnion("type", [
|
|
2333
|
+
import_v414.z.object({ type: import_v414.z.literal("logs"), logs: import_v414.z.string() }),
|
|
2334
|
+
import_v414.z.object({ type: import_v414.z.literal("image"), url: import_v414.z.string() })
|
|
2276
2335
|
])
|
|
2277
2336
|
).nullish()
|
|
2278
2337
|
});
|
|
2279
|
-
var codeInterpreterArgsSchema =
|
|
2280
|
-
container:
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
fileIds:
|
|
2338
|
+
var codeInterpreterArgsSchema = import_v414.z.object({
|
|
2339
|
+
container: import_v414.z.union([
|
|
2340
|
+
import_v414.z.string(),
|
|
2341
|
+
import_v414.z.object({
|
|
2342
|
+
fileIds: import_v414.z.array(import_v414.z.string()).optional()
|
|
2284
2343
|
})
|
|
2285
2344
|
]).optional()
|
|
2286
2345
|
});
|
|
2287
|
-
var codeInterpreterToolFactory = (0,
|
|
2346
|
+
var codeInterpreterToolFactory = (0, import_provider_utils11.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2288
2347
|
id: "openai.code_interpreter",
|
|
2289
2348
|
name: "code_interpreter",
|
|
2290
2349
|
inputSchema: codeInterpreterInputSchema,
|
|
2291
2350
|
outputSchema: codeInterpreterOutputSchema
|
|
2292
2351
|
});
|
|
2352
|
+
var codeInterpreter = (args = {}) => {
|
|
2353
|
+
return codeInterpreterToolFactory(args);
|
|
2354
|
+
};
|
|
2293
2355
|
|
|
2294
2356
|
// src/tool/file-search.ts
|
|
2295
|
-
var
|
|
2296
|
-
var
|
|
2297
|
-
var comparisonFilterSchema =
|
|
2298
|
-
key:
|
|
2299
|
-
type:
|
|
2300
|
-
value:
|
|
2357
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2358
|
+
var import_v415 = require("zod/v4");
|
|
2359
|
+
var comparisonFilterSchema = import_v415.z.object({
|
|
2360
|
+
key: import_v415.z.string(),
|
|
2361
|
+
type: import_v415.z.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
2362
|
+
value: import_v415.z.union([import_v415.z.string(), import_v415.z.number(), import_v415.z.boolean()])
|
|
2301
2363
|
});
|
|
2302
|
-
var compoundFilterSchema =
|
|
2303
|
-
type:
|
|
2304
|
-
filters:
|
|
2305
|
-
|
|
2364
|
+
var compoundFilterSchema = import_v415.z.object({
|
|
2365
|
+
type: import_v415.z.enum(["and", "or"]),
|
|
2366
|
+
filters: import_v415.z.array(
|
|
2367
|
+
import_v415.z.union([comparisonFilterSchema, import_v415.z.lazy(() => compoundFilterSchema)])
|
|
2306
2368
|
)
|
|
2307
2369
|
});
|
|
2308
|
-
var fileSearchArgsSchema =
|
|
2309
|
-
vectorStoreIds:
|
|
2310
|
-
maxNumResults:
|
|
2311
|
-
ranking:
|
|
2312
|
-
ranker:
|
|
2313
|
-
scoreThreshold:
|
|
2370
|
+
var fileSearchArgsSchema = import_v415.z.object({
|
|
2371
|
+
vectorStoreIds: import_v415.z.array(import_v415.z.string()),
|
|
2372
|
+
maxNumResults: import_v415.z.number().optional(),
|
|
2373
|
+
ranking: import_v415.z.object({
|
|
2374
|
+
ranker: import_v415.z.string().optional(),
|
|
2375
|
+
scoreThreshold: import_v415.z.number().optional()
|
|
2314
2376
|
}).optional(),
|
|
2315
|
-
filters:
|
|
2377
|
+
filters: import_v415.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2316
2378
|
});
|
|
2317
|
-
var fileSearchOutputSchema =
|
|
2318
|
-
queries:
|
|
2319
|
-
results:
|
|
2320
|
-
|
|
2321
|
-
attributes:
|
|
2322
|
-
fileId:
|
|
2323
|
-
filename:
|
|
2324
|
-
score:
|
|
2325
|
-
text:
|
|
2379
|
+
var fileSearchOutputSchema = import_v415.z.object({
|
|
2380
|
+
queries: import_v415.z.array(import_v415.z.string()),
|
|
2381
|
+
results: import_v415.z.array(
|
|
2382
|
+
import_v415.z.object({
|
|
2383
|
+
attributes: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()),
|
|
2384
|
+
fileId: import_v415.z.string(),
|
|
2385
|
+
filename: import_v415.z.string(),
|
|
2386
|
+
score: import_v415.z.number(),
|
|
2387
|
+
text: import_v415.z.string()
|
|
2326
2388
|
})
|
|
2327
2389
|
).nullable()
|
|
2328
2390
|
});
|
|
2329
|
-
var fileSearch = (0,
|
|
2391
|
+
var fileSearch = (0, import_provider_utils12.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2330
2392
|
id: "openai.file_search",
|
|
2331
2393
|
name: "file_search",
|
|
2332
|
-
inputSchema:
|
|
2394
|
+
inputSchema: import_v415.z.object({}),
|
|
2333
2395
|
outputSchema: fileSearchOutputSchema
|
|
2334
2396
|
});
|
|
2335
2397
|
|
|
2336
2398
|
// src/tool/web-search.ts
|
|
2337
|
-
var
|
|
2338
|
-
var
|
|
2339
|
-
var webSearchArgsSchema =
|
|
2340
|
-
filters:
|
|
2341
|
-
allowedDomains:
|
|
2399
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2400
|
+
var import_v416 = require("zod/v4");
|
|
2401
|
+
var webSearchArgsSchema = import_v416.z.object({
|
|
2402
|
+
filters: import_v416.z.object({
|
|
2403
|
+
allowedDomains: import_v416.z.array(import_v416.z.string()).optional()
|
|
2342
2404
|
}).optional(),
|
|
2343
|
-
searchContextSize:
|
|
2344
|
-
userLocation:
|
|
2345
|
-
type:
|
|
2346
|
-
country:
|
|
2347
|
-
city:
|
|
2348
|
-
region:
|
|
2349
|
-
timezone:
|
|
2405
|
+
searchContextSize: import_v416.z.enum(["low", "medium", "high"]).optional(),
|
|
2406
|
+
userLocation: import_v416.z.object({
|
|
2407
|
+
type: import_v416.z.literal("approximate"),
|
|
2408
|
+
country: import_v416.z.string().optional(),
|
|
2409
|
+
city: import_v416.z.string().optional(),
|
|
2410
|
+
region: import_v416.z.string().optional(),
|
|
2411
|
+
timezone: import_v416.z.string().optional()
|
|
2350
2412
|
}).optional()
|
|
2351
2413
|
});
|
|
2352
|
-
var webSearchToolFactory = (0,
|
|
2414
|
+
var webSearchToolFactory = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2353
2415
|
id: "openai.web_search",
|
|
2354
2416
|
name: "web_search",
|
|
2355
|
-
inputSchema:
|
|
2356
|
-
action:
|
|
2357
|
-
|
|
2358
|
-
type:
|
|
2359
|
-
query:
|
|
2417
|
+
inputSchema: import_v416.z.object({
|
|
2418
|
+
action: import_v416.z.discriminatedUnion("type", [
|
|
2419
|
+
import_v416.z.object({
|
|
2420
|
+
type: import_v416.z.literal("search"),
|
|
2421
|
+
query: import_v416.z.string().nullish()
|
|
2360
2422
|
}),
|
|
2361
|
-
|
|
2362
|
-
type:
|
|
2363
|
-
url:
|
|
2423
|
+
import_v416.z.object({
|
|
2424
|
+
type: import_v416.z.literal("open_page"),
|
|
2425
|
+
url: import_v416.z.string()
|
|
2364
2426
|
}),
|
|
2365
|
-
|
|
2366
|
-
type:
|
|
2367
|
-
url:
|
|
2368
|
-
pattern:
|
|
2427
|
+
import_v416.z.object({
|
|
2428
|
+
type: import_v416.z.literal("find"),
|
|
2429
|
+
url: import_v416.z.string(),
|
|
2430
|
+
pattern: import_v416.z.string()
|
|
2369
2431
|
})
|
|
2370
2432
|
]).nullish()
|
|
2371
2433
|
})
|
|
2372
2434
|
});
|
|
2373
2435
|
|
|
2374
2436
|
// src/tool/web-search-preview.ts
|
|
2375
|
-
var
|
|
2376
|
-
var
|
|
2377
|
-
var webSearchPreviewArgsSchema =
|
|
2437
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2438
|
+
var import_v417 = require("zod/v4");
|
|
2439
|
+
var webSearchPreviewArgsSchema = import_v417.z.object({
|
|
2378
2440
|
/**
|
|
2379
2441
|
* Search context size to use for the web search.
|
|
2380
2442
|
* - high: Most comprehensive context, highest cost, slower response
|
|
2381
2443
|
* - medium: Balanced context, cost, and latency (default)
|
|
2382
2444
|
* - low: Least context, lowest cost, fastest response
|
|
2383
2445
|
*/
|
|
2384
|
-
searchContextSize:
|
|
2446
|
+
searchContextSize: import_v417.z.enum(["low", "medium", "high"]).optional(),
|
|
2385
2447
|
/**
|
|
2386
2448
|
* User location information to provide geographically relevant search results.
|
|
2387
2449
|
*/
|
|
2388
|
-
userLocation:
|
|
2450
|
+
userLocation: import_v417.z.object({
|
|
2389
2451
|
/**
|
|
2390
2452
|
* Type of location (always 'approximate')
|
|
2391
2453
|
*/
|
|
2392
|
-
type:
|
|
2454
|
+
type: import_v417.z.literal("approximate"),
|
|
2393
2455
|
/**
|
|
2394
2456
|
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
2395
2457
|
*/
|
|
2396
|
-
country:
|
|
2458
|
+
country: import_v417.z.string().optional(),
|
|
2397
2459
|
/**
|
|
2398
2460
|
* City name (free text, e.g., 'Minneapolis')
|
|
2399
2461
|
*/
|
|
2400
|
-
city:
|
|
2462
|
+
city: import_v417.z.string().optional(),
|
|
2401
2463
|
/**
|
|
2402
2464
|
* Region name (free text, e.g., 'Minnesota')
|
|
2403
2465
|
*/
|
|
2404
|
-
region:
|
|
2466
|
+
region: import_v417.z.string().optional(),
|
|
2405
2467
|
/**
|
|
2406
2468
|
* IANA timezone (e.g., 'America/Chicago')
|
|
2407
2469
|
*/
|
|
2408
|
-
timezone:
|
|
2470
|
+
timezone: import_v417.z.string().optional()
|
|
2409
2471
|
}).optional()
|
|
2410
2472
|
});
|
|
2411
|
-
var webSearchPreview = (0,
|
|
2473
|
+
var webSearchPreview = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2412
2474
|
id: "openai.web_search_preview",
|
|
2413
2475
|
name: "web_search_preview",
|
|
2414
|
-
inputSchema:
|
|
2415
|
-
action:
|
|
2416
|
-
|
|
2417
|
-
type:
|
|
2418
|
-
query:
|
|
2476
|
+
inputSchema: import_v417.z.object({
|
|
2477
|
+
action: import_v417.z.discriminatedUnion("type", [
|
|
2478
|
+
import_v417.z.object({
|
|
2479
|
+
type: import_v417.z.literal("search"),
|
|
2480
|
+
query: import_v417.z.string().nullish()
|
|
2419
2481
|
}),
|
|
2420
|
-
|
|
2421
|
-
type:
|
|
2422
|
-
url:
|
|
2482
|
+
import_v417.z.object({
|
|
2483
|
+
type: import_v417.z.literal("open_page"),
|
|
2484
|
+
url: import_v417.z.string()
|
|
2423
2485
|
}),
|
|
2424
|
-
|
|
2425
|
-
type:
|
|
2426
|
-
url:
|
|
2427
|
-
pattern:
|
|
2486
|
+
import_v417.z.object({
|
|
2487
|
+
type: import_v417.z.literal("find"),
|
|
2488
|
+
url: import_v417.z.string(),
|
|
2489
|
+
pattern: import_v417.z.string()
|
|
2428
2490
|
})
|
|
2429
2491
|
]).nullish()
|
|
2430
2492
|
})
|
|
2431
2493
|
});
|
|
2432
2494
|
|
|
2433
2495
|
// src/tool/image-generation.ts
|
|
2434
|
-
var
|
|
2435
|
-
var
|
|
2436
|
-
var imageGenerationArgsSchema =
|
|
2437
|
-
background:
|
|
2438
|
-
inputFidelity:
|
|
2439
|
-
inputImageMask:
|
|
2440
|
-
fileId:
|
|
2441
|
-
imageUrl:
|
|
2496
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2497
|
+
var import_v418 = require("zod/v4");
|
|
2498
|
+
var imageGenerationArgsSchema = import_v418.z.object({
|
|
2499
|
+
background: import_v418.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
2500
|
+
inputFidelity: import_v418.z.enum(["low", "high"]).optional(),
|
|
2501
|
+
inputImageMask: import_v418.z.object({
|
|
2502
|
+
fileId: import_v418.z.string().optional(),
|
|
2503
|
+
imageUrl: import_v418.z.string().optional()
|
|
2442
2504
|
}).optional(),
|
|
2443
|
-
model:
|
|
2444
|
-
moderation:
|
|
2445
|
-
outputCompression:
|
|
2446
|
-
outputFormat:
|
|
2447
|
-
quality:
|
|
2448
|
-
size:
|
|
2505
|
+
model: import_v418.z.string().optional(),
|
|
2506
|
+
moderation: import_v418.z.enum(["auto"]).optional(),
|
|
2507
|
+
outputCompression: import_v418.z.number().int().min(0).max(100).optional(),
|
|
2508
|
+
outputFormat: import_v418.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
2509
|
+
quality: import_v418.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
2510
|
+
size: import_v418.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
2449
2511
|
}).strict();
|
|
2450
|
-
var imageGenerationOutputSchema =
|
|
2451
|
-
result:
|
|
2512
|
+
var imageGenerationOutputSchema = import_v418.z.object({
|
|
2513
|
+
result: import_v418.z.string()
|
|
2452
2514
|
});
|
|
2453
|
-
var imageGenerationToolFactory = (0,
|
|
2515
|
+
var imageGenerationToolFactory = (0, import_provider_utils15.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2454
2516
|
id: "openai.image_generation",
|
|
2455
2517
|
name: "image_generation",
|
|
2456
|
-
inputSchema:
|
|
2518
|
+
inputSchema: import_v418.z.object({}),
|
|
2457
2519
|
outputSchema: imageGenerationOutputSchema
|
|
2458
2520
|
});
|
|
2459
2521
|
|
|
@@ -2496,6 +2558,12 @@ function prepareResponsesTools({
|
|
|
2496
2558
|
});
|
|
2497
2559
|
break;
|
|
2498
2560
|
}
|
|
2561
|
+
case "openai.local_shell": {
|
|
2562
|
+
openaiTools.push({
|
|
2563
|
+
type: "local_shell"
|
|
2564
|
+
});
|
|
2565
|
+
break;
|
|
2566
|
+
}
|
|
2499
2567
|
case "openai.web_search_preview": {
|
|
2500
2568
|
const args = webSearchPreviewArgsSchema.parse(tool.args);
|
|
2501
2569
|
openaiTools.push({
|
|
@@ -2575,73 +2643,86 @@ function prepareResponsesTools({
|
|
|
2575
2643
|
}
|
|
2576
2644
|
|
|
2577
2645
|
// src/responses/openai-responses-language-model.ts
|
|
2578
|
-
var webSearchCallItem =
|
|
2579
|
-
type:
|
|
2580
|
-
id:
|
|
2581
|
-
status:
|
|
2582
|
-
action:
|
|
2583
|
-
|
|
2584
|
-
type:
|
|
2585
|
-
query:
|
|
2646
|
+
var webSearchCallItem = import_v419.z.object({
|
|
2647
|
+
type: import_v419.z.literal("web_search_call"),
|
|
2648
|
+
id: import_v419.z.string(),
|
|
2649
|
+
status: import_v419.z.string(),
|
|
2650
|
+
action: import_v419.z.discriminatedUnion("type", [
|
|
2651
|
+
import_v419.z.object({
|
|
2652
|
+
type: import_v419.z.literal("search"),
|
|
2653
|
+
query: import_v419.z.string().nullish()
|
|
2586
2654
|
}),
|
|
2587
|
-
|
|
2588
|
-
type:
|
|
2589
|
-
url:
|
|
2655
|
+
import_v419.z.object({
|
|
2656
|
+
type: import_v419.z.literal("open_page"),
|
|
2657
|
+
url: import_v419.z.string()
|
|
2590
2658
|
}),
|
|
2591
|
-
|
|
2592
|
-
type:
|
|
2593
|
-
url:
|
|
2594
|
-
pattern:
|
|
2659
|
+
import_v419.z.object({
|
|
2660
|
+
type: import_v419.z.literal("find"),
|
|
2661
|
+
url: import_v419.z.string(),
|
|
2662
|
+
pattern: import_v419.z.string()
|
|
2595
2663
|
})
|
|
2596
2664
|
]).nullish()
|
|
2597
2665
|
});
|
|
2598
|
-
var fileSearchCallItem =
|
|
2599
|
-
type:
|
|
2600
|
-
id:
|
|
2601
|
-
queries:
|
|
2602
|
-
results:
|
|
2603
|
-
|
|
2604
|
-
attributes:
|
|
2605
|
-
file_id:
|
|
2606
|
-
filename:
|
|
2607
|
-
score:
|
|
2608
|
-
text:
|
|
2666
|
+
var fileSearchCallItem = import_v419.z.object({
|
|
2667
|
+
type: import_v419.z.literal("file_search_call"),
|
|
2668
|
+
id: import_v419.z.string(),
|
|
2669
|
+
queries: import_v419.z.array(import_v419.z.string()),
|
|
2670
|
+
results: import_v419.z.array(
|
|
2671
|
+
import_v419.z.object({
|
|
2672
|
+
attributes: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()),
|
|
2673
|
+
file_id: import_v419.z.string(),
|
|
2674
|
+
filename: import_v419.z.string(),
|
|
2675
|
+
score: import_v419.z.number(),
|
|
2676
|
+
text: import_v419.z.string()
|
|
2609
2677
|
})
|
|
2610
2678
|
).nullish()
|
|
2611
2679
|
});
|
|
2612
|
-
var codeInterpreterCallItem =
|
|
2613
|
-
type:
|
|
2614
|
-
id:
|
|
2615
|
-
code:
|
|
2616
|
-
container_id:
|
|
2617
|
-
outputs:
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2680
|
+
var codeInterpreterCallItem = import_v419.z.object({
|
|
2681
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
2682
|
+
id: import_v419.z.string(),
|
|
2683
|
+
code: import_v419.z.string().nullable(),
|
|
2684
|
+
container_id: import_v419.z.string(),
|
|
2685
|
+
outputs: import_v419.z.array(
|
|
2686
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2687
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
2688
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
2621
2689
|
])
|
|
2622
2690
|
).nullable()
|
|
2623
2691
|
});
|
|
2624
|
-
var
|
|
2625
|
-
type:
|
|
2626
|
-
id:
|
|
2627
|
-
|
|
2692
|
+
var localShellCallItem = import_v419.z.object({
|
|
2693
|
+
type: import_v419.z.literal("local_shell_call"),
|
|
2694
|
+
id: import_v419.z.string(),
|
|
2695
|
+
call_id: import_v419.z.string(),
|
|
2696
|
+
action: import_v419.z.object({
|
|
2697
|
+
type: import_v419.z.literal("exec"),
|
|
2698
|
+
command: import_v419.z.array(import_v419.z.string()),
|
|
2699
|
+
timeout_ms: import_v419.z.number().optional(),
|
|
2700
|
+
user: import_v419.z.string().optional(),
|
|
2701
|
+
working_directory: import_v419.z.string().optional(),
|
|
2702
|
+
env: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional()
|
|
2703
|
+
})
|
|
2704
|
+
});
|
|
2705
|
+
var imageGenerationCallItem = import_v419.z.object({
|
|
2706
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
2707
|
+
id: import_v419.z.string(),
|
|
2708
|
+
result: import_v419.z.string()
|
|
2628
2709
|
});
|
|
2629
2710
|
var TOP_LOGPROBS_MAX = 20;
|
|
2630
|
-
var LOGPROBS_SCHEMA =
|
|
2631
|
-
|
|
2632
|
-
token:
|
|
2633
|
-
logprob:
|
|
2634
|
-
top_logprobs:
|
|
2635
|
-
|
|
2636
|
-
token:
|
|
2637
|
-
logprob:
|
|
2711
|
+
var LOGPROBS_SCHEMA = import_v419.z.array(
|
|
2712
|
+
import_v419.z.object({
|
|
2713
|
+
token: import_v419.z.string(),
|
|
2714
|
+
logprob: import_v419.z.number(),
|
|
2715
|
+
top_logprobs: import_v419.z.array(
|
|
2716
|
+
import_v419.z.object({
|
|
2717
|
+
token: import_v419.z.string(),
|
|
2718
|
+
logprob: import_v419.z.number()
|
|
2638
2719
|
})
|
|
2639
2720
|
)
|
|
2640
2721
|
})
|
|
2641
2722
|
);
|
|
2642
2723
|
var OpenAIResponsesLanguageModel = class {
|
|
2643
2724
|
constructor(modelId, config) {
|
|
2644
|
-
this.specificationVersion = "
|
|
2725
|
+
this.specificationVersion = "v3";
|
|
2645
2726
|
this.supportedUrls = {
|
|
2646
2727
|
"image/*": [/^https?:\/\/.*$/],
|
|
2647
2728
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -2691,7 +2772,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2691
2772
|
if (stopSequences != null) {
|
|
2692
2773
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
2693
2774
|
}
|
|
2694
|
-
const openaiOptions = await (0,
|
|
2775
|
+
const openaiOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2695
2776
|
provider: "openai",
|
|
2696
2777
|
providerOptions,
|
|
2697
2778
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -2700,7 +2781,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2700
2781
|
prompt,
|
|
2701
2782
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
2702
2783
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
2703
|
-
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
|
|
2784
|
+
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
2785
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
2704
2786
|
});
|
|
2705
2787
|
warnings.push(...inputWarnings);
|
|
2706
2788
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
@@ -2859,51 +2941,51 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2859
2941
|
responseHeaders,
|
|
2860
2942
|
value: response,
|
|
2861
2943
|
rawValue: rawResponse
|
|
2862
|
-
} = await (0,
|
|
2944
|
+
} = await (0, import_provider_utils16.postJsonToApi)({
|
|
2863
2945
|
url,
|
|
2864
|
-
headers: (0,
|
|
2946
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
2865
2947
|
body,
|
|
2866
2948
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2867
|
-
successfulResponseHandler: (0,
|
|
2868
|
-
|
|
2869
|
-
id:
|
|
2870
|
-
created_at:
|
|
2871
|
-
error:
|
|
2872
|
-
code:
|
|
2873
|
-
message:
|
|
2949
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
2950
|
+
import_v419.z.object({
|
|
2951
|
+
id: import_v419.z.string(),
|
|
2952
|
+
created_at: import_v419.z.number(),
|
|
2953
|
+
error: import_v419.z.object({
|
|
2954
|
+
code: import_v419.z.string(),
|
|
2955
|
+
message: import_v419.z.string()
|
|
2874
2956
|
}).nullish(),
|
|
2875
|
-
model:
|
|
2876
|
-
output:
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
type:
|
|
2880
|
-
role:
|
|
2881
|
-
id:
|
|
2882
|
-
content:
|
|
2883
|
-
|
|
2884
|
-
type:
|
|
2885
|
-
text:
|
|
2957
|
+
model: import_v419.z.string(),
|
|
2958
|
+
output: import_v419.z.array(
|
|
2959
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2960
|
+
import_v419.z.object({
|
|
2961
|
+
type: import_v419.z.literal("message"),
|
|
2962
|
+
role: import_v419.z.literal("assistant"),
|
|
2963
|
+
id: import_v419.z.string(),
|
|
2964
|
+
content: import_v419.z.array(
|
|
2965
|
+
import_v419.z.object({
|
|
2966
|
+
type: import_v419.z.literal("output_text"),
|
|
2967
|
+
text: import_v419.z.string(),
|
|
2886
2968
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2887
|
-
annotations:
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
type:
|
|
2891
|
-
start_index:
|
|
2892
|
-
end_index:
|
|
2893
|
-
url:
|
|
2894
|
-
title:
|
|
2969
|
+
annotations: import_v419.z.array(
|
|
2970
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2971
|
+
import_v419.z.object({
|
|
2972
|
+
type: import_v419.z.literal("url_citation"),
|
|
2973
|
+
start_index: import_v419.z.number(),
|
|
2974
|
+
end_index: import_v419.z.number(),
|
|
2975
|
+
url: import_v419.z.string(),
|
|
2976
|
+
title: import_v419.z.string()
|
|
2895
2977
|
}),
|
|
2896
|
-
|
|
2897
|
-
type:
|
|
2898
|
-
file_id:
|
|
2899
|
-
filename:
|
|
2900
|
-
index:
|
|
2901
|
-
start_index:
|
|
2902
|
-
end_index:
|
|
2903
|
-
quote:
|
|
2978
|
+
import_v419.z.object({
|
|
2979
|
+
type: import_v419.z.literal("file_citation"),
|
|
2980
|
+
file_id: import_v419.z.string(),
|
|
2981
|
+
filename: import_v419.z.string().nullish(),
|
|
2982
|
+
index: import_v419.z.number().nullish(),
|
|
2983
|
+
start_index: import_v419.z.number().nullish(),
|
|
2984
|
+
end_index: import_v419.z.number().nullish(),
|
|
2985
|
+
quote: import_v419.z.string().nullish()
|
|
2904
2986
|
}),
|
|
2905
|
-
|
|
2906
|
-
type:
|
|
2987
|
+
import_v419.z.object({
|
|
2988
|
+
type: import_v419.z.literal("container_file_citation")
|
|
2907
2989
|
})
|
|
2908
2990
|
])
|
|
2909
2991
|
)
|
|
@@ -2914,33 +2996,34 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2914
2996
|
fileSearchCallItem,
|
|
2915
2997
|
codeInterpreterCallItem,
|
|
2916
2998
|
imageGenerationCallItem,
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2999
|
+
localShellCallItem,
|
|
3000
|
+
import_v419.z.object({
|
|
3001
|
+
type: import_v419.z.literal("function_call"),
|
|
3002
|
+
call_id: import_v419.z.string(),
|
|
3003
|
+
name: import_v419.z.string(),
|
|
3004
|
+
arguments: import_v419.z.string(),
|
|
3005
|
+
id: import_v419.z.string()
|
|
2923
3006
|
}),
|
|
2924
|
-
|
|
2925
|
-
type:
|
|
2926
|
-
id:
|
|
2927
|
-
status:
|
|
3007
|
+
import_v419.z.object({
|
|
3008
|
+
type: import_v419.z.literal("computer_call"),
|
|
3009
|
+
id: import_v419.z.string(),
|
|
3010
|
+
status: import_v419.z.string().optional()
|
|
2928
3011
|
}),
|
|
2929
|
-
|
|
2930
|
-
type:
|
|
2931
|
-
id:
|
|
2932
|
-
encrypted_content:
|
|
2933
|
-
summary:
|
|
2934
|
-
|
|
2935
|
-
type:
|
|
2936
|
-
text:
|
|
3012
|
+
import_v419.z.object({
|
|
3013
|
+
type: import_v419.z.literal("reasoning"),
|
|
3014
|
+
id: import_v419.z.string(),
|
|
3015
|
+
encrypted_content: import_v419.z.string().nullish(),
|
|
3016
|
+
summary: import_v419.z.array(
|
|
3017
|
+
import_v419.z.object({
|
|
3018
|
+
type: import_v419.z.literal("summary_text"),
|
|
3019
|
+
text: import_v419.z.string()
|
|
2937
3020
|
})
|
|
2938
3021
|
)
|
|
2939
3022
|
})
|
|
2940
3023
|
])
|
|
2941
3024
|
),
|
|
2942
|
-
service_tier:
|
|
2943
|
-
incomplete_details:
|
|
3025
|
+
service_tier: import_v419.z.string().nullish(),
|
|
3026
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
2944
3027
|
usage: usageSchema2
|
|
2945
3028
|
})
|
|
2946
3029
|
),
|
|
@@ -3000,6 +3083,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3000
3083
|
});
|
|
3001
3084
|
break;
|
|
3002
3085
|
}
|
|
3086
|
+
case "local_shell_call": {
|
|
3087
|
+
content.push({
|
|
3088
|
+
type: "tool-call",
|
|
3089
|
+
toolCallId: part.call_id,
|
|
3090
|
+
toolName: "local_shell",
|
|
3091
|
+
input: JSON.stringify({ action: part.action }),
|
|
3092
|
+
providerMetadata: {
|
|
3093
|
+
openai: {
|
|
3094
|
+
itemId: part.id
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
});
|
|
3098
|
+
break;
|
|
3099
|
+
}
|
|
3003
3100
|
case "message": {
|
|
3004
3101
|
for (const contentPart of part.content) {
|
|
3005
3102
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -3019,7 +3116,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3019
3116
|
content.push({
|
|
3020
3117
|
type: "source",
|
|
3021
3118
|
sourceType: "url",
|
|
3022
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
3119
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils16.generateId)(),
|
|
3023
3120
|
url: annotation.url,
|
|
3024
3121
|
title: annotation.title
|
|
3025
3122
|
});
|
|
@@ -3027,7 +3124,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3027
3124
|
content.push({
|
|
3028
3125
|
type: "source",
|
|
3029
3126
|
sourceType: "document",
|
|
3030
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
3127
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils16.generateId)(),
|
|
3031
3128
|
mediaType: "text/plain",
|
|
3032
3129
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3033
3130
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id
|
|
@@ -3179,18 +3276,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3179
3276
|
warnings,
|
|
3180
3277
|
webSearchToolName
|
|
3181
3278
|
} = await this.getArgs(options);
|
|
3182
|
-
const { responseHeaders, value: response } = await (0,
|
|
3279
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
|
|
3183
3280
|
url: this.config.url({
|
|
3184
3281
|
path: "/responses",
|
|
3185
3282
|
modelId: this.modelId
|
|
3186
3283
|
}),
|
|
3187
|
-
headers: (0,
|
|
3284
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
3188
3285
|
body: {
|
|
3189
3286
|
...body,
|
|
3190
3287
|
stream: true
|
|
3191
3288
|
},
|
|
3192
3289
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3193
|
-
successfulResponseHandler: (0,
|
|
3290
|
+
successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
|
|
3194
3291
|
openaiResponsesChunkSchema
|
|
3195
3292
|
),
|
|
3196
3293
|
abortSignal: options.abortSignal,
|
|
@@ -3257,6 +3354,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3257
3354
|
id: value.item.id,
|
|
3258
3355
|
toolName: "computer_use"
|
|
3259
3356
|
});
|
|
3357
|
+
} else if (value.item.type === "code_interpreter_call") {
|
|
3358
|
+
ongoingToolCalls[value.output_index] = {
|
|
3359
|
+
toolName: "code_interpreter",
|
|
3360
|
+
toolCallId: value.item.id,
|
|
3361
|
+
codeInterpreter: {
|
|
3362
|
+
containerId: value.item.container_id
|
|
3363
|
+
}
|
|
3364
|
+
};
|
|
3365
|
+
controller.enqueue({
|
|
3366
|
+
type: "tool-input-start",
|
|
3367
|
+
id: value.item.id,
|
|
3368
|
+
toolName: "code_interpreter"
|
|
3369
|
+
});
|
|
3370
|
+
controller.enqueue({
|
|
3371
|
+
type: "tool-input-delta",
|
|
3372
|
+
id: value.item.id,
|
|
3373
|
+
delta: `{"containerId":"${value.item.container_id}","code":"`
|
|
3374
|
+
});
|
|
3260
3375
|
} else if (value.item.type === "file_search_call") {
|
|
3261
3376
|
controller.enqueue({
|
|
3262
3377
|
type: "tool-call",
|
|
@@ -3380,16 +3495,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3380
3495
|
providerExecuted: true
|
|
3381
3496
|
});
|
|
3382
3497
|
} else if (value.item.type === "code_interpreter_call") {
|
|
3383
|
-
|
|
3384
|
-
type: "tool-call",
|
|
3385
|
-
toolCallId: value.item.id,
|
|
3386
|
-
toolName: "code_interpreter",
|
|
3387
|
-
input: JSON.stringify({
|
|
3388
|
-
code: value.item.code,
|
|
3389
|
-
containerId: value.item.container_id
|
|
3390
|
-
}),
|
|
3391
|
-
providerExecuted: true
|
|
3392
|
-
});
|
|
3498
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3393
3499
|
controller.enqueue({
|
|
3394
3500
|
type: "tool-result",
|
|
3395
3501
|
toolCallId: value.item.id,
|
|
@@ -3409,6 +3515,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3409
3515
|
},
|
|
3410
3516
|
providerExecuted: true
|
|
3411
3517
|
});
|
|
3518
|
+
} else if (value.item.type === "local_shell_call") {
|
|
3519
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3520
|
+
controller.enqueue({
|
|
3521
|
+
type: "tool-call",
|
|
3522
|
+
toolCallId: value.item.call_id,
|
|
3523
|
+
toolName: "local_shell",
|
|
3524
|
+
input: JSON.stringify({
|
|
3525
|
+
action: {
|
|
3526
|
+
type: "exec",
|
|
3527
|
+
command: value.item.action.command,
|
|
3528
|
+
timeoutMs: value.item.action.timeout_ms,
|
|
3529
|
+
user: value.item.action.user,
|
|
3530
|
+
workingDirectory: value.item.action.working_directory,
|
|
3531
|
+
env: value.item.action.env
|
|
3532
|
+
}
|
|
3533
|
+
}),
|
|
3534
|
+
providerMetadata: {
|
|
3535
|
+
openai: { itemId: value.item.id }
|
|
3536
|
+
}
|
|
3537
|
+
});
|
|
3412
3538
|
} else if (value.item.type === "message") {
|
|
3413
3539
|
controller.enqueue({
|
|
3414
3540
|
type: "text-end",
|
|
@@ -3439,6 +3565,40 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3439
3565
|
delta: value.delta
|
|
3440
3566
|
});
|
|
3441
3567
|
}
|
|
3568
|
+
} else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
|
|
3569
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3570
|
+
if (toolCall != null) {
|
|
3571
|
+
controller.enqueue({
|
|
3572
|
+
type: "tool-input-delta",
|
|
3573
|
+
id: toolCall.toolCallId,
|
|
3574
|
+
// The delta is code, which is embedding in a JSON string.
|
|
3575
|
+
// To escape it, we use JSON.stringify and slice to remove the outer quotes.
|
|
3576
|
+
delta: JSON.stringify(value.delta).slice(1, -1)
|
|
3577
|
+
});
|
|
3578
|
+
}
|
|
3579
|
+
} else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
|
|
3580
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3581
|
+
if (toolCall != null) {
|
|
3582
|
+
controller.enqueue({
|
|
3583
|
+
type: "tool-input-delta",
|
|
3584
|
+
id: toolCall.toolCallId,
|
|
3585
|
+
delta: '"}'
|
|
3586
|
+
});
|
|
3587
|
+
controller.enqueue({
|
|
3588
|
+
type: "tool-input-end",
|
|
3589
|
+
id: toolCall.toolCallId
|
|
3590
|
+
});
|
|
3591
|
+
controller.enqueue({
|
|
3592
|
+
type: "tool-call",
|
|
3593
|
+
toolCallId: toolCall.toolCallId,
|
|
3594
|
+
toolName: "code_interpreter",
|
|
3595
|
+
input: JSON.stringify({
|
|
3596
|
+
code: value.code,
|
|
3597
|
+
containerId: toolCall.codeInterpreter.containerId
|
|
3598
|
+
}),
|
|
3599
|
+
providerExecuted: true
|
|
3600
|
+
});
|
|
3601
|
+
}
|
|
3442
3602
|
} else if (isResponseCreatedChunk(value)) {
|
|
3443
3603
|
responseId = value.response.id;
|
|
3444
3604
|
controller.enqueue({
|
|
@@ -3501,7 +3661,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3501
3661
|
controller.enqueue({
|
|
3502
3662
|
type: "source",
|
|
3503
3663
|
sourceType: "url",
|
|
3504
|
-
id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0,
|
|
3664
|
+
id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils16.generateId)(),
|
|
3505
3665
|
url: value.annotation.url,
|
|
3506
3666
|
title: value.annotation.title
|
|
3507
3667
|
});
|
|
@@ -3509,7 +3669,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3509
3669
|
controller.enqueue({
|
|
3510
3670
|
type: "source",
|
|
3511
3671
|
sourceType: "document",
|
|
3512
|
-
id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0,
|
|
3672
|
+
id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils16.generateId)(),
|
|
3513
3673
|
mediaType: "text/plain",
|
|
3514
3674
|
title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
|
|
3515
3675
|
filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
|
|
@@ -3545,166 +3705,194 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3545
3705
|
};
|
|
3546
3706
|
}
|
|
3547
3707
|
};
|
|
3548
|
-
var usageSchema2 =
|
|
3549
|
-
input_tokens:
|
|
3550
|
-
input_tokens_details:
|
|
3551
|
-
output_tokens:
|
|
3552
|
-
output_tokens_details:
|
|
3708
|
+
var usageSchema2 = import_v419.z.object({
|
|
3709
|
+
input_tokens: import_v419.z.number(),
|
|
3710
|
+
input_tokens_details: import_v419.z.object({ cached_tokens: import_v419.z.number().nullish() }).nullish(),
|
|
3711
|
+
output_tokens: import_v419.z.number(),
|
|
3712
|
+
output_tokens_details: import_v419.z.object({ reasoning_tokens: import_v419.z.number().nullish() }).nullish()
|
|
3553
3713
|
});
|
|
3554
|
-
var textDeltaChunkSchema =
|
|
3555
|
-
type:
|
|
3556
|
-
item_id:
|
|
3557
|
-
delta:
|
|
3714
|
+
var textDeltaChunkSchema = import_v419.z.object({
|
|
3715
|
+
type: import_v419.z.literal("response.output_text.delta"),
|
|
3716
|
+
item_id: import_v419.z.string(),
|
|
3717
|
+
delta: import_v419.z.string(),
|
|
3558
3718
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3559
3719
|
});
|
|
3560
|
-
var errorChunkSchema =
|
|
3561
|
-
type:
|
|
3562
|
-
code:
|
|
3563
|
-
message:
|
|
3564
|
-
param:
|
|
3565
|
-
sequence_number:
|
|
3720
|
+
var errorChunkSchema = import_v419.z.object({
|
|
3721
|
+
type: import_v419.z.literal("error"),
|
|
3722
|
+
code: import_v419.z.string(),
|
|
3723
|
+
message: import_v419.z.string(),
|
|
3724
|
+
param: import_v419.z.string().nullish(),
|
|
3725
|
+
sequence_number: import_v419.z.number()
|
|
3566
3726
|
});
|
|
3567
|
-
var responseFinishedChunkSchema =
|
|
3568
|
-
type:
|
|
3569
|
-
response:
|
|
3570
|
-
incomplete_details:
|
|
3727
|
+
var responseFinishedChunkSchema = import_v419.z.object({
|
|
3728
|
+
type: import_v419.z.enum(["response.completed", "response.incomplete"]),
|
|
3729
|
+
response: import_v419.z.object({
|
|
3730
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
3571
3731
|
usage: usageSchema2,
|
|
3572
|
-
service_tier:
|
|
3732
|
+
service_tier: import_v419.z.string().nullish()
|
|
3573
3733
|
})
|
|
3574
3734
|
});
|
|
3575
|
-
var responseCreatedChunkSchema =
|
|
3576
|
-
type:
|
|
3577
|
-
response:
|
|
3578
|
-
id:
|
|
3579
|
-
created_at:
|
|
3580
|
-
model:
|
|
3581
|
-
service_tier:
|
|
3735
|
+
var responseCreatedChunkSchema = import_v419.z.object({
|
|
3736
|
+
type: import_v419.z.literal("response.created"),
|
|
3737
|
+
response: import_v419.z.object({
|
|
3738
|
+
id: import_v419.z.string(),
|
|
3739
|
+
created_at: import_v419.z.number(),
|
|
3740
|
+
model: import_v419.z.string(),
|
|
3741
|
+
service_tier: import_v419.z.string().nullish()
|
|
3582
3742
|
})
|
|
3583
3743
|
});
|
|
3584
|
-
var responseOutputItemAddedSchema =
|
|
3585
|
-
type:
|
|
3586
|
-
output_index:
|
|
3587
|
-
item:
|
|
3588
|
-
|
|
3589
|
-
type:
|
|
3590
|
-
id:
|
|
3744
|
+
var responseOutputItemAddedSchema = import_v419.z.object({
|
|
3745
|
+
type: import_v419.z.literal("response.output_item.added"),
|
|
3746
|
+
output_index: import_v419.z.number(),
|
|
3747
|
+
item: import_v419.z.discriminatedUnion("type", [
|
|
3748
|
+
import_v419.z.object({
|
|
3749
|
+
type: import_v419.z.literal("message"),
|
|
3750
|
+
id: import_v419.z.string()
|
|
3591
3751
|
}),
|
|
3592
|
-
|
|
3593
|
-
type:
|
|
3594
|
-
id:
|
|
3595
|
-
encrypted_content:
|
|
3752
|
+
import_v419.z.object({
|
|
3753
|
+
type: import_v419.z.literal("reasoning"),
|
|
3754
|
+
id: import_v419.z.string(),
|
|
3755
|
+
encrypted_content: import_v419.z.string().nullish()
|
|
3596
3756
|
}),
|
|
3597
|
-
|
|
3598
|
-
type:
|
|
3599
|
-
id:
|
|
3600
|
-
call_id:
|
|
3601
|
-
name:
|
|
3602
|
-
arguments:
|
|
3757
|
+
import_v419.z.object({
|
|
3758
|
+
type: import_v419.z.literal("function_call"),
|
|
3759
|
+
id: import_v419.z.string(),
|
|
3760
|
+
call_id: import_v419.z.string(),
|
|
3761
|
+
name: import_v419.z.string(),
|
|
3762
|
+
arguments: import_v419.z.string()
|
|
3603
3763
|
}),
|
|
3604
|
-
|
|
3605
|
-
type:
|
|
3606
|
-
id:
|
|
3607
|
-
status:
|
|
3608
|
-
action:
|
|
3609
|
-
type:
|
|
3610
|
-
query:
|
|
3764
|
+
import_v419.z.object({
|
|
3765
|
+
type: import_v419.z.literal("web_search_call"),
|
|
3766
|
+
id: import_v419.z.string(),
|
|
3767
|
+
status: import_v419.z.string(),
|
|
3768
|
+
action: import_v419.z.object({
|
|
3769
|
+
type: import_v419.z.literal("search"),
|
|
3770
|
+
query: import_v419.z.string().optional()
|
|
3611
3771
|
}).nullish()
|
|
3612
3772
|
}),
|
|
3613
|
-
|
|
3614
|
-
type:
|
|
3615
|
-
id:
|
|
3616
|
-
status:
|
|
3773
|
+
import_v419.z.object({
|
|
3774
|
+
type: import_v419.z.literal("computer_call"),
|
|
3775
|
+
id: import_v419.z.string(),
|
|
3776
|
+
status: import_v419.z.string()
|
|
3617
3777
|
}),
|
|
3618
|
-
|
|
3619
|
-
type:
|
|
3620
|
-
id:
|
|
3778
|
+
import_v419.z.object({
|
|
3779
|
+
type: import_v419.z.literal("file_search_call"),
|
|
3780
|
+
id: import_v419.z.string()
|
|
3621
3781
|
}),
|
|
3622
|
-
|
|
3623
|
-
type:
|
|
3624
|
-
id:
|
|
3782
|
+
import_v419.z.object({
|
|
3783
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
3784
|
+
id: import_v419.z.string()
|
|
3785
|
+
}),
|
|
3786
|
+
import_v419.z.object({
|
|
3787
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
3788
|
+
id: import_v419.z.string(),
|
|
3789
|
+
container_id: import_v419.z.string(),
|
|
3790
|
+
code: import_v419.z.string().nullable(),
|
|
3791
|
+
outputs: import_v419.z.array(
|
|
3792
|
+
import_v419.z.discriminatedUnion("type", [
|
|
3793
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
3794
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
3795
|
+
])
|
|
3796
|
+
).nullable(),
|
|
3797
|
+
status: import_v419.z.string()
|
|
3625
3798
|
})
|
|
3626
3799
|
])
|
|
3627
3800
|
});
|
|
3628
|
-
var responseOutputItemDoneSchema =
|
|
3629
|
-
type:
|
|
3630
|
-
output_index:
|
|
3631
|
-
item:
|
|
3632
|
-
|
|
3633
|
-
type:
|
|
3634
|
-
id:
|
|
3801
|
+
var responseOutputItemDoneSchema = import_v419.z.object({
|
|
3802
|
+
type: import_v419.z.literal("response.output_item.done"),
|
|
3803
|
+
output_index: import_v419.z.number(),
|
|
3804
|
+
item: import_v419.z.discriminatedUnion("type", [
|
|
3805
|
+
import_v419.z.object({
|
|
3806
|
+
type: import_v419.z.literal("message"),
|
|
3807
|
+
id: import_v419.z.string()
|
|
3635
3808
|
}),
|
|
3636
|
-
|
|
3637
|
-
type:
|
|
3638
|
-
id:
|
|
3639
|
-
encrypted_content:
|
|
3809
|
+
import_v419.z.object({
|
|
3810
|
+
type: import_v419.z.literal("reasoning"),
|
|
3811
|
+
id: import_v419.z.string(),
|
|
3812
|
+
encrypted_content: import_v419.z.string().nullish()
|
|
3640
3813
|
}),
|
|
3641
|
-
|
|
3642
|
-
type:
|
|
3643
|
-
id:
|
|
3644
|
-
call_id:
|
|
3645
|
-
name:
|
|
3646
|
-
arguments:
|
|
3647
|
-
status:
|
|
3814
|
+
import_v419.z.object({
|
|
3815
|
+
type: import_v419.z.literal("function_call"),
|
|
3816
|
+
id: import_v419.z.string(),
|
|
3817
|
+
call_id: import_v419.z.string(),
|
|
3818
|
+
name: import_v419.z.string(),
|
|
3819
|
+
arguments: import_v419.z.string(),
|
|
3820
|
+
status: import_v419.z.literal("completed")
|
|
3648
3821
|
}),
|
|
3649
3822
|
codeInterpreterCallItem,
|
|
3650
3823
|
imageGenerationCallItem,
|
|
3651
3824
|
webSearchCallItem,
|
|
3652
3825
|
fileSearchCallItem,
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3826
|
+
localShellCallItem,
|
|
3827
|
+
import_v419.z.object({
|
|
3828
|
+
type: import_v419.z.literal("computer_call"),
|
|
3829
|
+
id: import_v419.z.string(),
|
|
3830
|
+
status: import_v419.z.literal("completed")
|
|
3657
3831
|
})
|
|
3658
3832
|
])
|
|
3659
3833
|
});
|
|
3660
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3661
|
-
type:
|
|
3662
|
-
item_id:
|
|
3663
|
-
output_index:
|
|
3664
|
-
delta:
|
|
3834
|
+
var responseFunctionCallArgumentsDeltaSchema = import_v419.z.object({
|
|
3835
|
+
type: import_v419.z.literal("response.function_call_arguments.delta"),
|
|
3836
|
+
item_id: import_v419.z.string(),
|
|
3837
|
+
output_index: import_v419.z.number(),
|
|
3838
|
+
delta: import_v419.z.string()
|
|
3839
|
+
});
|
|
3840
|
+
var responseCodeInterpreterCallCodeDeltaSchema = import_v419.z.object({
|
|
3841
|
+
type: import_v419.z.literal("response.code_interpreter_call_code.delta"),
|
|
3842
|
+
item_id: import_v419.z.string(),
|
|
3843
|
+
output_index: import_v419.z.number(),
|
|
3844
|
+
delta: import_v419.z.string()
|
|
3845
|
+
});
|
|
3846
|
+
var responseCodeInterpreterCallCodeDoneSchema = import_v419.z.object({
|
|
3847
|
+
type: import_v419.z.literal("response.code_interpreter_call_code.done"),
|
|
3848
|
+
item_id: import_v419.z.string(),
|
|
3849
|
+
output_index: import_v419.z.number(),
|
|
3850
|
+
code: import_v419.z.string()
|
|
3665
3851
|
});
|
|
3666
|
-
var responseAnnotationAddedSchema =
|
|
3667
|
-
type:
|
|
3668
|
-
annotation:
|
|
3669
|
-
|
|
3670
|
-
type:
|
|
3671
|
-
url:
|
|
3672
|
-
title:
|
|
3852
|
+
var responseAnnotationAddedSchema = import_v419.z.object({
|
|
3853
|
+
type: import_v419.z.literal("response.output_text.annotation.added"),
|
|
3854
|
+
annotation: import_v419.z.discriminatedUnion("type", [
|
|
3855
|
+
import_v419.z.object({
|
|
3856
|
+
type: import_v419.z.literal("url_citation"),
|
|
3857
|
+
url: import_v419.z.string(),
|
|
3858
|
+
title: import_v419.z.string()
|
|
3673
3859
|
}),
|
|
3674
|
-
|
|
3675
|
-
type:
|
|
3676
|
-
file_id:
|
|
3677
|
-
filename:
|
|
3678
|
-
index:
|
|
3679
|
-
start_index:
|
|
3680
|
-
end_index:
|
|
3681
|
-
quote:
|
|
3860
|
+
import_v419.z.object({
|
|
3861
|
+
type: import_v419.z.literal("file_citation"),
|
|
3862
|
+
file_id: import_v419.z.string(),
|
|
3863
|
+
filename: import_v419.z.string().nullish(),
|
|
3864
|
+
index: import_v419.z.number().nullish(),
|
|
3865
|
+
start_index: import_v419.z.number().nullish(),
|
|
3866
|
+
end_index: import_v419.z.number().nullish(),
|
|
3867
|
+
quote: import_v419.z.string().nullish()
|
|
3682
3868
|
})
|
|
3683
3869
|
])
|
|
3684
3870
|
});
|
|
3685
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3686
|
-
type:
|
|
3687
|
-
item_id:
|
|
3688
|
-
summary_index:
|
|
3871
|
+
var responseReasoningSummaryPartAddedSchema = import_v419.z.object({
|
|
3872
|
+
type: import_v419.z.literal("response.reasoning_summary_part.added"),
|
|
3873
|
+
item_id: import_v419.z.string(),
|
|
3874
|
+
summary_index: import_v419.z.number()
|
|
3689
3875
|
});
|
|
3690
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3691
|
-
type:
|
|
3692
|
-
item_id:
|
|
3693
|
-
summary_index:
|
|
3694
|
-
delta:
|
|
3876
|
+
var responseReasoningSummaryTextDeltaSchema = import_v419.z.object({
|
|
3877
|
+
type: import_v419.z.literal("response.reasoning_summary_text.delta"),
|
|
3878
|
+
item_id: import_v419.z.string(),
|
|
3879
|
+
summary_index: import_v419.z.number(),
|
|
3880
|
+
delta: import_v419.z.string()
|
|
3695
3881
|
});
|
|
3696
|
-
var openaiResponsesChunkSchema =
|
|
3882
|
+
var openaiResponsesChunkSchema = import_v419.z.union([
|
|
3697
3883
|
textDeltaChunkSchema,
|
|
3698
3884
|
responseFinishedChunkSchema,
|
|
3699
3885
|
responseCreatedChunkSchema,
|
|
3700
3886
|
responseOutputItemAddedSchema,
|
|
3701
3887
|
responseOutputItemDoneSchema,
|
|
3702
3888
|
responseFunctionCallArgumentsDeltaSchema,
|
|
3889
|
+
responseCodeInterpreterCallCodeDeltaSchema,
|
|
3890
|
+
responseCodeInterpreterCallCodeDoneSchema,
|
|
3703
3891
|
responseAnnotationAddedSchema,
|
|
3704
3892
|
responseReasoningSummaryPartAddedSchema,
|
|
3705
3893
|
responseReasoningSummaryTextDeltaSchema,
|
|
3706
3894
|
errorChunkSchema,
|
|
3707
|
-
|
|
3895
|
+
import_v419.z.object({ type: import_v419.z.string() }).loose()
|
|
3708
3896
|
// fallback for unknown chunks
|
|
3709
3897
|
]);
|
|
3710
3898
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3725,6 +3913,12 @@ function isResponseCreatedChunk(chunk) {
|
|
|
3725
3913
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
3726
3914
|
return chunk.type === "response.function_call_arguments.delta";
|
|
3727
3915
|
}
|
|
3916
|
+
function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
|
|
3917
|
+
return chunk.type === "response.code_interpreter_call_code.delta";
|
|
3918
|
+
}
|
|
3919
|
+
function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
|
|
3920
|
+
return chunk.type === "response.code_interpreter_call_code.done";
|
|
3921
|
+
}
|
|
3728
3922
|
function isResponseOutputItemAddedChunk(chunk) {
|
|
3729
3923
|
return chunk.type === "response.output_item.added";
|
|
3730
3924
|
}
|
|
@@ -3777,15 +3971,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3777
3971
|
isReasoningModel: false
|
|
3778
3972
|
};
|
|
3779
3973
|
}
|
|
3780
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3781
|
-
include:
|
|
3782
|
-
|
|
3974
|
+
var openaiResponsesProviderOptionsSchema = import_v419.z.object({
|
|
3975
|
+
include: import_v419.z.array(
|
|
3976
|
+
import_v419.z.enum([
|
|
3783
3977
|
"reasoning.encrypted_content",
|
|
3784
3978
|
"file_search_call.results",
|
|
3785
3979
|
"message.output_text.logprobs"
|
|
3786
3980
|
])
|
|
3787
3981
|
).nullish(),
|
|
3788
|
-
instructions:
|
|
3982
|
+
instructions: import_v419.z.string().nullish(),
|
|
3789
3983
|
/**
|
|
3790
3984
|
* Return the log probabilities of the tokens.
|
|
3791
3985
|
*
|
|
@@ -3798,25 +3992,25 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3798
3992
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3799
3993
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3800
3994
|
*/
|
|
3801
|
-
logprobs:
|
|
3995
|
+
logprobs: import_v419.z.union([import_v419.z.boolean(), import_v419.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3802
3996
|
/**
|
|
3803
3997
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3804
3998
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3805
3999
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3806
4000
|
*/
|
|
3807
|
-
maxToolCalls:
|
|
3808
|
-
metadata:
|
|
3809
|
-
parallelToolCalls:
|
|
3810
|
-
previousResponseId:
|
|
3811
|
-
promptCacheKey:
|
|
3812
|
-
reasoningEffort:
|
|
3813
|
-
reasoningSummary:
|
|
3814
|
-
safetyIdentifier:
|
|
3815
|
-
serviceTier:
|
|
3816
|
-
store:
|
|
3817
|
-
strictJsonSchema:
|
|
3818
|
-
textVerbosity:
|
|
3819
|
-
user:
|
|
4001
|
+
maxToolCalls: import_v419.z.number().nullish(),
|
|
4002
|
+
metadata: import_v419.z.any().nullish(),
|
|
4003
|
+
parallelToolCalls: import_v419.z.boolean().nullish(),
|
|
4004
|
+
previousResponseId: import_v419.z.string().nullish(),
|
|
4005
|
+
promptCacheKey: import_v419.z.string().nullish(),
|
|
4006
|
+
reasoningEffort: import_v419.z.string().nullish(),
|
|
4007
|
+
reasoningSummary: import_v419.z.string().nullish(),
|
|
4008
|
+
safetyIdentifier: import_v419.z.string().nullish(),
|
|
4009
|
+
serviceTier: import_v419.z.enum(["auto", "flex", "priority"]).nullish(),
|
|
4010
|
+
store: import_v419.z.boolean().nullish(),
|
|
4011
|
+
strictJsonSchema: import_v419.z.boolean().nullish(),
|
|
4012
|
+
textVerbosity: import_v419.z.enum(["low", "medium", "high"]).nullish(),
|
|
4013
|
+
user: import_v419.z.string().nullish()
|
|
3820
4014
|
});
|
|
3821
4015
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3822
4016
|
0 && (module.exports = {
|
|
@@ -3827,6 +4021,14 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3827
4021
|
OpenAIResponsesLanguageModel,
|
|
3828
4022
|
OpenAISpeechModel,
|
|
3829
4023
|
OpenAITranscriptionModel,
|
|
4024
|
+
codeInterpreter,
|
|
4025
|
+
codeInterpreterArgsSchema,
|
|
4026
|
+
codeInterpreterInputSchema,
|
|
4027
|
+
codeInterpreterOutputSchema,
|
|
4028
|
+
codeInterpreterToolFactory,
|
|
4029
|
+
fileSearch,
|
|
4030
|
+
fileSearchArgsSchema,
|
|
4031
|
+
fileSearchOutputSchema,
|
|
3830
4032
|
hasDefaultResponseFormat,
|
|
3831
4033
|
modelMaxImagesPerCall,
|
|
3832
4034
|
openAITranscriptionProviderOptions,
|