@ai-sdk/openai 2.0.39 → 2.0.40
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 +7 -0
- package/dist/index.d.mts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +490 -376
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +455 -341
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +494 -387
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +475 -368
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -2026,13 +2026,38 @@ var OpenAISpeechModel = class {
|
|
|
2026
2026
|
|
|
2027
2027
|
// src/responses/openai-responses-language-model.ts
|
|
2028
2028
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2029
|
-
var
|
|
2030
|
-
var
|
|
2029
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2030
|
+
var import_v419 = require("zod/v4");
|
|
2031
2031
|
|
|
2032
2032
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2033
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
|
|
2034
2038
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
2035
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
|
|
2036
2061
|
function isFileId(data, prefixes) {
|
|
2037
2062
|
if (!prefixes) return false;
|
|
2038
2063
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2041,9 +2066,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2041
2066
|
prompt,
|
|
2042
2067
|
systemMessageMode,
|
|
2043
2068
|
fileIdPrefixes,
|
|
2044
|
-
store
|
|
2069
|
+
store,
|
|
2070
|
+
hasLocalShellTool = false
|
|
2045
2071
|
}) {
|
|
2046
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2072
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2047
2073
|
const input = [];
|
|
2048
2074
|
const warnings = [];
|
|
2049
2075
|
for (const { role, content } of prompt) {
|
|
@@ -2089,7 +2115,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2089
2115
|
return {
|
|
2090
2116
|
type: "input_image",
|
|
2091
2117
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2092
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2118
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils10.convertToBase64)(part.data)}`
|
|
2093
2119
|
},
|
|
2094
2120
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2095
2121
|
};
|
|
@@ -2104,7 +2130,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2104
2130
|
type: "input_file",
|
|
2105
2131
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2106
2132
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2107
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2133
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils10.convertToBase64)(part.data)}`
|
|
2108
2134
|
}
|
|
2109
2135
|
};
|
|
2110
2136
|
} else {
|
|
@@ -2136,12 +2162,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2136
2162
|
if (part.providerExecuted) {
|
|
2137
2163
|
break;
|
|
2138
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
|
+
}
|
|
2139
2182
|
input.push({
|
|
2140
2183
|
type: "function_call",
|
|
2141
2184
|
call_id: part.toolCallId,
|
|
2142
2185
|
name: part.toolName,
|
|
2143
2186
|
arguments: JSON.stringify(part.input),
|
|
2144
|
-
id: (
|
|
2187
|
+
id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
|
|
2145
2188
|
});
|
|
2146
2189
|
break;
|
|
2147
2190
|
}
|
|
@@ -2158,7 +2201,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2158
2201
|
break;
|
|
2159
2202
|
}
|
|
2160
2203
|
case "reasoning": {
|
|
2161
|
-
const providerOptions = await (0,
|
|
2204
|
+
const providerOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
2162
2205
|
provider: "openai",
|
|
2163
2206
|
providerOptions: part.providerOptions,
|
|
2164
2207
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2215,6 +2258,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2215
2258
|
case "tool": {
|
|
2216
2259
|
for (const part of content) {
|
|
2217
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
|
+
}
|
|
2218
2269
|
let contentValue;
|
|
2219
2270
|
switch (output.type) {
|
|
2220
2271
|
case "text":
|
|
@@ -2243,9 +2294,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2243
2294
|
}
|
|
2244
2295
|
return { input, warnings };
|
|
2245
2296
|
}
|
|
2246
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2247
|
-
itemId:
|
|
2248
|
-
reasoningEncryptedContent:
|
|
2297
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v413.z.object({
|
|
2298
|
+
itemId: import_v413.z.string().nullish(),
|
|
2299
|
+
reasoningEncryptedContent: import_v413.z.string().nullish()
|
|
2249
2300
|
});
|
|
2250
2301
|
|
|
2251
2302
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2270,29 +2321,29 @@ function mapOpenAIResponseFinishReason({
|
|
|
2270
2321
|
var import_provider7 = require("@ai-sdk/provider");
|
|
2271
2322
|
|
|
2272
2323
|
// src/tool/code-interpreter.ts
|
|
2273
|
-
var
|
|
2274
|
-
var
|
|
2275
|
-
var codeInterpreterInputSchema =
|
|
2276
|
-
code:
|
|
2277
|
-
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()
|
|
2278
2329
|
});
|
|
2279
|
-
var codeInterpreterOutputSchema =
|
|
2280
|
-
outputs:
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
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() })
|
|
2284
2335
|
])
|
|
2285
2336
|
).nullish()
|
|
2286
2337
|
});
|
|
2287
|
-
var codeInterpreterArgsSchema =
|
|
2288
|
-
container:
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
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()
|
|
2292
2343
|
})
|
|
2293
2344
|
]).optional()
|
|
2294
2345
|
});
|
|
2295
|
-
var codeInterpreterToolFactory = (0,
|
|
2346
|
+
var codeInterpreterToolFactory = (0, import_provider_utils11.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2296
2347
|
id: "openai.code_interpreter",
|
|
2297
2348
|
name: "code_interpreter",
|
|
2298
2349
|
inputSchema: codeInterpreterInputSchema,
|
|
@@ -2303,168 +2354,168 @@ var codeInterpreter = (args = {}) => {
|
|
|
2303
2354
|
};
|
|
2304
2355
|
|
|
2305
2356
|
// src/tool/file-search.ts
|
|
2306
|
-
var
|
|
2307
|
-
var
|
|
2308
|
-
var comparisonFilterSchema =
|
|
2309
|
-
key:
|
|
2310
|
-
type:
|
|
2311
|
-
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()])
|
|
2312
2363
|
});
|
|
2313
|
-
var compoundFilterSchema =
|
|
2314
|
-
type:
|
|
2315
|
-
filters:
|
|
2316
|
-
|
|
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)])
|
|
2317
2368
|
)
|
|
2318
2369
|
});
|
|
2319
|
-
var fileSearchArgsSchema =
|
|
2320
|
-
vectorStoreIds:
|
|
2321
|
-
maxNumResults:
|
|
2322
|
-
ranking:
|
|
2323
|
-
ranker:
|
|
2324
|
-
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()
|
|
2325
2376
|
}).optional(),
|
|
2326
|
-
filters:
|
|
2377
|
+
filters: import_v415.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2327
2378
|
});
|
|
2328
|
-
var fileSearchOutputSchema =
|
|
2329
|
-
queries:
|
|
2330
|
-
results:
|
|
2331
|
-
|
|
2332
|
-
attributes:
|
|
2333
|
-
fileId:
|
|
2334
|
-
filename:
|
|
2335
|
-
score:
|
|
2336
|
-
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()
|
|
2337
2388
|
})
|
|
2338
2389
|
).nullable()
|
|
2339
2390
|
});
|
|
2340
|
-
var fileSearch = (0,
|
|
2391
|
+
var fileSearch = (0, import_provider_utils12.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2341
2392
|
id: "openai.file_search",
|
|
2342
2393
|
name: "file_search",
|
|
2343
|
-
inputSchema:
|
|
2394
|
+
inputSchema: import_v415.z.object({}),
|
|
2344
2395
|
outputSchema: fileSearchOutputSchema
|
|
2345
2396
|
});
|
|
2346
2397
|
|
|
2347
2398
|
// src/tool/web-search.ts
|
|
2348
|
-
var
|
|
2349
|
-
var
|
|
2350
|
-
var webSearchArgsSchema =
|
|
2351
|
-
filters:
|
|
2352
|
-
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()
|
|
2353
2404
|
}).optional(),
|
|
2354
|
-
searchContextSize:
|
|
2355
|
-
userLocation:
|
|
2356
|
-
type:
|
|
2357
|
-
country:
|
|
2358
|
-
city:
|
|
2359
|
-
region:
|
|
2360
|
-
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()
|
|
2361
2412
|
}).optional()
|
|
2362
2413
|
});
|
|
2363
|
-
var webSearchToolFactory = (0,
|
|
2414
|
+
var webSearchToolFactory = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2364
2415
|
id: "openai.web_search",
|
|
2365
2416
|
name: "web_search",
|
|
2366
|
-
inputSchema:
|
|
2367
|
-
action:
|
|
2368
|
-
|
|
2369
|
-
type:
|
|
2370
|
-
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()
|
|
2371
2422
|
}),
|
|
2372
|
-
|
|
2373
|
-
type:
|
|
2374
|
-
url:
|
|
2423
|
+
import_v416.z.object({
|
|
2424
|
+
type: import_v416.z.literal("open_page"),
|
|
2425
|
+
url: import_v416.z.string()
|
|
2375
2426
|
}),
|
|
2376
|
-
|
|
2377
|
-
type:
|
|
2378
|
-
url:
|
|
2379
|
-
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()
|
|
2380
2431
|
})
|
|
2381
2432
|
]).nullish()
|
|
2382
2433
|
})
|
|
2383
2434
|
});
|
|
2384
2435
|
|
|
2385
2436
|
// src/tool/web-search-preview.ts
|
|
2386
|
-
var
|
|
2387
|
-
var
|
|
2388
|
-
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({
|
|
2389
2440
|
/**
|
|
2390
2441
|
* Search context size to use for the web search.
|
|
2391
2442
|
* - high: Most comprehensive context, highest cost, slower response
|
|
2392
2443
|
* - medium: Balanced context, cost, and latency (default)
|
|
2393
2444
|
* - low: Least context, lowest cost, fastest response
|
|
2394
2445
|
*/
|
|
2395
|
-
searchContextSize:
|
|
2446
|
+
searchContextSize: import_v417.z.enum(["low", "medium", "high"]).optional(),
|
|
2396
2447
|
/**
|
|
2397
2448
|
* User location information to provide geographically relevant search results.
|
|
2398
2449
|
*/
|
|
2399
|
-
userLocation:
|
|
2450
|
+
userLocation: import_v417.z.object({
|
|
2400
2451
|
/**
|
|
2401
2452
|
* Type of location (always 'approximate')
|
|
2402
2453
|
*/
|
|
2403
|
-
type:
|
|
2454
|
+
type: import_v417.z.literal("approximate"),
|
|
2404
2455
|
/**
|
|
2405
2456
|
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
2406
2457
|
*/
|
|
2407
|
-
country:
|
|
2458
|
+
country: import_v417.z.string().optional(),
|
|
2408
2459
|
/**
|
|
2409
2460
|
* City name (free text, e.g., 'Minneapolis')
|
|
2410
2461
|
*/
|
|
2411
|
-
city:
|
|
2462
|
+
city: import_v417.z.string().optional(),
|
|
2412
2463
|
/**
|
|
2413
2464
|
* Region name (free text, e.g., 'Minnesota')
|
|
2414
2465
|
*/
|
|
2415
|
-
region:
|
|
2466
|
+
region: import_v417.z.string().optional(),
|
|
2416
2467
|
/**
|
|
2417
2468
|
* IANA timezone (e.g., 'America/Chicago')
|
|
2418
2469
|
*/
|
|
2419
|
-
timezone:
|
|
2470
|
+
timezone: import_v417.z.string().optional()
|
|
2420
2471
|
}).optional()
|
|
2421
2472
|
});
|
|
2422
|
-
var webSearchPreview = (0,
|
|
2473
|
+
var webSearchPreview = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2423
2474
|
id: "openai.web_search_preview",
|
|
2424
2475
|
name: "web_search_preview",
|
|
2425
|
-
inputSchema:
|
|
2426
|
-
action:
|
|
2427
|
-
|
|
2428
|
-
type:
|
|
2429
|
-
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()
|
|
2430
2481
|
}),
|
|
2431
|
-
|
|
2432
|
-
type:
|
|
2433
|
-
url:
|
|
2482
|
+
import_v417.z.object({
|
|
2483
|
+
type: import_v417.z.literal("open_page"),
|
|
2484
|
+
url: import_v417.z.string()
|
|
2434
2485
|
}),
|
|
2435
|
-
|
|
2436
|
-
type:
|
|
2437
|
-
url:
|
|
2438
|
-
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()
|
|
2439
2490
|
})
|
|
2440
2491
|
]).nullish()
|
|
2441
2492
|
})
|
|
2442
2493
|
});
|
|
2443
2494
|
|
|
2444
2495
|
// src/tool/image-generation.ts
|
|
2445
|
-
var
|
|
2446
|
-
var
|
|
2447
|
-
var imageGenerationArgsSchema =
|
|
2448
|
-
background:
|
|
2449
|
-
inputFidelity:
|
|
2450
|
-
inputImageMask:
|
|
2451
|
-
fileId:
|
|
2452
|
-
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()
|
|
2453
2504
|
}).optional(),
|
|
2454
|
-
model:
|
|
2455
|
-
moderation:
|
|
2456
|
-
outputCompression:
|
|
2457
|
-
outputFormat:
|
|
2458
|
-
quality:
|
|
2459
|
-
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()
|
|
2460
2511
|
}).strict();
|
|
2461
|
-
var imageGenerationOutputSchema =
|
|
2462
|
-
result:
|
|
2512
|
+
var imageGenerationOutputSchema = import_v418.z.object({
|
|
2513
|
+
result: import_v418.z.string()
|
|
2463
2514
|
});
|
|
2464
|
-
var imageGenerationToolFactory = (0,
|
|
2515
|
+
var imageGenerationToolFactory = (0, import_provider_utils15.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2465
2516
|
id: "openai.image_generation",
|
|
2466
2517
|
name: "image_generation",
|
|
2467
|
-
inputSchema:
|
|
2518
|
+
inputSchema: import_v418.z.object({}),
|
|
2468
2519
|
outputSchema: imageGenerationOutputSchema
|
|
2469
2520
|
});
|
|
2470
2521
|
|
|
@@ -2507,6 +2558,12 @@ function prepareResponsesTools({
|
|
|
2507
2558
|
});
|
|
2508
2559
|
break;
|
|
2509
2560
|
}
|
|
2561
|
+
case "openai.local_shell": {
|
|
2562
|
+
openaiTools.push({
|
|
2563
|
+
type: "local_shell"
|
|
2564
|
+
});
|
|
2565
|
+
break;
|
|
2566
|
+
}
|
|
2510
2567
|
case "openai.web_search_preview": {
|
|
2511
2568
|
const args = webSearchPreviewArgsSchema.parse(tool.args);
|
|
2512
2569
|
openaiTools.push({
|
|
@@ -2586,66 +2643,79 @@ function prepareResponsesTools({
|
|
|
2586
2643
|
}
|
|
2587
2644
|
|
|
2588
2645
|
// src/responses/openai-responses-language-model.ts
|
|
2589
|
-
var webSearchCallItem =
|
|
2590
|
-
type:
|
|
2591
|
-
id:
|
|
2592
|
-
status:
|
|
2593
|
-
action:
|
|
2594
|
-
|
|
2595
|
-
type:
|
|
2596
|
-
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()
|
|
2597
2654
|
}),
|
|
2598
|
-
|
|
2599
|
-
type:
|
|
2600
|
-
url:
|
|
2655
|
+
import_v419.z.object({
|
|
2656
|
+
type: import_v419.z.literal("open_page"),
|
|
2657
|
+
url: import_v419.z.string()
|
|
2601
2658
|
}),
|
|
2602
|
-
|
|
2603
|
-
type:
|
|
2604
|
-
url:
|
|
2605
|
-
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()
|
|
2606
2663
|
})
|
|
2607
2664
|
]).nullish()
|
|
2608
2665
|
});
|
|
2609
|
-
var fileSearchCallItem =
|
|
2610
|
-
type:
|
|
2611
|
-
id:
|
|
2612
|
-
queries:
|
|
2613
|
-
results:
|
|
2614
|
-
|
|
2615
|
-
attributes:
|
|
2616
|
-
file_id:
|
|
2617
|
-
filename:
|
|
2618
|
-
score:
|
|
2619
|
-
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()
|
|
2620
2677
|
})
|
|
2621
2678
|
).nullish()
|
|
2622
2679
|
});
|
|
2623
|
-
var codeInterpreterCallItem =
|
|
2624
|
-
type:
|
|
2625
|
-
id:
|
|
2626
|
-
code:
|
|
2627
|
-
container_id:
|
|
2628
|
-
outputs:
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
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() })
|
|
2632
2689
|
])
|
|
2633
2690
|
).nullable()
|
|
2634
2691
|
});
|
|
2635
|
-
var
|
|
2636
|
-
type:
|
|
2637
|
-
id:
|
|
2638
|
-
|
|
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()
|
|
2639
2709
|
});
|
|
2640
2710
|
var TOP_LOGPROBS_MAX = 20;
|
|
2641
|
-
var LOGPROBS_SCHEMA =
|
|
2642
|
-
|
|
2643
|
-
token:
|
|
2644
|
-
logprob:
|
|
2645
|
-
top_logprobs:
|
|
2646
|
-
|
|
2647
|
-
token:
|
|
2648
|
-
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()
|
|
2649
2719
|
})
|
|
2650
2720
|
)
|
|
2651
2721
|
})
|
|
@@ -2702,7 +2772,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2702
2772
|
if (stopSequences != null) {
|
|
2703
2773
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
2704
2774
|
}
|
|
2705
|
-
const openaiOptions = await (0,
|
|
2775
|
+
const openaiOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2706
2776
|
provider: "openai",
|
|
2707
2777
|
providerOptions,
|
|
2708
2778
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -2711,7 +2781,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2711
2781
|
prompt,
|
|
2712
2782
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
2713
2783
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
2714
|
-
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")
|
|
2715
2786
|
});
|
|
2716
2787
|
warnings.push(...inputWarnings);
|
|
2717
2788
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
@@ -2870,51 +2941,51 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2870
2941
|
responseHeaders,
|
|
2871
2942
|
value: response,
|
|
2872
2943
|
rawValue: rawResponse
|
|
2873
|
-
} = await (0,
|
|
2944
|
+
} = await (0, import_provider_utils16.postJsonToApi)({
|
|
2874
2945
|
url,
|
|
2875
|
-
headers: (0,
|
|
2946
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
2876
2947
|
body,
|
|
2877
2948
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2878
|
-
successfulResponseHandler: (0,
|
|
2879
|
-
|
|
2880
|
-
id:
|
|
2881
|
-
created_at:
|
|
2882
|
-
error:
|
|
2883
|
-
code:
|
|
2884
|
-
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()
|
|
2885
2956
|
}).nullish(),
|
|
2886
|
-
model:
|
|
2887
|
-
output:
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
type:
|
|
2891
|
-
role:
|
|
2892
|
-
id:
|
|
2893
|
-
content:
|
|
2894
|
-
|
|
2895
|
-
type:
|
|
2896
|
-
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(),
|
|
2897
2968
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2898
|
-
annotations:
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
type:
|
|
2902
|
-
start_index:
|
|
2903
|
-
end_index:
|
|
2904
|
-
url:
|
|
2905
|
-
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()
|
|
2906
2977
|
}),
|
|
2907
|
-
|
|
2908
|
-
type:
|
|
2909
|
-
file_id:
|
|
2910
|
-
filename:
|
|
2911
|
-
index:
|
|
2912
|
-
start_index:
|
|
2913
|
-
end_index:
|
|
2914
|
-
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()
|
|
2915
2986
|
}),
|
|
2916
|
-
|
|
2917
|
-
type:
|
|
2987
|
+
import_v419.z.object({
|
|
2988
|
+
type: import_v419.z.literal("container_file_citation")
|
|
2918
2989
|
})
|
|
2919
2990
|
])
|
|
2920
2991
|
)
|
|
@@ -2925,33 +2996,34 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2925
2996
|
fileSearchCallItem,
|
|
2926
2997
|
codeInterpreterCallItem,
|
|
2927
2998
|
imageGenerationCallItem,
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
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()
|
|
2934
3006
|
}),
|
|
2935
|
-
|
|
2936
|
-
type:
|
|
2937
|
-
id:
|
|
2938
|
-
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()
|
|
2939
3011
|
}),
|
|
2940
|
-
|
|
2941
|
-
type:
|
|
2942
|
-
id:
|
|
2943
|
-
encrypted_content:
|
|
2944
|
-
summary:
|
|
2945
|
-
|
|
2946
|
-
type:
|
|
2947
|
-
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()
|
|
2948
3020
|
})
|
|
2949
3021
|
)
|
|
2950
3022
|
})
|
|
2951
3023
|
])
|
|
2952
3024
|
),
|
|
2953
|
-
service_tier:
|
|
2954
|
-
incomplete_details:
|
|
3025
|
+
service_tier: import_v419.z.string().nullish(),
|
|
3026
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
2955
3027
|
usage: usageSchema2
|
|
2956
3028
|
})
|
|
2957
3029
|
),
|
|
@@ -3011,6 +3083,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3011
3083
|
});
|
|
3012
3084
|
break;
|
|
3013
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
|
+
}
|
|
3014
3100
|
case "message": {
|
|
3015
3101
|
for (const contentPart of part.content) {
|
|
3016
3102
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -3030,7 +3116,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3030
3116
|
content.push({
|
|
3031
3117
|
type: "source",
|
|
3032
3118
|
sourceType: "url",
|
|
3033
|
-
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)(),
|
|
3034
3120
|
url: annotation.url,
|
|
3035
3121
|
title: annotation.title
|
|
3036
3122
|
});
|
|
@@ -3038,7 +3124,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3038
3124
|
content.push({
|
|
3039
3125
|
type: "source",
|
|
3040
3126
|
sourceType: "document",
|
|
3041
|
-
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)(),
|
|
3042
3128
|
mediaType: "text/plain",
|
|
3043
3129
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3044
3130
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id
|
|
@@ -3190,18 +3276,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3190
3276
|
warnings,
|
|
3191
3277
|
webSearchToolName
|
|
3192
3278
|
} = await this.getArgs(options);
|
|
3193
|
-
const { responseHeaders, value: response } = await (0,
|
|
3279
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
|
|
3194
3280
|
url: this.config.url({
|
|
3195
3281
|
path: "/responses",
|
|
3196
3282
|
modelId: this.modelId
|
|
3197
3283
|
}),
|
|
3198
|
-
headers: (0,
|
|
3284
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
3199
3285
|
body: {
|
|
3200
3286
|
...body,
|
|
3201
3287
|
stream: true
|
|
3202
3288
|
},
|
|
3203
3289
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3204
|
-
successfulResponseHandler: (0,
|
|
3290
|
+
successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
|
|
3205
3291
|
openaiResponsesChunkSchema
|
|
3206
3292
|
),
|
|
3207
3293
|
abortSignal: options.abortSignal,
|
|
@@ -3429,6 +3515,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3429
3515
|
},
|
|
3430
3516
|
providerExecuted: true
|
|
3431
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
|
+
});
|
|
3432
3538
|
} else if (value.item.type === "message") {
|
|
3433
3539
|
controller.enqueue({
|
|
3434
3540
|
type: "text-end",
|
|
@@ -3555,7 +3661,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3555
3661
|
controller.enqueue({
|
|
3556
3662
|
type: "source",
|
|
3557
3663
|
sourceType: "url",
|
|
3558
|
-
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)(),
|
|
3559
3665
|
url: value.annotation.url,
|
|
3560
3666
|
title: value.annotation.title
|
|
3561
3667
|
});
|
|
@@ -3563,7 +3669,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3563
3669
|
controller.enqueue({
|
|
3564
3670
|
type: "source",
|
|
3565
3671
|
sourceType: "document",
|
|
3566
|
-
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)(),
|
|
3567
3673
|
mediaType: "text/plain",
|
|
3568
3674
|
title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
|
|
3569
3675
|
filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
|
|
@@ -3599,180 +3705,181 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3599
3705
|
};
|
|
3600
3706
|
}
|
|
3601
3707
|
};
|
|
3602
|
-
var usageSchema2 =
|
|
3603
|
-
input_tokens:
|
|
3604
|
-
input_tokens_details:
|
|
3605
|
-
output_tokens:
|
|
3606
|
-
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()
|
|
3607
3713
|
});
|
|
3608
|
-
var textDeltaChunkSchema =
|
|
3609
|
-
type:
|
|
3610
|
-
item_id:
|
|
3611
|
-
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(),
|
|
3612
3718
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3613
3719
|
});
|
|
3614
|
-
var errorChunkSchema =
|
|
3615
|
-
type:
|
|
3616
|
-
code:
|
|
3617
|
-
message:
|
|
3618
|
-
param:
|
|
3619
|
-
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()
|
|
3620
3726
|
});
|
|
3621
|
-
var responseFinishedChunkSchema =
|
|
3622
|
-
type:
|
|
3623
|
-
response:
|
|
3624
|
-
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(),
|
|
3625
3731
|
usage: usageSchema2,
|
|
3626
|
-
service_tier:
|
|
3732
|
+
service_tier: import_v419.z.string().nullish()
|
|
3627
3733
|
})
|
|
3628
3734
|
});
|
|
3629
|
-
var responseCreatedChunkSchema =
|
|
3630
|
-
type:
|
|
3631
|
-
response:
|
|
3632
|
-
id:
|
|
3633
|
-
created_at:
|
|
3634
|
-
model:
|
|
3635
|
-
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()
|
|
3636
3742
|
})
|
|
3637
3743
|
});
|
|
3638
|
-
var responseOutputItemAddedSchema =
|
|
3639
|
-
type:
|
|
3640
|
-
output_index:
|
|
3641
|
-
item:
|
|
3642
|
-
|
|
3643
|
-
type:
|
|
3644
|
-
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()
|
|
3645
3751
|
}),
|
|
3646
|
-
|
|
3647
|
-
type:
|
|
3648
|
-
id:
|
|
3649
|
-
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()
|
|
3650
3756
|
}),
|
|
3651
|
-
|
|
3652
|
-
type:
|
|
3653
|
-
id:
|
|
3654
|
-
call_id:
|
|
3655
|
-
name:
|
|
3656
|
-
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()
|
|
3657
3763
|
}),
|
|
3658
|
-
|
|
3659
|
-
type:
|
|
3660
|
-
id:
|
|
3661
|
-
status:
|
|
3662
|
-
action:
|
|
3663
|
-
type:
|
|
3664
|
-
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()
|
|
3665
3771
|
}).nullish()
|
|
3666
3772
|
}),
|
|
3667
|
-
|
|
3668
|
-
type:
|
|
3669
|
-
id:
|
|
3670
|
-
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()
|
|
3671
3777
|
}),
|
|
3672
|
-
|
|
3673
|
-
type:
|
|
3674
|
-
id:
|
|
3778
|
+
import_v419.z.object({
|
|
3779
|
+
type: import_v419.z.literal("file_search_call"),
|
|
3780
|
+
id: import_v419.z.string()
|
|
3675
3781
|
}),
|
|
3676
|
-
|
|
3677
|
-
type:
|
|
3678
|
-
id:
|
|
3782
|
+
import_v419.z.object({
|
|
3783
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
3784
|
+
id: import_v419.z.string()
|
|
3679
3785
|
}),
|
|
3680
|
-
|
|
3681
|
-
type:
|
|
3682
|
-
id:
|
|
3683
|
-
container_id:
|
|
3684
|
-
code:
|
|
3685
|
-
outputs:
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
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() })
|
|
3689
3795
|
])
|
|
3690
3796
|
).nullable(),
|
|
3691
|
-
status:
|
|
3797
|
+
status: import_v419.z.string()
|
|
3692
3798
|
})
|
|
3693
3799
|
])
|
|
3694
3800
|
});
|
|
3695
|
-
var responseOutputItemDoneSchema =
|
|
3696
|
-
type:
|
|
3697
|
-
output_index:
|
|
3698
|
-
item:
|
|
3699
|
-
|
|
3700
|
-
type:
|
|
3701
|
-
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()
|
|
3702
3808
|
}),
|
|
3703
|
-
|
|
3704
|
-
type:
|
|
3705
|
-
id:
|
|
3706
|
-
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()
|
|
3707
3813
|
}),
|
|
3708
|
-
|
|
3709
|
-
type:
|
|
3710
|
-
id:
|
|
3711
|
-
call_id:
|
|
3712
|
-
name:
|
|
3713
|
-
arguments:
|
|
3714
|
-
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")
|
|
3715
3821
|
}),
|
|
3716
3822
|
codeInterpreterCallItem,
|
|
3717
3823
|
imageGenerationCallItem,
|
|
3718
3824
|
webSearchCallItem,
|
|
3719
3825
|
fileSearchCallItem,
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
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")
|
|
3724
3831
|
})
|
|
3725
3832
|
])
|
|
3726
3833
|
});
|
|
3727
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3728
|
-
type:
|
|
3729
|
-
item_id:
|
|
3730
|
-
output_index:
|
|
3731
|
-
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()
|
|
3732
3839
|
});
|
|
3733
|
-
var responseCodeInterpreterCallCodeDeltaSchema =
|
|
3734
|
-
type:
|
|
3735
|
-
item_id:
|
|
3736
|
-
output_index:
|
|
3737
|
-
delta:
|
|
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()
|
|
3738
3845
|
});
|
|
3739
|
-
var responseCodeInterpreterCallCodeDoneSchema =
|
|
3740
|
-
type:
|
|
3741
|
-
item_id:
|
|
3742
|
-
output_index:
|
|
3743
|
-
code:
|
|
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()
|
|
3744
3851
|
});
|
|
3745
|
-
var responseAnnotationAddedSchema =
|
|
3746
|
-
type:
|
|
3747
|
-
annotation:
|
|
3748
|
-
|
|
3749
|
-
type:
|
|
3750
|
-
url:
|
|
3751
|
-
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()
|
|
3752
3859
|
}),
|
|
3753
|
-
|
|
3754
|
-
type:
|
|
3755
|
-
file_id:
|
|
3756
|
-
filename:
|
|
3757
|
-
index:
|
|
3758
|
-
start_index:
|
|
3759
|
-
end_index:
|
|
3760
|
-
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()
|
|
3761
3868
|
})
|
|
3762
3869
|
])
|
|
3763
3870
|
});
|
|
3764
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3765
|
-
type:
|
|
3766
|
-
item_id:
|
|
3767
|
-
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()
|
|
3768
3875
|
});
|
|
3769
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3770
|
-
type:
|
|
3771
|
-
item_id:
|
|
3772
|
-
summary_index:
|
|
3773
|
-
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()
|
|
3774
3881
|
});
|
|
3775
|
-
var openaiResponsesChunkSchema =
|
|
3882
|
+
var openaiResponsesChunkSchema = import_v419.z.union([
|
|
3776
3883
|
textDeltaChunkSchema,
|
|
3777
3884
|
responseFinishedChunkSchema,
|
|
3778
3885
|
responseCreatedChunkSchema,
|
|
@@ -3785,7 +3892,7 @@ var openaiResponsesChunkSchema = import_v418.z.union([
|
|
|
3785
3892
|
responseReasoningSummaryPartAddedSchema,
|
|
3786
3893
|
responseReasoningSummaryTextDeltaSchema,
|
|
3787
3894
|
errorChunkSchema,
|
|
3788
|
-
|
|
3895
|
+
import_v419.z.object({ type: import_v419.z.string() }).loose()
|
|
3789
3896
|
// fallback for unknown chunks
|
|
3790
3897
|
]);
|
|
3791
3898
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3864,15 +3971,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3864
3971
|
isReasoningModel: false
|
|
3865
3972
|
};
|
|
3866
3973
|
}
|
|
3867
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3868
|
-
include:
|
|
3869
|
-
|
|
3974
|
+
var openaiResponsesProviderOptionsSchema = import_v419.z.object({
|
|
3975
|
+
include: import_v419.z.array(
|
|
3976
|
+
import_v419.z.enum([
|
|
3870
3977
|
"reasoning.encrypted_content",
|
|
3871
3978
|
"file_search_call.results",
|
|
3872
3979
|
"message.output_text.logprobs"
|
|
3873
3980
|
])
|
|
3874
3981
|
).nullish(),
|
|
3875
|
-
instructions:
|
|
3982
|
+
instructions: import_v419.z.string().nullish(),
|
|
3876
3983
|
/**
|
|
3877
3984
|
* Return the log probabilities of the tokens.
|
|
3878
3985
|
*
|
|
@@ -3885,25 +3992,25 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3885
3992
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3886
3993
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3887
3994
|
*/
|
|
3888
|
-
logprobs:
|
|
3995
|
+
logprobs: import_v419.z.union([import_v419.z.boolean(), import_v419.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3889
3996
|
/**
|
|
3890
3997
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3891
3998
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3892
3999
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3893
4000
|
*/
|
|
3894
|
-
maxToolCalls:
|
|
3895
|
-
metadata:
|
|
3896
|
-
parallelToolCalls:
|
|
3897
|
-
previousResponseId:
|
|
3898
|
-
promptCacheKey:
|
|
3899
|
-
reasoningEffort:
|
|
3900
|
-
reasoningSummary:
|
|
3901
|
-
safetyIdentifier:
|
|
3902
|
-
serviceTier:
|
|
3903
|
-
store:
|
|
3904
|
-
strictJsonSchema:
|
|
3905
|
-
textVerbosity:
|
|
3906
|
-
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()
|
|
3907
4014
|
});
|
|
3908
4015
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3909
4016
|
0 && (module.exports = {
|