@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.mjs
CHANGED
|
@@ -398,7 +398,7 @@ function prepareChatTools({
|
|
|
398
398
|
// src/chat/openai-chat-language-model.ts
|
|
399
399
|
var OpenAIChatLanguageModel = class {
|
|
400
400
|
constructor(modelId, config) {
|
|
401
|
-
this.specificationVersion = "
|
|
401
|
+
this.specificationVersion = "v3";
|
|
402
402
|
this.supportedUrls = {
|
|
403
403
|
"image/*": [/^https?:\/\/.*$/]
|
|
404
404
|
};
|
|
@@ -1216,7 +1216,7 @@ var openaiCompletionProviderOptions = z4.object({
|
|
|
1216
1216
|
// src/completion/openai-completion-language-model.ts
|
|
1217
1217
|
var OpenAICompletionLanguageModel = class {
|
|
1218
1218
|
constructor(modelId, config) {
|
|
1219
|
-
this.specificationVersion = "
|
|
1219
|
+
this.specificationVersion = "v3";
|
|
1220
1220
|
this.supportedUrls = {
|
|
1221
1221
|
// No URLs are supported for completion models.
|
|
1222
1222
|
};
|
|
@@ -2036,14 +2036,39 @@ import {
|
|
|
2036
2036
|
parseProviderOptions as parseProviderOptions7,
|
|
2037
2037
|
postJsonToApi as postJsonToApi6
|
|
2038
2038
|
} from "@ai-sdk/provider-utils";
|
|
2039
|
-
import { z as
|
|
2039
|
+
import { z as z19 } from "zod/v4";
|
|
2040
2040
|
|
|
2041
2041
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2042
2042
|
import {
|
|
2043
2043
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError4
|
|
2044
2044
|
} from "@ai-sdk/provider";
|
|
2045
2045
|
import { convertToBase64 as convertToBase642, parseProviderOptions as parseProviderOptions6 } from "@ai-sdk/provider-utils";
|
|
2046
|
+
import { z as z13 } from "zod/v4";
|
|
2047
|
+
|
|
2048
|
+
// src/tool/local-shell.ts
|
|
2049
|
+
import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
|
|
2046
2050
|
import { z as z12 } from "zod/v4";
|
|
2051
|
+
var localShellInputSchema = z12.object({
|
|
2052
|
+
action: z12.object({
|
|
2053
|
+
type: z12.literal("exec"),
|
|
2054
|
+
command: z12.array(z12.string()),
|
|
2055
|
+
timeoutMs: z12.number().optional(),
|
|
2056
|
+
user: z12.string().optional(),
|
|
2057
|
+
workingDirectory: z12.string().optional(),
|
|
2058
|
+
env: z12.record(z12.string(), z12.string()).optional()
|
|
2059
|
+
})
|
|
2060
|
+
});
|
|
2061
|
+
var localShellOutputSchema = z12.object({
|
|
2062
|
+
output: z12.string()
|
|
2063
|
+
});
|
|
2064
|
+
var localShell = createProviderDefinedToolFactoryWithOutputSchema({
|
|
2065
|
+
id: "openai.local_shell",
|
|
2066
|
+
name: "local_shell",
|
|
2067
|
+
inputSchema: localShellInputSchema,
|
|
2068
|
+
outputSchema: localShellOutputSchema
|
|
2069
|
+
});
|
|
2070
|
+
|
|
2071
|
+
// src/responses/convert-to-openai-responses-input.ts
|
|
2047
2072
|
function isFileId(data, prefixes) {
|
|
2048
2073
|
if (!prefixes) return false;
|
|
2049
2074
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2052,9 +2077,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2052
2077
|
prompt,
|
|
2053
2078
|
systemMessageMode,
|
|
2054
2079
|
fileIdPrefixes,
|
|
2055
|
-
store
|
|
2080
|
+
store,
|
|
2081
|
+
hasLocalShellTool = false
|
|
2056
2082
|
}) {
|
|
2057
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2083
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2058
2084
|
const input = [];
|
|
2059
2085
|
const warnings = [];
|
|
2060
2086
|
for (const { role, content } of prompt) {
|
|
@@ -2147,12 +2173,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2147
2173
|
if (part.providerExecuted) {
|
|
2148
2174
|
break;
|
|
2149
2175
|
}
|
|
2176
|
+
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2177
|
+
const parsedInput = localShellInputSchema.parse(part.input);
|
|
2178
|
+
input.push({
|
|
2179
|
+
type: "local_shell_call",
|
|
2180
|
+
call_id: part.toolCallId,
|
|
2181
|
+
id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
|
|
2182
|
+
action: {
|
|
2183
|
+
type: "exec",
|
|
2184
|
+
command: parsedInput.action.command,
|
|
2185
|
+
timeout_ms: parsedInput.action.timeoutMs,
|
|
2186
|
+
user: parsedInput.action.user,
|
|
2187
|
+
working_directory: parsedInput.action.workingDirectory,
|
|
2188
|
+
env: parsedInput.action.env
|
|
2189
|
+
}
|
|
2190
|
+
});
|
|
2191
|
+
break;
|
|
2192
|
+
}
|
|
2150
2193
|
input.push({
|
|
2151
2194
|
type: "function_call",
|
|
2152
2195
|
call_id: part.toolCallId,
|
|
2153
2196
|
name: part.toolName,
|
|
2154
2197
|
arguments: JSON.stringify(part.input),
|
|
2155
|
-
id: (
|
|
2198
|
+
id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
|
|
2156
2199
|
});
|
|
2157
2200
|
break;
|
|
2158
2201
|
}
|
|
@@ -2226,6 +2269,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2226
2269
|
case "tool": {
|
|
2227
2270
|
for (const part of content) {
|
|
2228
2271
|
const output = part.output;
|
|
2272
|
+
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2273
|
+
input.push({
|
|
2274
|
+
type: "local_shell_call_output",
|
|
2275
|
+
call_id: part.toolCallId,
|
|
2276
|
+
output: localShellOutputSchema.parse(output.value).output
|
|
2277
|
+
});
|
|
2278
|
+
break;
|
|
2279
|
+
}
|
|
2229
2280
|
let contentValue;
|
|
2230
2281
|
switch (output.type) {
|
|
2231
2282
|
case "text":
|
|
@@ -2254,9 +2305,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2254
2305
|
}
|
|
2255
2306
|
return { input, warnings };
|
|
2256
2307
|
}
|
|
2257
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2258
|
-
itemId:
|
|
2259
|
-
reasoningEncryptedContent:
|
|
2308
|
+
var openaiResponsesReasoningProviderOptionsSchema = z13.object({
|
|
2309
|
+
itemId: z13.string().nullish(),
|
|
2310
|
+
reasoningEncryptedContent: z13.string().nullish()
|
|
2260
2311
|
});
|
|
2261
2312
|
|
|
2262
2313
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2283,110 +2334,113 @@ import {
|
|
|
2283
2334
|
} from "@ai-sdk/provider";
|
|
2284
2335
|
|
|
2285
2336
|
// src/tool/code-interpreter.ts
|
|
2286
|
-
import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
|
|
2287
|
-
import { z as
|
|
2288
|
-
var codeInterpreterInputSchema =
|
|
2289
|
-
code:
|
|
2290
|
-
containerId:
|
|
2337
|
+
import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
|
|
2338
|
+
import { z as z14 } from "zod/v4";
|
|
2339
|
+
var codeInterpreterInputSchema = z14.object({
|
|
2340
|
+
code: z14.string().nullish(),
|
|
2341
|
+
containerId: z14.string()
|
|
2291
2342
|
});
|
|
2292
|
-
var codeInterpreterOutputSchema =
|
|
2293
|
-
outputs:
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2343
|
+
var codeInterpreterOutputSchema = z14.object({
|
|
2344
|
+
outputs: z14.array(
|
|
2345
|
+
z14.discriminatedUnion("type", [
|
|
2346
|
+
z14.object({ type: z14.literal("logs"), logs: z14.string() }),
|
|
2347
|
+
z14.object({ type: z14.literal("image"), url: z14.string() })
|
|
2297
2348
|
])
|
|
2298
2349
|
).nullish()
|
|
2299
2350
|
});
|
|
2300
|
-
var codeInterpreterArgsSchema =
|
|
2301
|
-
container:
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
fileIds:
|
|
2351
|
+
var codeInterpreterArgsSchema = z14.object({
|
|
2352
|
+
container: z14.union([
|
|
2353
|
+
z14.string(),
|
|
2354
|
+
z14.object({
|
|
2355
|
+
fileIds: z14.array(z14.string()).optional()
|
|
2305
2356
|
})
|
|
2306
2357
|
]).optional()
|
|
2307
2358
|
});
|
|
2308
|
-
var codeInterpreterToolFactory =
|
|
2359
|
+
var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema2({
|
|
2309
2360
|
id: "openai.code_interpreter",
|
|
2310
2361
|
name: "code_interpreter",
|
|
2311
2362
|
inputSchema: codeInterpreterInputSchema,
|
|
2312
2363
|
outputSchema: codeInterpreterOutputSchema
|
|
2313
2364
|
});
|
|
2365
|
+
var codeInterpreter = (args = {}) => {
|
|
2366
|
+
return codeInterpreterToolFactory(args);
|
|
2367
|
+
};
|
|
2314
2368
|
|
|
2315
2369
|
// src/tool/file-search.ts
|
|
2316
|
-
import { createProviderDefinedToolFactoryWithOutputSchema as
|
|
2317
|
-
import { z as
|
|
2318
|
-
var comparisonFilterSchema =
|
|
2319
|
-
key:
|
|
2320
|
-
type:
|
|
2321
|
-
value:
|
|
2370
|
+
import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3 } from "@ai-sdk/provider-utils";
|
|
2371
|
+
import { z as z15 } from "zod/v4";
|
|
2372
|
+
var comparisonFilterSchema = z15.object({
|
|
2373
|
+
key: z15.string(),
|
|
2374
|
+
type: z15.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
2375
|
+
value: z15.union([z15.string(), z15.number(), z15.boolean()])
|
|
2322
2376
|
});
|
|
2323
|
-
var compoundFilterSchema =
|
|
2324
|
-
type:
|
|
2325
|
-
filters:
|
|
2326
|
-
|
|
2377
|
+
var compoundFilterSchema = z15.object({
|
|
2378
|
+
type: z15.enum(["and", "or"]),
|
|
2379
|
+
filters: z15.array(
|
|
2380
|
+
z15.union([comparisonFilterSchema, z15.lazy(() => compoundFilterSchema)])
|
|
2327
2381
|
)
|
|
2328
2382
|
});
|
|
2329
|
-
var fileSearchArgsSchema =
|
|
2330
|
-
vectorStoreIds:
|
|
2331
|
-
maxNumResults:
|
|
2332
|
-
ranking:
|
|
2333
|
-
ranker:
|
|
2334
|
-
scoreThreshold:
|
|
2383
|
+
var fileSearchArgsSchema = z15.object({
|
|
2384
|
+
vectorStoreIds: z15.array(z15.string()),
|
|
2385
|
+
maxNumResults: z15.number().optional(),
|
|
2386
|
+
ranking: z15.object({
|
|
2387
|
+
ranker: z15.string().optional(),
|
|
2388
|
+
scoreThreshold: z15.number().optional()
|
|
2335
2389
|
}).optional(),
|
|
2336
|
-
filters:
|
|
2390
|
+
filters: z15.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2337
2391
|
});
|
|
2338
|
-
var fileSearchOutputSchema =
|
|
2339
|
-
queries:
|
|
2340
|
-
results:
|
|
2341
|
-
|
|
2342
|
-
attributes:
|
|
2343
|
-
fileId:
|
|
2344
|
-
filename:
|
|
2345
|
-
score:
|
|
2346
|
-
text:
|
|
2392
|
+
var fileSearchOutputSchema = z15.object({
|
|
2393
|
+
queries: z15.array(z15.string()),
|
|
2394
|
+
results: z15.array(
|
|
2395
|
+
z15.object({
|
|
2396
|
+
attributes: z15.record(z15.string(), z15.unknown()),
|
|
2397
|
+
fileId: z15.string(),
|
|
2398
|
+
filename: z15.string(),
|
|
2399
|
+
score: z15.number(),
|
|
2400
|
+
text: z15.string()
|
|
2347
2401
|
})
|
|
2348
2402
|
).nullable()
|
|
2349
2403
|
});
|
|
2350
|
-
var fileSearch =
|
|
2404
|
+
var fileSearch = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
2351
2405
|
id: "openai.file_search",
|
|
2352
2406
|
name: "file_search",
|
|
2353
|
-
inputSchema:
|
|
2407
|
+
inputSchema: z15.object({}),
|
|
2354
2408
|
outputSchema: fileSearchOutputSchema
|
|
2355
2409
|
});
|
|
2356
2410
|
|
|
2357
2411
|
// src/tool/web-search.ts
|
|
2358
2412
|
import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
|
|
2359
|
-
import { z as
|
|
2360
|
-
var webSearchArgsSchema =
|
|
2361
|
-
filters:
|
|
2362
|
-
allowedDomains:
|
|
2413
|
+
import { z as z16 } from "zod/v4";
|
|
2414
|
+
var webSearchArgsSchema = z16.object({
|
|
2415
|
+
filters: z16.object({
|
|
2416
|
+
allowedDomains: z16.array(z16.string()).optional()
|
|
2363
2417
|
}).optional(),
|
|
2364
|
-
searchContextSize:
|
|
2365
|
-
userLocation:
|
|
2366
|
-
type:
|
|
2367
|
-
country:
|
|
2368
|
-
city:
|
|
2369
|
-
region:
|
|
2370
|
-
timezone:
|
|
2418
|
+
searchContextSize: z16.enum(["low", "medium", "high"]).optional(),
|
|
2419
|
+
userLocation: z16.object({
|
|
2420
|
+
type: z16.literal("approximate"),
|
|
2421
|
+
country: z16.string().optional(),
|
|
2422
|
+
city: z16.string().optional(),
|
|
2423
|
+
region: z16.string().optional(),
|
|
2424
|
+
timezone: z16.string().optional()
|
|
2371
2425
|
}).optional()
|
|
2372
2426
|
});
|
|
2373
2427
|
var webSearchToolFactory = createProviderDefinedToolFactory({
|
|
2374
2428
|
id: "openai.web_search",
|
|
2375
2429
|
name: "web_search",
|
|
2376
|
-
inputSchema:
|
|
2377
|
-
action:
|
|
2378
|
-
|
|
2379
|
-
type:
|
|
2380
|
-
query:
|
|
2430
|
+
inputSchema: z16.object({
|
|
2431
|
+
action: z16.discriminatedUnion("type", [
|
|
2432
|
+
z16.object({
|
|
2433
|
+
type: z16.literal("search"),
|
|
2434
|
+
query: z16.string().nullish()
|
|
2381
2435
|
}),
|
|
2382
|
-
|
|
2383
|
-
type:
|
|
2384
|
-
url:
|
|
2436
|
+
z16.object({
|
|
2437
|
+
type: z16.literal("open_page"),
|
|
2438
|
+
url: z16.string()
|
|
2385
2439
|
}),
|
|
2386
|
-
|
|
2387
|
-
type:
|
|
2388
|
-
url:
|
|
2389
|
-
pattern:
|
|
2440
|
+
z16.object({
|
|
2441
|
+
type: z16.literal("find"),
|
|
2442
|
+
url: z16.string(),
|
|
2443
|
+
pattern: z16.string()
|
|
2390
2444
|
})
|
|
2391
2445
|
]).nullish()
|
|
2392
2446
|
})
|
|
@@ -2394,87 +2448,87 @@ var webSearchToolFactory = createProviderDefinedToolFactory({
|
|
|
2394
2448
|
|
|
2395
2449
|
// src/tool/web-search-preview.ts
|
|
2396
2450
|
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
|
|
2397
|
-
import { z as
|
|
2398
|
-
var webSearchPreviewArgsSchema =
|
|
2451
|
+
import { z as z17 } from "zod/v4";
|
|
2452
|
+
var webSearchPreviewArgsSchema = z17.object({
|
|
2399
2453
|
/**
|
|
2400
2454
|
* Search context size to use for the web search.
|
|
2401
2455
|
* - high: Most comprehensive context, highest cost, slower response
|
|
2402
2456
|
* - medium: Balanced context, cost, and latency (default)
|
|
2403
2457
|
* - low: Least context, lowest cost, fastest response
|
|
2404
2458
|
*/
|
|
2405
|
-
searchContextSize:
|
|
2459
|
+
searchContextSize: z17.enum(["low", "medium", "high"]).optional(),
|
|
2406
2460
|
/**
|
|
2407
2461
|
* User location information to provide geographically relevant search results.
|
|
2408
2462
|
*/
|
|
2409
|
-
userLocation:
|
|
2463
|
+
userLocation: z17.object({
|
|
2410
2464
|
/**
|
|
2411
2465
|
* Type of location (always 'approximate')
|
|
2412
2466
|
*/
|
|
2413
|
-
type:
|
|
2467
|
+
type: z17.literal("approximate"),
|
|
2414
2468
|
/**
|
|
2415
2469
|
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
2416
2470
|
*/
|
|
2417
|
-
country:
|
|
2471
|
+
country: z17.string().optional(),
|
|
2418
2472
|
/**
|
|
2419
2473
|
* City name (free text, e.g., 'Minneapolis')
|
|
2420
2474
|
*/
|
|
2421
|
-
city:
|
|
2475
|
+
city: z17.string().optional(),
|
|
2422
2476
|
/**
|
|
2423
2477
|
* Region name (free text, e.g., 'Minnesota')
|
|
2424
2478
|
*/
|
|
2425
|
-
region:
|
|
2479
|
+
region: z17.string().optional(),
|
|
2426
2480
|
/**
|
|
2427
2481
|
* IANA timezone (e.g., 'America/Chicago')
|
|
2428
2482
|
*/
|
|
2429
|
-
timezone:
|
|
2483
|
+
timezone: z17.string().optional()
|
|
2430
2484
|
}).optional()
|
|
2431
2485
|
});
|
|
2432
2486
|
var webSearchPreview = createProviderDefinedToolFactory2({
|
|
2433
2487
|
id: "openai.web_search_preview",
|
|
2434
2488
|
name: "web_search_preview",
|
|
2435
|
-
inputSchema:
|
|
2436
|
-
action:
|
|
2437
|
-
|
|
2438
|
-
type:
|
|
2439
|
-
query:
|
|
2489
|
+
inputSchema: z17.object({
|
|
2490
|
+
action: z17.discriminatedUnion("type", [
|
|
2491
|
+
z17.object({
|
|
2492
|
+
type: z17.literal("search"),
|
|
2493
|
+
query: z17.string().nullish()
|
|
2440
2494
|
}),
|
|
2441
|
-
|
|
2442
|
-
type:
|
|
2443
|
-
url:
|
|
2495
|
+
z17.object({
|
|
2496
|
+
type: z17.literal("open_page"),
|
|
2497
|
+
url: z17.string()
|
|
2444
2498
|
}),
|
|
2445
|
-
|
|
2446
|
-
type:
|
|
2447
|
-
url:
|
|
2448
|
-
pattern:
|
|
2499
|
+
z17.object({
|
|
2500
|
+
type: z17.literal("find"),
|
|
2501
|
+
url: z17.string(),
|
|
2502
|
+
pattern: z17.string()
|
|
2449
2503
|
})
|
|
2450
2504
|
]).nullish()
|
|
2451
2505
|
})
|
|
2452
2506
|
});
|
|
2453
2507
|
|
|
2454
2508
|
// src/tool/image-generation.ts
|
|
2455
|
-
import { createProviderDefinedToolFactoryWithOutputSchema as
|
|
2456
|
-
import { z as
|
|
2457
|
-
var imageGenerationArgsSchema =
|
|
2458
|
-
background:
|
|
2459
|
-
inputFidelity:
|
|
2460
|
-
inputImageMask:
|
|
2461
|
-
fileId:
|
|
2462
|
-
imageUrl:
|
|
2509
|
+
import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4 } from "@ai-sdk/provider-utils";
|
|
2510
|
+
import { z as z18 } from "zod/v4";
|
|
2511
|
+
var imageGenerationArgsSchema = z18.object({
|
|
2512
|
+
background: z18.enum(["auto", "opaque", "transparent"]).optional(),
|
|
2513
|
+
inputFidelity: z18.enum(["low", "high"]).optional(),
|
|
2514
|
+
inputImageMask: z18.object({
|
|
2515
|
+
fileId: z18.string().optional(),
|
|
2516
|
+
imageUrl: z18.string().optional()
|
|
2463
2517
|
}).optional(),
|
|
2464
|
-
model:
|
|
2465
|
-
moderation:
|
|
2466
|
-
outputCompression:
|
|
2467
|
-
outputFormat:
|
|
2468
|
-
quality:
|
|
2469
|
-
size:
|
|
2518
|
+
model: z18.string().optional(),
|
|
2519
|
+
moderation: z18.enum(["auto"]).optional(),
|
|
2520
|
+
outputCompression: z18.number().int().min(0).max(100).optional(),
|
|
2521
|
+
outputFormat: z18.enum(["png", "jpeg", "webp"]).optional(),
|
|
2522
|
+
quality: z18.enum(["auto", "low", "medium", "high"]).optional(),
|
|
2523
|
+
size: z18.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
2470
2524
|
}).strict();
|
|
2471
|
-
var imageGenerationOutputSchema =
|
|
2472
|
-
result:
|
|
2525
|
+
var imageGenerationOutputSchema = z18.object({
|
|
2526
|
+
result: z18.string()
|
|
2473
2527
|
});
|
|
2474
|
-
var imageGenerationToolFactory =
|
|
2528
|
+
var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
2475
2529
|
id: "openai.image_generation",
|
|
2476
2530
|
name: "image_generation",
|
|
2477
|
-
inputSchema:
|
|
2531
|
+
inputSchema: z18.object({}),
|
|
2478
2532
|
outputSchema: imageGenerationOutputSchema
|
|
2479
2533
|
});
|
|
2480
2534
|
|
|
@@ -2517,6 +2571,12 @@ function prepareResponsesTools({
|
|
|
2517
2571
|
});
|
|
2518
2572
|
break;
|
|
2519
2573
|
}
|
|
2574
|
+
case "openai.local_shell": {
|
|
2575
|
+
openaiTools.push({
|
|
2576
|
+
type: "local_shell"
|
|
2577
|
+
});
|
|
2578
|
+
break;
|
|
2579
|
+
}
|
|
2520
2580
|
case "openai.web_search_preview": {
|
|
2521
2581
|
const args = webSearchPreviewArgsSchema.parse(tool.args);
|
|
2522
2582
|
openaiTools.push({
|
|
@@ -2596,73 +2656,86 @@ function prepareResponsesTools({
|
|
|
2596
2656
|
}
|
|
2597
2657
|
|
|
2598
2658
|
// src/responses/openai-responses-language-model.ts
|
|
2599
|
-
var webSearchCallItem =
|
|
2600
|
-
type:
|
|
2601
|
-
id:
|
|
2602
|
-
status:
|
|
2603
|
-
action:
|
|
2604
|
-
|
|
2605
|
-
type:
|
|
2606
|
-
query:
|
|
2659
|
+
var webSearchCallItem = z19.object({
|
|
2660
|
+
type: z19.literal("web_search_call"),
|
|
2661
|
+
id: z19.string(),
|
|
2662
|
+
status: z19.string(),
|
|
2663
|
+
action: z19.discriminatedUnion("type", [
|
|
2664
|
+
z19.object({
|
|
2665
|
+
type: z19.literal("search"),
|
|
2666
|
+
query: z19.string().nullish()
|
|
2607
2667
|
}),
|
|
2608
|
-
|
|
2609
|
-
type:
|
|
2610
|
-
url:
|
|
2668
|
+
z19.object({
|
|
2669
|
+
type: z19.literal("open_page"),
|
|
2670
|
+
url: z19.string()
|
|
2611
2671
|
}),
|
|
2612
|
-
|
|
2613
|
-
type:
|
|
2614
|
-
url:
|
|
2615
|
-
pattern:
|
|
2672
|
+
z19.object({
|
|
2673
|
+
type: z19.literal("find"),
|
|
2674
|
+
url: z19.string(),
|
|
2675
|
+
pattern: z19.string()
|
|
2616
2676
|
})
|
|
2617
2677
|
]).nullish()
|
|
2618
2678
|
});
|
|
2619
|
-
var fileSearchCallItem =
|
|
2620
|
-
type:
|
|
2621
|
-
id:
|
|
2622
|
-
queries:
|
|
2623
|
-
results:
|
|
2624
|
-
|
|
2625
|
-
attributes:
|
|
2626
|
-
file_id:
|
|
2627
|
-
filename:
|
|
2628
|
-
score:
|
|
2629
|
-
text:
|
|
2679
|
+
var fileSearchCallItem = z19.object({
|
|
2680
|
+
type: z19.literal("file_search_call"),
|
|
2681
|
+
id: z19.string(),
|
|
2682
|
+
queries: z19.array(z19.string()),
|
|
2683
|
+
results: z19.array(
|
|
2684
|
+
z19.object({
|
|
2685
|
+
attributes: z19.record(z19.string(), z19.unknown()),
|
|
2686
|
+
file_id: z19.string(),
|
|
2687
|
+
filename: z19.string(),
|
|
2688
|
+
score: z19.number(),
|
|
2689
|
+
text: z19.string()
|
|
2630
2690
|
})
|
|
2631
2691
|
).nullish()
|
|
2632
2692
|
});
|
|
2633
|
-
var codeInterpreterCallItem =
|
|
2634
|
-
type:
|
|
2635
|
-
id:
|
|
2636
|
-
code:
|
|
2637
|
-
container_id:
|
|
2638
|
-
outputs:
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2693
|
+
var codeInterpreterCallItem = z19.object({
|
|
2694
|
+
type: z19.literal("code_interpreter_call"),
|
|
2695
|
+
id: z19.string(),
|
|
2696
|
+
code: z19.string().nullable(),
|
|
2697
|
+
container_id: z19.string(),
|
|
2698
|
+
outputs: z19.array(
|
|
2699
|
+
z19.discriminatedUnion("type", [
|
|
2700
|
+
z19.object({ type: z19.literal("logs"), logs: z19.string() }),
|
|
2701
|
+
z19.object({ type: z19.literal("image"), url: z19.string() })
|
|
2642
2702
|
])
|
|
2643
2703
|
).nullable()
|
|
2644
2704
|
});
|
|
2645
|
-
var
|
|
2646
|
-
type:
|
|
2647
|
-
id:
|
|
2648
|
-
|
|
2705
|
+
var localShellCallItem = z19.object({
|
|
2706
|
+
type: z19.literal("local_shell_call"),
|
|
2707
|
+
id: z19.string(),
|
|
2708
|
+
call_id: z19.string(),
|
|
2709
|
+
action: z19.object({
|
|
2710
|
+
type: z19.literal("exec"),
|
|
2711
|
+
command: z19.array(z19.string()),
|
|
2712
|
+
timeout_ms: z19.number().optional(),
|
|
2713
|
+
user: z19.string().optional(),
|
|
2714
|
+
working_directory: z19.string().optional(),
|
|
2715
|
+
env: z19.record(z19.string(), z19.string()).optional()
|
|
2716
|
+
})
|
|
2717
|
+
});
|
|
2718
|
+
var imageGenerationCallItem = z19.object({
|
|
2719
|
+
type: z19.literal("image_generation_call"),
|
|
2720
|
+
id: z19.string(),
|
|
2721
|
+
result: z19.string()
|
|
2649
2722
|
});
|
|
2650
2723
|
var TOP_LOGPROBS_MAX = 20;
|
|
2651
|
-
var LOGPROBS_SCHEMA =
|
|
2652
|
-
|
|
2653
|
-
token:
|
|
2654
|
-
logprob:
|
|
2655
|
-
top_logprobs:
|
|
2656
|
-
|
|
2657
|
-
token:
|
|
2658
|
-
logprob:
|
|
2724
|
+
var LOGPROBS_SCHEMA = z19.array(
|
|
2725
|
+
z19.object({
|
|
2726
|
+
token: z19.string(),
|
|
2727
|
+
logprob: z19.number(),
|
|
2728
|
+
top_logprobs: z19.array(
|
|
2729
|
+
z19.object({
|
|
2730
|
+
token: z19.string(),
|
|
2731
|
+
logprob: z19.number()
|
|
2659
2732
|
})
|
|
2660
2733
|
)
|
|
2661
2734
|
})
|
|
2662
2735
|
);
|
|
2663
2736
|
var OpenAIResponsesLanguageModel = class {
|
|
2664
2737
|
constructor(modelId, config) {
|
|
2665
|
-
this.specificationVersion = "
|
|
2738
|
+
this.specificationVersion = "v3";
|
|
2666
2739
|
this.supportedUrls = {
|
|
2667
2740
|
"image/*": [/^https?:\/\/.*$/],
|
|
2668
2741
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -2721,7 +2794,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2721
2794
|
prompt,
|
|
2722
2795
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
2723
2796
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
2724
|
-
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
|
|
2797
|
+
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
2798
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
2725
2799
|
});
|
|
2726
2800
|
warnings.push(...inputWarnings);
|
|
2727
2801
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
@@ -2886,45 +2960,45 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2886
2960
|
body,
|
|
2887
2961
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2888
2962
|
successfulResponseHandler: createJsonResponseHandler6(
|
|
2889
|
-
|
|
2890
|
-
id:
|
|
2891
|
-
created_at:
|
|
2892
|
-
error:
|
|
2893
|
-
code:
|
|
2894
|
-
message:
|
|
2963
|
+
z19.object({
|
|
2964
|
+
id: z19.string(),
|
|
2965
|
+
created_at: z19.number(),
|
|
2966
|
+
error: z19.object({
|
|
2967
|
+
code: z19.string(),
|
|
2968
|
+
message: z19.string()
|
|
2895
2969
|
}).nullish(),
|
|
2896
|
-
model:
|
|
2897
|
-
output:
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
type:
|
|
2901
|
-
role:
|
|
2902
|
-
id:
|
|
2903
|
-
content:
|
|
2904
|
-
|
|
2905
|
-
type:
|
|
2906
|
-
text:
|
|
2970
|
+
model: z19.string(),
|
|
2971
|
+
output: z19.array(
|
|
2972
|
+
z19.discriminatedUnion("type", [
|
|
2973
|
+
z19.object({
|
|
2974
|
+
type: z19.literal("message"),
|
|
2975
|
+
role: z19.literal("assistant"),
|
|
2976
|
+
id: z19.string(),
|
|
2977
|
+
content: z19.array(
|
|
2978
|
+
z19.object({
|
|
2979
|
+
type: z19.literal("output_text"),
|
|
2980
|
+
text: z19.string(),
|
|
2907
2981
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2908
|
-
annotations:
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
type:
|
|
2912
|
-
start_index:
|
|
2913
|
-
end_index:
|
|
2914
|
-
url:
|
|
2915
|
-
title:
|
|
2982
|
+
annotations: z19.array(
|
|
2983
|
+
z19.discriminatedUnion("type", [
|
|
2984
|
+
z19.object({
|
|
2985
|
+
type: z19.literal("url_citation"),
|
|
2986
|
+
start_index: z19.number(),
|
|
2987
|
+
end_index: z19.number(),
|
|
2988
|
+
url: z19.string(),
|
|
2989
|
+
title: z19.string()
|
|
2916
2990
|
}),
|
|
2917
|
-
|
|
2918
|
-
type:
|
|
2919
|
-
file_id:
|
|
2920
|
-
filename:
|
|
2921
|
-
index:
|
|
2922
|
-
start_index:
|
|
2923
|
-
end_index:
|
|
2924
|
-
quote:
|
|
2991
|
+
z19.object({
|
|
2992
|
+
type: z19.literal("file_citation"),
|
|
2993
|
+
file_id: z19.string(),
|
|
2994
|
+
filename: z19.string().nullish(),
|
|
2995
|
+
index: z19.number().nullish(),
|
|
2996
|
+
start_index: z19.number().nullish(),
|
|
2997
|
+
end_index: z19.number().nullish(),
|
|
2998
|
+
quote: z19.string().nullish()
|
|
2925
2999
|
}),
|
|
2926
|
-
|
|
2927
|
-
type:
|
|
3000
|
+
z19.object({
|
|
3001
|
+
type: z19.literal("container_file_citation")
|
|
2928
3002
|
})
|
|
2929
3003
|
])
|
|
2930
3004
|
)
|
|
@@ -2935,33 +3009,34 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2935
3009
|
fileSearchCallItem,
|
|
2936
3010
|
codeInterpreterCallItem,
|
|
2937
3011
|
imageGenerationCallItem,
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
3012
|
+
localShellCallItem,
|
|
3013
|
+
z19.object({
|
|
3014
|
+
type: z19.literal("function_call"),
|
|
3015
|
+
call_id: z19.string(),
|
|
3016
|
+
name: z19.string(),
|
|
3017
|
+
arguments: z19.string(),
|
|
3018
|
+
id: z19.string()
|
|
2944
3019
|
}),
|
|
2945
|
-
|
|
2946
|
-
type:
|
|
2947
|
-
id:
|
|
2948
|
-
status:
|
|
3020
|
+
z19.object({
|
|
3021
|
+
type: z19.literal("computer_call"),
|
|
3022
|
+
id: z19.string(),
|
|
3023
|
+
status: z19.string().optional()
|
|
2949
3024
|
}),
|
|
2950
|
-
|
|
2951
|
-
type:
|
|
2952
|
-
id:
|
|
2953
|
-
encrypted_content:
|
|
2954
|
-
summary:
|
|
2955
|
-
|
|
2956
|
-
type:
|
|
2957
|
-
text:
|
|
3025
|
+
z19.object({
|
|
3026
|
+
type: z19.literal("reasoning"),
|
|
3027
|
+
id: z19.string(),
|
|
3028
|
+
encrypted_content: z19.string().nullish(),
|
|
3029
|
+
summary: z19.array(
|
|
3030
|
+
z19.object({
|
|
3031
|
+
type: z19.literal("summary_text"),
|
|
3032
|
+
text: z19.string()
|
|
2958
3033
|
})
|
|
2959
3034
|
)
|
|
2960
3035
|
})
|
|
2961
3036
|
])
|
|
2962
3037
|
),
|
|
2963
|
-
service_tier:
|
|
2964
|
-
incomplete_details:
|
|
3038
|
+
service_tier: z19.string().nullish(),
|
|
3039
|
+
incomplete_details: z19.object({ reason: z19.string() }).nullish(),
|
|
2965
3040
|
usage: usageSchema2
|
|
2966
3041
|
})
|
|
2967
3042
|
),
|
|
@@ -3021,6 +3096,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3021
3096
|
});
|
|
3022
3097
|
break;
|
|
3023
3098
|
}
|
|
3099
|
+
case "local_shell_call": {
|
|
3100
|
+
content.push({
|
|
3101
|
+
type: "tool-call",
|
|
3102
|
+
toolCallId: part.call_id,
|
|
3103
|
+
toolName: "local_shell",
|
|
3104
|
+
input: JSON.stringify({ action: part.action }),
|
|
3105
|
+
providerMetadata: {
|
|
3106
|
+
openai: {
|
|
3107
|
+
itemId: part.id
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
});
|
|
3111
|
+
break;
|
|
3112
|
+
}
|
|
3024
3113
|
case "message": {
|
|
3025
3114
|
for (const contentPart of part.content) {
|
|
3026
3115
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -3278,6 +3367,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3278
3367
|
id: value.item.id,
|
|
3279
3368
|
toolName: "computer_use"
|
|
3280
3369
|
});
|
|
3370
|
+
} else if (value.item.type === "code_interpreter_call") {
|
|
3371
|
+
ongoingToolCalls[value.output_index] = {
|
|
3372
|
+
toolName: "code_interpreter",
|
|
3373
|
+
toolCallId: value.item.id,
|
|
3374
|
+
codeInterpreter: {
|
|
3375
|
+
containerId: value.item.container_id
|
|
3376
|
+
}
|
|
3377
|
+
};
|
|
3378
|
+
controller.enqueue({
|
|
3379
|
+
type: "tool-input-start",
|
|
3380
|
+
id: value.item.id,
|
|
3381
|
+
toolName: "code_interpreter"
|
|
3382
|
+
});
|
|
3383
|
+
controller.enqueue({
|
|
3384
|
+
type: "tool-input-delta",
|
|
3385
|
+
id: value.item.id,
|
|
3386
|
+
delta: `{"containerId":"${value.item.container_id}","code":"`
|
|
3387
|
+
});
|
|
3281
3388
|
} else if (value.item.type === "file_search_call") {
|
|
3282
3389
|
controller.enqueue({
|
|
3283
3390
|
type: "tool-call",
|
|
@@ -3401,16 +3508,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3401
3508
|
providerExecuted: true
|
|
3402
3509
|
});
|
|
3403
3510
|
} else if (value.item.type === "code_interpreter_call") {
|
|
3404
|
-
|
|
3405
|
-
type: "tool-call",
|
|
3406
|
-
toolCallId: value.item.id,
|
|
3407
|
-
toolName: "code_interpreter",
|
|
3408
|
-
input: JSON.stringify({
|
|
3409
|
-
code: value.item.code,
|
|
3410
|
-
containerId: value.item.container_id
|
|
3411
|
-
}),
|
|
3412
|
-
providerExecuted: true
|
|
3413
|
-
});
|
|
3511
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3414
3512
|
controller.enqueue({
|
|
3415
3513
|
type: "tool-result",
|
|
3416
3514
|
toolCallId: value.item.id,
|
|
@@ -3430,6 +3528,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3430
3528
|
},
|
|
3431
3529
|
providerExecuted: true
|
|
3432
3530
|
});
|
|
3531
|
+
} else if (value.item.type === "local_shell_call") {
|
|
3532
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3533
|
+
controller.enqueue({
|
|
3534
|
+
type: "tool-call",
|
|
3535
|
+
toolCallId: value.item.call_id,
|
|
3536
|
+
toolName: "local_shell",
|
|
3537
|
+
input: JSON.stringify({
|
|
3538
|
+
action: {
|
|
3539
|
+
type: "exec",
|
|
3540
|
+
command: value.item.action.command,
|
|
3541
|
+
timeoutMs: value.item.action.timeout_ms,
|
|
3542
|
+
user: value.item.action.user,
|
|
3543
|
+
workingDirectory: value.item.action.working_directory,
|
|
3544
|
+
env: value.item.action.env
|
|
3545
|
+
}
|
|
3546
|
+
}),
|
|
3547
|
+
providerMetadata: {
|
|
3548
|
+
openai: { itemId: value.item.id }
|
|
3549
|
+
}
|
|
3550
|
+
});
|
|
3433
3551
|
} else if (value.item.type === "message") {
|
|
3434
3552
|
controller.enqueue({
|
|
3435
3553
|
type: "text-end",
|
|
@@ -3460,6 +3578,40 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3460
3578
|
delta: value.delta
|
|
3461
3579
|
});
|
|
3462
3580
|
}
|
|
3581
|
+
} else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
|
|
3582
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3583
|
+
if (toolCall != null) {
|
|
3584
|
+
controller.enqueue({
|
|
3585
|
+
type: "tool-input-delta",
|
|
3586
|
+
id: toolCall.toolCallId,
|
|
3587
|
+
// The delta is code, which is embedding in a JSON string.
|
|
3588
|
+
// To escape it, we use JSON.stringify and slice to remove the outer quotes.
|
|
3589
|
+
delta: JSON.stringify(value.delta).slice(1, -1)
|
|
3590
|
+
});
|
|
3591
|
+
}
|
|
3592
|
+
} else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
|
|
3593
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3594
|
+
if (toolCall != null) {
|
|
3595
|
+
controller.enqueue({
|
|
3596
|
+
type: "tool-input-delta",
|
|
3597
|
+
id: toolCall.toolCallId,
|
|
3598
|
+
delta: '"}'
|
|
3599
|
+
});
|
|
3600
|
+
controller.enqueue({
|
|
3601
|
+
type: "tool-input-end",
|
|
3602
|
+
id: toolCall.toolCallId
|
|
3603
|
+
});
|
|
3604
|
+
controller.enqueue({
|
|
3605
|
+
type: "tool-call",
|
|
3606
|
+
toolCallId: toolCall.toolCallId,
|
|
3607
|
+
toolName: "code_interpreter",
|
|
3608
|
+
input: JSON.stringify({
|
|
3609
|
+
code: value.code,
|
|
3610
|
+
containerId: toolCall.codeInterpreter.containerId
|
|
3611
|
+
}),
|
|
3612
|
+
providerExecuted: true
|
|
3613
|
+
});
|
|
3614
|
+
}
|
|
3463
3615
|
} else if (isResponseCreatedChunk(value)) {
|
|
3464
3616
|
responseId = value.response.id;
|
|
3465
3617
|
controller.enqueue({
|
|
@@ -3566,166 +3718,194 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3566
3718
|
};
|
|
3567
3719
|
}
|
|
3568
3720
|
};
|
|
3569
|
-
var usageSchema2 =
|
|
3570
|
-
input_tokens:
|
|
3571
|
-
input_tokens_details:
|
|
3572
|
-
output_tokens:
|
|
3573
|
-
output_tokens_details:
|
|
3721
|
+
var usageSchema2 = z19.object({
|
|
3722
|
+
input_tokens: z19.number(),
|
|
3723
|
+
input_tokens_details: z19.object({ cached_tokens: z19.number().nullish() }).nullish(),
|
|
3724
|
+
output_tokens: z19.number(),
|
|
3725
|
+
output_tokens_details: z19.object({ reasoning_tokens: z19.number().nullish() }).nullish()
|
|
3574
3726
|
});
|
|
3575
|
-
var textDeltaChunkSchema =
|
|
3576
|
-
type:
|
|
3577
|
-
item_id:
|
|
3578
|
-
delta:
|
|
3727
|
+
var textDeltaChunkSchema = z19.object({
|
|
3728
|
+
type: z19.literal("response.output_text.delta"),
|
|
3729
|
+
item_id: z19.string(),
|
|
3730
|
+
delta: z19.string(),
|
|
3579
3731
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3580
3732
|
});
|
|
3581
|
-
var errorChunkSchema =
|
|
3582
|
-
type:
|
|
3583
|
-
code:
|
|
3584
|
-
message:
|
|
3585
|
-
param:
|
|
3586
|
-
sequence_number:
|
|
3733
|
+
var errorChunkSchema = z19.object({
|
|
3734
|
+
type: z19.literal("error"),
|
|
3735
|
+
code: z19.string(),
|
|
3736
|
+
message: z19.string(),
|
|
3737
|
+
param: z19.string().nullish(),
|
|
3738
|
+
sequence_number: z19.number()
|
|
3587
3739
|
});
|
|
3588
|
-
var responseFinishedChunkSchema =
|
|
3589
|
-
type:
|
|
3590
|
-
response:
|
|
3591
|
-
incomplete_details:
|
|
3740
|
+
var responseFinishedChunkSchema = z19.object({
|
|
3741
|
+
type: z19.enum(["response.completed", "response.incomplete"]),
|
|
3742
|
+
response: z19.object({
|
|
3743
|
+
incomplete_details: z19.object({ reason: z19.string() }).nullish(),
|
|
3592
3744
|
usage: usageSchema2,
|
|
3593
|
-
service_tier:
|
|
3745
|
+
service_tier: z19.string().nullish()
|
|
3594
3746
|
})
|
|
3595
3747
|
});
|
|
3596
|
-
var responseCreatedChunkSchema =
|
|
3597
|
-
type:
|
|
3598
|
-
response:
|
|
3599
|
-
id:
|
|
3600
|
-
created_at:
|
|
3601
|
-
model:
|
|
3602
|
-
service_tier:
|
|
3748
|
+
var responseCreatedChunkSchema = z19.object({
|
|
3749
|
+
type: z19.literal("response.created"),
|
|
3750
|
+
response: z19.object({
|
|
3751
|
+
id: z19.string(),
|
|
3752
|
+
created_at: z19.number(),
|
|
3753
|
+
model: z19.string(),
|
|
3754
|
+
service_tier: z19.string().nullish()
|
|
3603
3755
|
})
|
|
3604
3756
|
});
|
|
3605
|
-
var responseOutputItemAddedSchema =
|
|
3606
|
-
type:
|
|
3607
|
-
output_index:
|
|
3608
|
-
item:
|
|
3609
|
-
|
|
3610
|
-
type:
|
|
3611
|
-
id:
|
|
3757
|
+
var responseOutputItemAddedSchema = z19.object({
|
|
3758
|
+
type: z19.literal("response.output_item.added"),
|
|
3759
|
+
output_index: z19.number(),
|
|
3760
|
+
item: z19.discriminatedUnion("type", [
|
|
3761
|
+
z19.object({
|
|
3762
|
+
type: z19.literal("message"),
|
|
3763
|
+
id: z19.string()
|
|
3612
3764
|
}),
|
|
3613
|
-
|
|
3614
|
-
type:
|
|
3615
|
-
id:
|
|
3616
|
-
encrypted_content:
|
|
3765
|
+
z19.object({
|
|
3766
|
+
type: z19.literal("reasoning"),
|
|
3767
|
+
id: z19.string(),
|
|
3768
|
+
encrypted_content: z19.string().nullish()
|
|
3617
3769
|
}),
|
|
3618
|
-
|
|
3619
|
-
type:
|
|
3620
|
-
id:
|
|
3621
|
-
call_id:
|
|
3622
|
-
name:
|
|
3623
|
-
arguments:
|
|
3770
|
+
z19.object({
|
|
3771
|
+
type: z19.literal("function_call"),
|
|
3772
|
+
id: z19.string(),
|
|
3773
|
+
call_id: z19.string(),
|
|
3774
|
+
name: z19.string(),
|
|
3775
|
+
arguments: z19.string()
|
|
3624
3776
|
}),
|
|
3625
|
-
|
|
3626
|
-
type:
|
|
3627
|
-
id:
|
|
3628
|
-
status:
|
|
3629
|
-
action:
|
|
3630
|
-
type:
|
|
3631
|
-
query:
|
|
3777
|
+
z19.object({
|
|
3778
|
+
type: z19.literal("web_search_call"),
|
|
3779
|
+
id: z19.string(),
|
|
3780
|
+
status: z19.string(),
|
|
3781
|
+
action: z19.object({
|
|
3782
|
+
type: z19.literal("search"),
|
|
3783
|
+
query: z19.string().optional()
|
|
3632
3784
|
}).nullish()
|
|
3633
3785
|
}),
|
|
3634
|
-
|
|
3635
|
-
type:
|
|
3636
|
-
id:
|
|
3637
|
-
status:
|
|
3786
|
+
z19.object({
|
|
3787
|
+
type: z19.literal("computer_call"),
|
|
3788
|
+
id: z19.string(),
|
|
3789
|
+
status: z19.string()
|
|
3638
3790
|
}),
|
|
3639
|
-
|
|
3640
|
-
type:
|
|
3641
|
-
id:
|
|
3791
|
+
z19.object({
|
|
3792
|
+
type: z19.literal("file_search_call"),
|
|
3793
|
+
id: z19.string()
|
|
3642
3794
|
}),
|
|
3643
|
-
|
|
3644
|
-
type:
|
|
3645
|
-
id:
|
|
3795
|
+
z19.object({
|
|
3796
|
+
type: z19.literal("image_generation_call"),
|
|
3797
|
+
id: z19.string()
|
|
3798
|
+
}),
|
|
3799
|
+
z19.object({
|
|
3800
|
+
type: z19.literal("code_interpreter_call"),
|
|
3801
|
+
id: z19.string(),
|
|
3802
|
+
container_id: z19.string(),
|
|
3803
|
+
code: z19.string().nullable(),
|
|
3804
|
+
outputs: z19.array(
|
|
3805
|
+
z19.discriminatedUnion("type", [
|
|
3806
|
+
z19.object({ type: z19.literal("logs"), logs: z19.string() }),
|
|
3807
|
+
z19.object({ type: z19.literal("image"), url: z19.string() })
|
|
3808
|
+
])
|
|
3809
|
+
).nullable(),
|
|
3810
|
+
status: z19.string()
|
|
3646
3811
|
})
|
|
3647
3812
|
])
|
|
3648
3813
|
});
|
|
3649
|
-
var responseOutputItemDoneSchema =
|
|
3650
|
-
type:
|
|
3651
|
-
output_index:
|
|
3652
|
-
item:
|
|
3653
|
-
|
|
3654
|
-
type:
|
|
3655
|
-
id:
|
|
3814
|
+
var responseOutputItemDoneSchema = z19.object({
|
|
3815
|
+
type: z19.literal("response.output_item.done"),
|
|
3816
|
+
output_index: z19.number(),
|
|
3817
|
+
item: z19.discriminatedUnion("type", [
|
|
3818
|
+
z19.object({
|
|
3819
|
+
type: z19.literal("message"),
|
|
3820
|
+
id: z19.string()
|
|
3656
3821
|
}),
|
|
3657
|
-
|
|
3658
|
-
type:
|
|
3659
|
-
id:
|
|
3660
|
-
encrypted_content:
|
|
3822
|
+
z19.object({
|
|
3823
|
+
type: z19.literal("reasoning"),
|
|
3824
|
+
id: z19.string(),
|
|
3825
|
+
encrypted_content: z19.string().nullish()
|
|
3661
3826
|
}),
|
|
3662
|
-
|
|
3663
|
-
type:
|
|
3664
|
-
id:
|
|
3665
|
-
call_id:
|
|
3666
|
-
name:
|
|
3667
|
-
arguments:
|
|
3668
|
-
status:
|
|
3827
|
+
z19.object({
|
|
3828
|
+
type: z19.literal("function_call"),
|
|
3829
|
+
id: z19.string(),
|
|
3830
|
+
call_id: z19.string(),
|
|
3831
|
+
name: z19.string(),
|
|
3832
|
+
arguments: z19.string(),
|
|
3833
|
+
status: z19.literal("completed")
|
|
3669
3834
|
}),
|
|
3670
3835
|
codeInterpreterCallItem,
|
|
3671
3836
|
imageGenerationCallItem,
|
|
3672
3837
|
webSearchCallItem,
|
|
3673
3838
|
fileSearchCallItem,
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3839
|
+
localShellCallItem,
|
|
3840
|
+
z19.object({
|
|
3841
|
+
type: z19.literal("computer_call"),
|
|
3842
|
+
id: z19.string(),
|
|
3843
|
+
status: z19.literal("completed")
|
|
3678
3844
|
})
|
|
3679
3845
|
])
|
|
3680
3846
|
});
|
|
3681
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3682
|
-
type:
|
|
3683
|
-
item_id:
|
|
3684
|
-
output_index:
|
|
3685
|
-
delta:
|
|
3847
|
+
var responseFunctionCallArgumentsDeltaSchema = z19.object({
|
|
3848
|
+
type: z19.literal("response.function_call_arguments.delta"),
|
|
3849
|
+
item_id: z19.string(),
|
|
3850
|
+
output_index: z19.number(),
|
|
3851
|
+
delta: z19.string()
|
|
3852
|
+
});
|
|
3853
|
+
var responseCodeInterpreterCallCodeDeltaSchema = z19.object({
|
|
3854
|
+
type: z19.literal("response.code_interpreter_call_code.delta"),
|
|
3855
|
+
item_id: z19.string(),
|
|
3856
|
+
output_index: z19.number(),
|
|
3857
|
+
delta: z19.string()
|
|
3858
|
+
});
|
|
3859
|
+
var responseCodeInterpreterCallCodeDoneSchema = z19.object({
|
|
3860
|
+
type: z19.literal("response.code_interpreter_call_code.done"),
|
|
3861
|
+
item_id: z19.string(),
|
|
3862
|
+
output_index: z19.number(),
|
|
3863
|
+
code: z19.string()
|
|
3686
3864
|
});
|
|
3687
|
-
var responseAnnotationAddedSchema =
|
|
3688
|
-
type:
|
|
3689
|
-
annotation:
|
|
3690
|
-
|
|
3691
|
-
type:
|
|
3692
|
-
url:
|
|
3693
|
-
title:
|
|
3865
|
+
var responseAnnotationAddedSchema = z19.object({
|
|
3866
|
+
type: z19.literal("response.output_text.annotation.added"),
|
|
3867
|
+
annotation: z19.discriminatedUnion("type", [
|
|
3868
|
+
z19.object({
|
|
3869
|
+
type: z19.literal("url_citation"),
|
|
3870
|
+
url: z19.string(),
|
|
3871
|
+
title: z19.string()
|
|
3694
3872
|
}),
|
|
3695
|
-
|
|
3696
|
-
type:
|
|
3697
|
-
file_id:
|
|
3698
|
-
filename:
|
|
3699
|
-
index:
|
|
3700
|
-
start_index:
|
|
3701
|
-
end_index:
|
|
3702
|
-
quote:
|
|
3873
|
+
z19.object({
|
|
3874
|
+
type: z19.literal("file_citation"),
|
|
3875
|
+
file_id: z19.string(),
|
|
3876
|
+
filename: z19.string().nullish(),
|
|
3877
|
+
index: z19.number().nullish(),
|
|
3878
|
+
start_index: z19.number().nullish(),
|
|
3879
|
+
end_index: z19.number().nullish(),
|
|
3880
|
+
quote: z19.string().nullish()
|
|
3703
3881
|
})
|
|
3704
3882
|
])
|
|
3705
3883
|
});
|
|
3706
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3707
|
-
type:
|
|
3708
|
-
item_id:
|
|
3709
|
-
summary_index:
|
|
3884
|
+
var responseReasoningSummaryPartAddedSchema = z19.object({
|
|
3885
|
+
type: z19.literal("response.reasoning_summary_part.added"),
|
|
3886
|
+
item_id: z19.string(),
|
|
3887
|
+
summary_index: z19.number()
|
|
3710
3888
|
});
|
|
3711
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3712
|
-
type:
|
|
3713
|
-
item_id:
|
|
3714
|
-
summary_index:
|
|
3715
|
-
delta:
|
|
3889
|
+
var responseReasoningSummaryTextDeltaSchema = z19.object({
|
|
3890
|
+
type: z19.literal("response.reasoning_summary_text.delta"),
|
|
3891
|
+
item_id: z19.string(),
|
|
3892
|
+
summary_index: z19.number(),
|
|
3893
|
+
delta: z19.string()
|
|
3716
3894
|
});
|
|
3717
|
-
var openaiResponsesChunkSchema =
|
|
3895
|
+
var openaiResponsesChunkSchema = z19.union([
|
|
3718
3896
|
textDeltaChunkSchema,
|
|
3719
3897
|
responseFinishedChunkSchema,
|
|
3720
3898
|
responseCreatedChunkSchema,
|
|
3721
3899
|
responseOutputItemAddedSchema,
|
|
3722
3900
|
responseOutputItemDoneSchema,
|
|
3723
3901
|
responseFunctionCallArgumentsDeltaSchema,
|
|
3902
|
+
responseCodeInterpreterCallCodeDeltaSchema,
|
|
3903
|
+
responseCodeInterpreterCallCodeDoneSchema,
|
|
3724
3904
|
responseAnnotationAddedSchema,
|
|
3725
3905
|
responseReasoningSummaryPartAddedSchema,
|
|
3726
3906
|
responseReasoningSummaryTextDeltaSchema,
|
|
3727
3907
|
errorChunkSchema,
|
|
3728
|
-
|
|
3908
|
+
z19.object({ type: z19.string() }).loose()
|
|
3729
3909
|
// fallback for unknown chunks
|
|
3730
3910
|
]);
|
|
3731
3911
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3746,6 +3926,12 @@ function isResponseCreatedChunk(chunk) {
|
|
|
3746
3926
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
3747
3927
|
return chunk.type === "response.function_call_arguments.delta";
|
|
3748
3928
|
}
|
|
3929
|
+
function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
|
|
3930
|
+
return chunk.type === "response.code_interpreter_call_code.delta";
|
|
3931
|
+
}
|
|
3932
|
+
function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
|
|
3933
|
+
return chunk.type === "response.code_interpreter_call_code.done";
|
|
3934
|
+
}
|
|
3749
3935
|
function isResponseOutputItemAddedChunk(chunk) {
|
|
3750
3936
|
return chunk.type === "response.output_item.added";
|
|
3751
3937
|
}
|
|
@@ -3798,15 +3984,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3798
3984
|
isReasoningModel: false
|
|
3799
3985
|
};
|
|
3800
3986
|
}
|
|
3801
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3802
|
-
include:
|
|
3803
|
-
|
|
3987
|
+
var openaiResponsesProviderOptionsSchema = z19.object({
|
|
3988
|
+
include: z19.array(
|
|
3989
|
+
z19.enum([
|
|
3804
3990
|
"reasoning.encrypted_content",
|
|
3805
3991
|
"file_search_call.results",
|
|
3806
3992
|
"message.output_text.logprobs"
|
|
3807
3993
|
])
|
|
3808
3994
|
).nullish(),
|
|
3809
|
-
instructions:
|
|
3995
|
+
instructions: z19.string().nullish(),
|
|
3810
3996
|
/**
|
|
3811
3997
|
* Return the log probabilities of the tokens.
|
|
3812
3998
|
*
|
|
@@ -3819,25 +4005,25 @@ var openaiResponsesProviderOptionsSchema = z18.object({
|
|
|
3819
4005
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3820
4006
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3821
4007
|
*/
|
|
3822
|
-
logprobs:
|
|
4008
|
+
logprobs: z19.union([z19.boolean(), z19.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3823
4009
|
/**
|
|
3824
4010
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3825
4011
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3826
4012
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3827
4013
|
*/
|
|
3828
|
-
maxToolCalls:
|
|
3829
|
-
metadata:
|
|
3830
|
-
parallelToolCalls:
|
|
3831
|
-
previousResponseId:
|
|
3832
|
-
promptCacheKey:
|
|
3833
|
-
reasoningEffort:
|
|
3834
|
-
reasoningSummary:
|
|
3835
|
-
safetyIdentifier:
|
|
3836
|
-
serviceTier:
|
|
3837
|
-
store:
|
|
3838
|
-
strictJsonSchema:
|
|
3839
|
-
textVerbosity:
|
|
3840
|
-
user:
|
|
4014
|
+
maxToolCalls: z19.number().nullish(),
|
|
4015
|
+
metadata: z19.any().nullish(),
|
|
4016
|
+
parallelToolCalls: z19.boolean().nullish(),
|
|
4017
|
+
previousResponseId: z19.string().nullish(),
|
|
4018
|
+
promptCacheKey: z19.string().nullish(),
|
|
4019
|
+
reasoningEffort: z19.string().nullish(),
|
|
4020
|
+
reasoningSummary: z19.string().nullish(),
|
|
4021
|
+
safetyIdentifier: z19.string().nullish(),
|
|
4022
|
+
serviceTier: z19.enum(["auto", "flex", "priority"]).nullish(),
|
|
4023
|
+
store: z19.boolean().nullish(),
|
|
4024
|
+
strictJsonSchema: z19.boolean().nullish(),
|
|
4025
|
+
textVerbosity: z19.enum(["low", "medium", "high"]).nullish(),
|
|
4026
|
+
user: z19.string().nullish()
|
|
3841
4027
|
});
|
|
3842
4028
|
export {
|
|
3843
4029
|
OpenAIChatLanguageModel,
|
|
@@ -3847,6 +4033,14 @@ export {
|
|
|
3847
4033
|
OpenAIResponsesLanguageModel,
|
|
3848
4034
|
OpenAISpeechModel,
|
|
3849
4035
|
OpenAITranscriptionModel,
|
|
4036
|
+
codeInterpreter,
|
|
4037
|
+
codeInterpreterArgsSchema,
|
|
4038
|
+
codeInterpreterInputSchema,
|
|
4039
|
+
codeInterpreterOutputSchema,
|
|
4040
|
+
codeInterpreterToolFactory,
|
|
4041
|
+
fileSearch,
|
|
4042
|
+
fileSearchArgsSchema,
|
|
4043
|
+
fileSearchOutputSchema,
|
|
3850
4044
|
hasDefaultResponseFormat,
|
|
3851
4045
|
modelMaxImagesPerCall,
|
|
3852
4046
|
openAITranscriptionProviderOptions,
|