@ai-sdk/openai 4.0.0-beta.1 → 4.0.0-beta.10
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 +137 -0
- package/dist/index.d.mts +69 -22
- package/dist/index.d.ts +69 -22
- package/dist/index.js +1169 -873
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1123 -822
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +56 -28
- package/dist/internal/index.d.ts +56 -28
- package/dist/internal/index.js +1198 -912
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1180 -889
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +142 -3
- package/package.json +3 -3
- package/src/chat/convert-openai-chat-usage.ts +2 -2
- package/src/chat/convert-to-openai-chat-messages.ts +5 -5
- package/src/chat/map-openai-finish-reason.ts +2 -2
- package/src/chat/openai-chat-language-model.ts +22 -22
- package/src/chat/openai-chat-options.ts +1 -0
- package/src/chat/openai-chat-prepare-tools.ts +6 -6
- package/src/completion/convert-openai-completion-usage.ts +2 -2
- package/src/completion/convert-to-openai-completion-prompt.ts +2 -2
- package/src/completion/map-openai-finish-reason.ts +2 -2
- package/src/completion/openai-completion-language-model.ts +20 -20
- package/src/embedding/openai-embedding-model.ts +5 -5
- package/src/image/openai-image-model.ts +9 -9
- package/src/openai-language-model-capabilities.ts +1 -0
- package/src/openai-provider.ts +21 -21
- package/src/openai-tools.ts +12 -1
- package/src/responses/convert-openai-responses-usage.ts +2 -2
- package/src/responses/convert-to-openai-responses-input.ts +116 -12
- package/src/responses/map-openai-responses-finish-reason.ts +2 -2
- package/src/responses/openai-responses-api.ts +87 -1
- package/src/responses/openai-responses-language-model.ts +168 -33
- package/src/responses/openai-responses-options.ts +4 -2
- package/src/responses/openai-responses-prepare-tools.ts +34 -9
- package/src/speech/openai-speech-model.ts +7 -7
- package/src/tool/custom.ts +0 -6
- package/src/tool/tool-search.ts +98 -0
- package/src/transcription/openai-transcription-model.ts +8 -8
package/dist/index.js
CHANGED
|
@@ -18,16 +18,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
VERSION: () => VERSION,
|
|
24
24
|
createOpenAI: () => createOpenAI,
|
|
25
25
|
openai: () => openai
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
29
29
|
// src/openai-provider.ts
|
|
30
|
-
var
|
|
30
|
+
var import_provider_utils35 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/chat/openai-chat-language-model.ts
|
|
33
33
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -57,7 +57,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
57
57
|
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
58
58
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
59
59
|
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
60
|
-
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.4");
|
|
60
|
+
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
|
|
61
61
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
62
62
|
return {
|
|
63
63
|
supportsFlexProcessing,
|
|
@@ -648,7 +648,7 @@ function prepareChatTools({
|
|
|
648
648
|
// src/chat/openai-chat-language-model.ts
|
|
649
649
|
var OpenAIChatLanguageModel = class {
|
|
650
650
|
constructor(modelId, config) {
|
|
651
|
-
this.specificationVersion = "
|
|
651
|
+
this.specificationVersion = "v4";
|
|
652
652
|
this.supportedUrls = {
|
|
653
653
|
"image/*": [/^https?:\/\/.*$/]
|
|
654
654
|
};
|
|
@@ -1383,7 +1383,7 @@ var openaiLanguageModelCompletionOptions = (0, import_provider_utils7.lazySchema
|
|
|
1383
1383
|
// src/completion/openai-completion-language-model.ts
|
|
1384
1384
|
var OpenAICompletionLanguageModel = class {
|
|
1385
1385
|
constructor(modelId, config) {
|
|
1386
|
-
this.specificationVersion = "
|
|
1386
|
+
this.specificationVersion = "v4";
|
|
1387
1387
|
this.supportedUrls = {
|
|
1388
1388
|
// No URLs are supported for completion models.
|
|
1389
1389
|
};
|
|
@@ -1648,7 +1648,7 @@ var openaiTextEmbeddingResponseSchema = (0, import_provider_utils10.lazySchema)(
|
|
|
1648
1648
|
// src/embedding/openai-embedding-model.ts
|
|
1649
1649
|
var OpenAIEmbeddingModel = class {
|
|
1650
1650
|
constructor(modelId, config) {
|
|
1651
|
-
this.specificationVersion = "
|
|
1651
|
+
this.specificationVersion = "v4";
|
|
1652
1652
|
this.maxEmbeddingsPerCall = 2048;
|
|
1653
1653
|
this.supportsParallelCalls = true;
|
|
1654
1654
|
this.modelId = modelId;
|
|
@@ -1769,7 +1769,7 @@ var OpenAIImageModel = class {
|
|
|
1769
1769
|
constructor(modelId, config) {
|
|
1770
1770
|
this.modelId = modelId;
|
|
1771
1771
|
this.config = config;
|
|
1772
|
-
this.specificationVersion = "
|
|
1772
|
+
this.specificationVersion = "v4";
|
|
1773
1773
|
}
|
|
1774
1774
|
get maxImagesPerCall() {
|
|
1775
1775
|
var _a;
|
|
@@ -2049,7 +2049,6 @@ var import_v411 = require("zod/v4");
|
|
|
2049
2049
|
var customArgsSchema = (0, import_provider_utils16.lazySchema)(
|
|
2050
2050
|
() => (0, import_provider_utils16.zodSchema)(
|
|
2051
2051
|
import_v411.z.object({
|
|
2052
|
-
name: import_v411.z.string(),
|
|
2053
2052
|
description: import_v411.z.string().optional(),
|
|
2054
2053
|
format: import_v411.z.union([
|
|
2055
2054
|
import_v411.z.object({
|
|
@@ -2278,66 +2277,48 @@ var shell = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchem
|
|
|
2278
2277
|
outputSchema: shellOutputSchema
|
|
2279
2278
|
});
|
|
2280
2279
|
|
|
2281
|
-
// src/tool/
|
|
2280
|
+
// src/tool/tool-search.ts
|
|
2282
2281
|
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2283
2282
|
var import_v416 = require("zod/v4");
|
|
2284
|
-
var
|
|
2283
|
+
var toolSearchArgsSchema = (0, import_provider_utils21.lazySchema)(
|
|
2285
2284
|
() => (0, import_provider_utils21.zodSchema)(
|
|
2286
2285
|
import_v416.z.object({
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
userLocation: import_v416.z.object({
|
|
2291
|
-
type: import_v416.z.literal("approximate"),
|
|
2292
|
-
country: import_v416.z.string().optional(),
|
|
2293
|
-
city: import_v416.z.string().optional(),
|
|
2294
|
-
region: import_v416.z.string().optional(),
|
|
2295
|
-
timezone: import_v416.z.string().optional()
|
|
2296
|
-
}).optional()
|
|
2286
|
+
execution: import_v416.z.enum(["server", "client"]).optional(),
|
|
2287
|
+
description: import_v416.z.string().optional(),
|
|
2288
|
+
parameters: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()).optional()
|
|
2297
2289
|
})
|
|
2298
2290
|
)
|
|
2299
2291
|
);
|
|
2300
|
-
var
|
|
2301
|
-
var webSearchOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2292
|
+
var toolSearchInputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2302
2293
|
() => (0, import_provider_utils21.zodSchema)(
|
|
2303
2294
|
import_v416.z.object({
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
type: import_v416.z.literal("search"),
|
|
2307
|
-
query: import_v416.z.string().optional()
|
|
2308
|
-
}),
|
|
2309
|
-
import_v416.z.object({
|
|
2310
|
-
type: import_v416.z.literal("openPage"),
|
|
2311
|
-
url: import_v416.z.string().nullish()
|
|
2312
|
-
}),
|
|
2313
|
-
import_v416.z.object({
|
|
2314
|
-
type: import_v416.z.literal("findInPage"),
|
|
2315
|
-
url: import_v416.z.string().nullish(),
|
|
2316
|
-
pattern: import_v416.z.string().nullish()
|
|
2317
|
-
})
|
|
2318
|
-
]).optional(),
|
|
2319
|
-
sources: import_v416.z.array(
|
|
2320
|
-
import_v416.z.discriminatedUnion("type", [
|
|
2321
|
-
import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
|
|
2322
|
-
import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
|
|
2323
|
-
])
|
|
2324
|
-
).optional()
|
|
2295
|
+
arguments: import_v416.z.unknown().optional(),
|
|
2296
|
+
call_id: import_v416.z.string().nullish()
|
|
2325
2297
|
})
|
|
2326
2298
|
)
|
|
2327
2299
|
);
|
|
2328
|
-
var
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2300
|
+
var toolSearchOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2301
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2302
|
+
import_v416.z.object({
|
|
2303
|
+
tools: import_v416.z.array(import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()))
|
|
2304
|
+
})
|
|
2305
|
+
)
|
|
2306
|
+
);
|
|
2307
|
+
var toolSearchToolFactory = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
|
|
2308
|
+
id: "openai.tool_search",
|
|
2309
|
+
inputSchema: toolSearchInputSchema,
|
|
2310
|
+
outputSchema: toolSearchOutputSchema
|
|
2332
2311
|
});
|
|
2333
|
-
var
|
|
2312
|
+
var toolSearch = (args = {}) => toolSearchToolFactory(args);
|
|
2334
2313
|
|
|
2335
|
-
// src/tool/web-search
|
|
2314
|
+
// src/tool/web-search.ts
|
|
2336
2315
|
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2337
2316
|
var import_v417 = require("zod/v4");
|
|
2338
|
-
var
|
|
2317
|
+
var webSearchArgsSchema = (0, import_provider_utils22.lazySchema)(
|
|
2339
2318
|
() => (0, import_provider_utils22.zodSchema)(
|
|
2340
2319
|
import_v417.z.object({
|
|
2320
|
+
externalWebAccess: import_v417.z.boolean().optional(),
|
|
2321
|
+
filters: import_v417.z.object({ allowedDomains: import_v417.z.array(import_v417.z.string()).optional() }).optional(),
|
|
2341
2322
|
searchContextSize: import_v417.z.enum(["low", "medium", "high"]).optional(),
|
|
2342
2323
|
userLocation: import_v417.z.object({
|
|
2343
2324
|
type: import_v417.z.literal("approximate"),
|
|
@@ -2349,10 +2330,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils22.lazySchema)(
|
|
|
2349
2330
|
})
|
|
2350
2331
|
)
|
|
2351
2332
|
);
|
|
2352
|
-
var
|
|
2353
|
-
|
|
2354
|
-
);
|
|
2355
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2333
|
+
var webSearchInputSchema = (0, import_provider_utils22.lazySchema)(() => (0, import_provider_utils22.zodSchema)(import_v417.z.object({})));
|
|
2334
|
+
var webSearchOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2356
2335
|
() => (0, import_provider_utils22.zodSchema)(
|
|
2357
2336
|
import_v417.z.object({
|
|
2358
2337
|
action: import_v417.z.discriminatedUnion("type", [
|
|
@@ -2369,73 +2348,127 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
|
2369
2348
|
url: import_v417.z.string().nullish(),
|
|
2370
2349
|
pattern: import_v417.z.string().nullish()
|
|
2371
2350
|
})
|
|
2351
|
+
]).optional(),
|
|
2352
|
+
sources: import_v417.z.array(
|
|
2353
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2354
|
+
import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
|
|
2355
|
+
import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
|
|
2356
|
+
])
|
|
2357
|
+
).optional()
|
|
2358
|
+
})
|
|
2359
|
+
)
|
|
2360
|
+
);
|
|
2361
|
+
var webSearchToolFactory = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
|
|
2362
|
+
id: "openai.web_search",
|
|
2363
|
+
inputSchema: webSearchInputSchema,
|
|
2364
|
+
outputSchema: webSearchOutputSchema
|
|
2365
|
+
});
|
|
2366
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2367
|
+
|
|
2368
|
+
// src/tool/web-search-preview.ts
|
|
2369
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2370
|
+
var import_v418 = require("zod/v4");
|
|
2371
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils23.lazySchema)(
|
|
2372
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2373
|
+
import_v418.z.object({
|
|
2374
|
+
searchContextSize: import_v418.z.enum(["low", "medium", "high"]).optional(),
|
|
2375
|
+
userLocation: import_v418.z.object({
|
|
2376
|
+
type: import_v418.z.literal("approximate"),
|
|
2377
|
+
country: import_v418.z.string().optional(),
|
|
2378
|
+
city: import_v418.z.string().optional(),
|
|
2379
|
+
region: import_v418.z.string().optional(),
|
|
2380
|
+
timezone: import_v418.z.string().optional()
|
|
2381
|
+
}).optional()
|
|
2382
|
+
})
|
|
2383
|
+
)
|
|
2384
|
+
);
|
|
2385
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2386
|
+
() => (0, import_provider_utils23.zodSchema)(import_v418.z.object({}))
|
|
2387
|
+
);
|
|
2388
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2389
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2390
|
+
import_v418.z.object({
|
|
2391
|
+
action: import_v418.z.discriminatedUnion("type", [
|
|
2392
|
+
import_v418.z.object({
|
|
2393
|
+
type: import_v418.z.literal("search"),
|
|
2394
|
+
query: import_v418.z.string().optional()
|
|
2395
|
+
}),
|
|
2396
|
+
import_v418.z.object({
|
|
2397
|
+
type: import_v418.z.literal("openPage"),
|
|
2398
|
+
url: import_v418.z.string().nullish()
|
|
2399
|
+
}),
|
|
2400
|
+
import_v418.z.object({
|
|
2401
|
+
type: import_v418.z.literal("findInPage"),
|
|
2402
|
+
url: import_v418.z.string().nullish(),
|
|
2403
|
+
pattern: import_v418.z.string().nullish()
|
|
2404
|
+
})
|
|
2372
2405
|
]).optional()
|
|
2373
2406
|
})
|
|
2374
2407
|
)
|
|
2375
2408
|
);
|
|
2376
|
-
var webSearchPreview = (0,
|
|
2409
|
+
var webSearchPreview = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
|
|
2377
2410
|
id: "openai.web_search_preview",
|
|
2378
2411
|
inputSchema: webSearchPreviewInputSchema,
|
|
2379
2412
|
outputSchema: webSearchPreviewOutputSchema
|
|
2380
2413
|
});
|
|
2381
2414
|
|
|
2382
2415
|
// src/tool/mcp.ts
|
|
2383
|
-
var
|
|
2384
|
-
var
|
|
2385
|
-
var jsonValueSchema =
|
|
2386
|
-
() =>
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2416
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
2417
|
+
var import_v419 = require("zod/v4");
|
|
2418
|
+
var jsonValueSchema = import_v419.z.lazy(
|
|
2419
|
+
() => import_v419.z.union([
|
|
2420
|
+
import_v419.z.string(),
|
|
2421
|
+
import_v419.z.number(),
|
|
2422
|
+
import_v419.z.boolean(),
|
|
2423
|
+
import_v419.z.null(),
|
|
2424
|
+
import_v419.z.array(jsonValueSchema),
|
|
2425
|
+
import_v419.z.record(import_v419.z.string(), jsonValueSchema)
|
|
2393
2426
|
])
|
|
2394
2427
|
);
|
|
2395
|
-
var mcpArgsSchema = (0,
|
|
2396
|
-
() => (0,
|
|
2397
|
-
|
|
2398
|
-
serverLabel:
|
|
2399
|
-
allowedTools:
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
readOnly:
|
|
2403
|
-
toolNames:
|
|
2428
|
+
var mcpArgsSchema = (0, import_provider_utils24.lazySchema)(
|
|
2429
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2430
|
+
import_v419.z.object({
|
|
2431
|
+
serverLabel: import_v419.z.string(),
|
|
2432
|
+
allowedTools: import_v419.z.union([
|
|
2433
|
+
import_v419.z.array(import_v419.z.string()),
|
|
2434
|
+
import_v419.z.object({
|
|
2435
|
+
readOnly: import_v419.z.boolean().optional(),
|
|
2436
|
+
toolNames: import_v419.z.array(import_v419.z.string()).optional()
|
|
2404
2437
|
})
|
|
2405
2438
|
]).optional(),
|
|
2406
|
-
authorization:
|
|
2407
|
-
connectorId:
|
|
2408
|
-
headers:
|
|
2409
|
-
requireApproval:
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
never:
|
|
2413
|
-
toolNames:
|
|
2439
|
+
authorization: import_v419.z.string().optional(),
|
|
2440
|
+
connectorId: import_v419.z.string().optional(),
|
|
2441
|
+
headers: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional(),
|
|
2442
|
+
requireApproval: import_v419.z.union([
|
|
2443
|
+
import_v419.z.enum(["always", "never"]),
|
|
2444
|
+
import_v419.z.object({
|
|
2445
|
+
never: import_v419.z.object({
|
|
2446
|
+
toolNames: import_v419.z.array(import_v419.z.string()).optional()
|
|
2414
2447
|
}).optional()
|
|
2415
2448
|
})
|
|
2416
2449
|
]).optional(),
|
|
2417
|
-
serverDescription:
|
|
2418
|
-
serverUrl:
|
|
2450
|
+
serverDescription: import_v419.z.string().optional(),
|
|
2451
|
+
serverUrl: import_v419.z.string().optional()
|
|
2419
2452
|
}).refine(
|
|
2420
2453
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2421
2454
|
"One of serverUrl or connectorId must be provided."
|
|
2422
2455
|
)
|
|
2423
2456
|
)
|
|
2424
2457
|
);
|
|
2425
|
-
var mcpInputSchema = (0,
|
|
2426
|
-
var mcpOutputSchema = (0,
|
|
2427
|
-
() => (0,
|
|
2428
|
-
|
|
2429
|
-
type:
|
|
2430
|
-
serverLabel:
|
|
2431
|
-
name:
|
|
2432
|
-
arguments:
|
|
2433
|
-
output:
|
|
2434
|
-
error:
|
|
2458
|
+
var mcpInputSchema = (0, import_provider_utils24.lazySchema)(() => (0, import_provider_utils24.zodSchema)(import_v419.z.object({})));
|
|
2459
|
+
var mcpOutputSchema = (0, import_provider_utils24.lazySchema)(
|
|
2460
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2461
|
+
import_v419.z.object({
|
|
2462
|
+
type: import_v419.z.literal("call"),
|
|
2463
|
+
serverLabel: import_v419.z.string(),
|
|
2464
|
+
name: import_v419.z.string(),
|
|
2465
|
+
arguments: import_v419.z.string(),
|
|
2466
|
+
output: import_v419.z.string().nullish(),
|
|
2467
|
+
error: import_v419.z.union([import_v419.z.string(), jsonValueSchema]).optional()
|
|
2435
2468
|
})
|
|
2436
2469
|
)
|
|
2437
2470
|
);
|
|
2438
|
-
var mcpToolFactory = (0,
|
|
2471
|
+
var mcpToolFactory = (0, import_provider_utils24.createProviderToolFactoryWithOutputSchema)({
|
|
2439
2472
|
id: "openai.mcp",
|
|
2440
2473
|
inputSchema: mcpInputSchema,
|
|
2441
2474
|
outputSchema: mcpOutputSchema
|
|
@@ -2457,7 +2490,6 @@ var openaiTools = {
|
|
|
2457
2490
|
* Lark syntax). The model returns a `custom_tool_call` output item whose
|
|
2458
2491
|
* `input` field is a string matching the specified grammar.
|
|
2459
2492
|
*
|
|
2460
|
-
* @param name - The name of the custom tool.
|
|
2461
2493
|
* @param description - An optional description of the tool.
|
|
2462
2494
|
* @param format - The output format constraint (grammar type, syntax, and definition).
|
|
2463
2495
|
*/
|
|
@@ -2547,12 +2579,22 @@ var openaiTools = {
|
|
|
2547
2579
|
* @param serverDescription - Optional description of the server.
|
|
2548
2580
|
* @param serverUrl - URL for the MCP server.
|
|
2549
2581
|
*/
|
|
2550
|
-
mcp
|
|
2582
|
+
mcp,
|
|
2583
|
+
/**
|
|
2584
|
+
* Tool search allows the model to dynamically search for and load deferred
|
|
2585
|
+
* tools into the model's context as needed. This helps reduce overall token
|
|
2586
|
+
* usage, cost, and latency by only loading tools when the model needs them.
|
|
2587
|
+
*
|
|
2588
|
+
* To use tool search, mark functions or namespaces with `defer_loading: true`
|
|
2589
|
+
* in the tools array. The model will use tool search to load these tools
|
|
2590
|
+
* when it determines they are needed.
|
|
2591
|
+
*/
|
|
2592
|
+
toolSearch
|
|
2551
2593
|
};
|
|
2552
2594
|
|
|
2553
2595
|
// src/responses/openai-responses-language-model.ts
|
|
2554
2596
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2555
|
-
var
|
|
2597
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
2556
2598
|
|
|
2557
2599
|
// src/responses/convert-openai-responses-usage.ts
|
|
2558
2600
|
function convertOpenAIResponsesUsage(usage) {
|
|
@@ -2595,8 +2637,8 @@ function convertOpenAIResponsesUsage(usage) {
|
|
|
2595
2637
|
|
|
2596
2638
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2597
2639
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2598
|
-
var
|
|
2599
|
-
var
|
|
2640
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
2641
|
+
var import_v420 = require("zod/v4");
|
|
2600
2642
|
function isFileId(data, prefixes) {
|
|
2601
2643
|
if (!prefixes) return false;
|
|
2602
2644
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2614,8 +2656,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2614
2656
|
hasApplyPatchTool = false,
|
|
2615
2657
|
customProviderToolNames
|
|
2616
2658
|
}) {
|
|
2617
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2618
|
-
|
|
2659
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2660
|
+
let input = [];
|
|
2619
2661
|
const warnings = [];
|
|
2620
2662
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2621
2663
|
for (const { role, content } of prompt) {
|
|
@@ -2661,7 +2703,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2661
2703
|
return {
|
|
2662
2704
|
type: "input_image",
|
|
2663
2705
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2664
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2706
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils25.convertToBase64)(part.data)}`
|
|
2665
2707
|
},
|
|
2666
2708
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
|
|
2667
2709
|
};
|
|
@@ -2676,7 +2718,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2676
2718
|
type: "input_file",
|
|
2677
2719
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2678
2720
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2679
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2721
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils25.convertToBase64)(part.data)}`
|
|
2680
2722
|
}
|
|
2681
2723
|
};
|
|
2682
2724
|
} else {
|
|
@@ -2718,6 +2760,32 @@ async function convertToOpenAIResponsesInput({
|
|
|
2718
2760
|
if (hasConversation && id != null) {
|
|
2719
2761
|
break;
|
|
2720
2762
|
}
|
|
2763
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2764
|
+
part.toolName
|
|
2765
|
+
);
|
|
2766
|
+
if (resolvedToolName === "tool_search") {
|
|
2767
|
+
if (store && id != null) {
|
|
2768
|
+
input.push({ type: "item_reference", id });
|
|
2769
|
+
break;
|
|
2770
|
+
}
|
|
2771
|
+
const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils25.parseJSON)({
|
|
2772
|
+
text: part.input,
|
|
2773
|
+
schema: toolSearchInputSchema
|
|
2774
|
+
}) : await (0, import_provider_utils25.validateTypes)({
|
|
2775
|
+
value: part.input,
|
|
2776
|
+
schema: toolSearchInputSchema
|
|
2777
|
+
});
|
|
2778
|
+
const execution = parsedInput.call_id != null ? "client" : "server";
|
|
2779
|
+
input.push({
|
|
2780
|
+
type: "tool_search_call",
|
|
2781
|
+
id: id != null ? id : part.toolCallId,
|
|
2782
|
+
execution,
|
|
2783
|
+
call_id: (_g = parsedInput.call_id) != null ? _g : null,
|
|
2784
|
+
status: "completed",
|
|
2785
|
+
arguments: parsedInput.arguments
|
|
2786
|
+
});
|
|
2787
|
+
break;
|
|
2788
|
+
}
|
|
2721
2789
|
if (part.providerExecuted) {
|
|
2722
2790
|
if (store && id != null) {
|
|
2723
2791
|
input.push({ type: "item_reference", id });
|
|
@@ -2728,11 +2796,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2728
2796
|
input.push({ type: "item_reference", id });
|
|
2729
2797
|
break;
|
|
2730
2798
|
}
|
|
2731
|
-
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2732
|
-
part.toolName
|
|
2733
|
-
);
|
|
2734
2799
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2735
|
-
const parsedInput = await (0,
|
|
2800
|
+
const parsedInput = await (0, import_provider_utils25.validateTypes)({
|
|
2736
2801
|
value: part.input,
|
|
2737
2802
|
schema: localShellInputSchema
|
|
2738
2803
|
});
|
|
@@ -2752,7 +2817,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2752
2817
|
break;
|
|
2753
2818
|
}
|
|
2754
2819
|
if (hasShellTool && resolvedToolName === "shell") {
|
|
2755
|
-
const parsedInput = await (0,
|
|
2820
|
+
const parsedInput = await (0, import_provider_utils25.validateTypes)({
|
|
2756
2821
|
value: part.input,
|
|
2757
2822
|
schema: shellInputSchema
|
|
2758
2823
|
});
|
|
@@ -2770,7 +2835,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2770
2835
|
break;
|
|
2771
2836
|
}
|
|
2772
2837
|
if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
|
|
2773
|
-
const parsedInput = await (0,
|
|
2838
|
+
const parsedInput = await (0, import_provider_utils25.validateTypes)({
|
|
2774
2839
|
value: part.input,
|
|
2775
2840
|
schema: applyPatchInputSchema
|
|
2776
2841
|
});
|
|
@@ -2813,9 +2878,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2813
2878
|
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
2814
2879
|
part.toolName
|
|
2815
2880
|
);
|
|
2881
|
+
if (resolvedResultToolName === "tool_search") {
|
|
2882
|
+
const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2883
|
+
if (store) {
|
|
2884
|
+
input.push({ type: "item_reference", id: itemId });
|
|
2885
|
+
} else if (part.output.type === "json") {
|
|
2886
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
2887
|
+
value: part.output.value,
|
|
2888
|
+
schema: toolSearchOutputSchema
|
|
2889
|
+
});
|
|
2890
|
+
input.push({
|
|
2891
|
+
type: "tool_search_output",
|
|
2892
|
+
id: itemId,
|
|
2893
|
+
execution: "server",
|
|
2894
|
+
call_id: null,
|
|
2895
|
+
status: "completed",
|
|
2896
|
+
tools: parsedOutput.tools
|
|
2897
|
+
});
|
|
2898
|
+
}
|
|
2899
|
+
break;
|
|
2900
|
+
}
|
|
2816
2901
|
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2817
2902
|
if (part.output.type === "json") {
|
|
2818
|
-
const parsedOutput = await (0,
|
|
2903
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
2819
2904
|
value: part.output.value,
|
|
2820
2905
|
schema: shellOutputSchema
|
|
2821
2906
|
});
|
|
@@ -2835,7 +2920,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2835
2920
|
break;
|
|
2836
2921
|
}
|
|
2837
2922
|
if (store) {
|
|
2838
|
-
const itemId = (
|
|
2923
|
+
const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
|
|
2839
2924
|
input.push({ type: "item_reference", id: itemId });
|
|
2840
2925
|
} else {
|
|
2841
2926
|
warnings.push({
|
|
@@ -2846,7 +2931,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2846
2931
|
break;
|
|
2847
2932
|
}
|
|
2848
2933
|
case "reasoning": {
|
|
2849
|
-
const providerOptions = await (0,
|
|
2934
|
+
const providerOptions = await (0, import_provider_utils25.parseProviderOptions)({
|
|
2850
2935
|
provider: providerOptionsName,
|
|
2851
2936
|
providerOptions: part.providerOptions,
|
|
2852
2937
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2945,7 +3030,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2945
3030
|
}
|
|
2946
3031
|
const output = part.output;
|
|
2947
3032
|
if (output.type === "execution-denied") {
|
|
2948
|
-
const approvalId = (
|
|
3033
|
+
const approvalId = (_o = (_n = output.providerOptions) == null ? void 0 : _n.openai) == null ? void 0 : _o.approvalId;
|
|
2949
3034
|
if (approvalId) {
|
|
2950
3035
|
continue;
|
|
2951
3036
|
}
|
|
@@ -2953,8 +3038,22 @@ async function convertToOpenAIResponsesInput({
|
|
|
2953
3038
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2954
3039
|
part.toolName
|
|
2955
3040
|
);
|
|
3041
|
+
if (resolvedToolName === "tool_search" && output.type === "json") {
|
|
3042
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
3043
|
+
value: output.value,
|
|
3044
|
+
schema: toolSearchOutputSchema
|
|
3045
|
+
});
|
|
3046
|
+
input.push({
|
|
3047
|
+
type: "tool_search_output",
|
|
3048
|
+
execution: "client",
|
|
3049
|
+
call_id: part.toolCallId,
|
|
3050
|
+
status: "completed",
|
|
3051
|
+
tools: parsedOutput.tools
|
|
3052
|
+
});
|
|
3053
|
+
continue;
|
|
3054
|
+
}
|
|
2956
3055
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2957
|
-
const parsedOutput = await (0,
|
|
3056
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
2958
3057
|
value: output.value,
|
|
2959
3058
|
schema: localShellOutputSchema
|
|
2960
3059
|
});
|
|
@@ -2966,7 +3065,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2966
3065
|
continue;
|
|
2967
3066
|
}
|
|
2968
3067
|
if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
|
|
2969
|
-
const parsedOutput = await (0,
|
|
3068
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
2970
3069
|
value: output.value,
|
|
2971
3070
|
schema: shellOutputSchema
|
|
2972
3071
|
});
|
|
@@ -2985,7 +3084,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2985
3084
|
continue;
|
|
2986
3085
|
}
|
|
2987
3086
|
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
2988
|
-
const parsedOutput = await (0,
|
|
3087
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
2989
3088
|
value: output.value,
|
|
2990
3089
|
schema: applyPatchOutputSchema
|
|
2991
3090
|
});
|
|
@@ -3005,7 +3104,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3005
3104
|
outputValue = output.value;
|
|
3006
3105
|
break;
|
|
3007
3106
|
case "execution-denied":
|
|
3008
|
-
outputValue = (
|
|
3107
|
+
outputValue = (_p = output.reason) != null ? _p : "Tool execution denied.";
|
|
3009
3108
|
break;
|
|
3010
3109
|
case "json":
|
|
3011
3110
|
case "error-json":
|
|
@@ -3040,7 +3139,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3040
3139
|
});
|
|
3041
3140
|
return void 0;
|
|
3042
3141
|
}
|
|
3043
|
-
}).filter(
|
|
3142
|
+
}).filter(import_provider_utils25.isNonNullable);
|
|
3044
3143
|
break;
|
|
3045
3144
|
default:
|
|
3046
3145
|
outputValue = "";
|
|
@@ -3059,7 +3158,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3059
3158
|
contentValue = output.value;
|
|
3060
3159
|
break;
|
|
3061
3160
|
case "execution-denied":
|
|
3062
|
-
contentValue = (
|
|
3161
|
+
contentValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
|
|
3063
3162
|
break;
|
|
3064
3163
|
case "json":
|
|
3065
3164
|
case "error-json":
|
|
@@ -3099,7 +3198,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3099
3198
|
return void 0;
|
|
3100
3199
|
}
|
|
3101
3200
|
}
|
|
3102
|
-
}).filter(
|
|
3201
|
+
}).filter(import_provider_utils25.isNonNullable);
|
|
3103
3202
|
break;
|
|
3104
3203
|
}
|
|
3105
3204
|
input.push({
|
|
@@ -3116,11 +3215,22 @@ async function convertToOpenAIResponsesInput({
|
|
|
3116
3215
|
}
|
|
3117
3216
|
}
|
|
3118
3217
|
}
|
|
3218
|
+
if (!store && input.some(
|
|
3219
|
+
(item) => "type" in item && item.type === "reasoning" && item.encrypted_content == null
|
|
3220
|
+
)) {
|
|
3221
|
+
warnings.push({
|
|
3222
|
+
type: "other",
|
|
3223
|
+
message: "Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts."
|
|
3224
|
+
});
|
|
3225
|
+
input = input.filter(
|
|
3226
|
+
(item) => !("type" in item) || item.type !== "reasoning" || item.encrypted_content != null
|
|
3227
|
+
);
|
|
3228
|
+
}
|
|
3119
3229
|
return { input, warnings };
|
|
3120
3230
|
}
|
|
3121
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3122
|
-
itemId:
|
|
3123
|
-
reasoningEncryptedContent:
|
|
3231
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v420.z.object({
|
|
3232
|
+
itemId: import_v420.z.string().nullish(),
|
|
3233
|
+
reasoningEncryptedContent: import_v420.z.string().nullish()
|
|
3124
3234
|
});
|
|
3125
3235
|
|
|
3126
3236
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3142,483 +3252,525 @@ function mapOpenAIResponseFinishReason({
|
|
|
3142
3252
|
}
|
|
3143
3253
|
|
|
3144
3254
|
// src/responses/openai-responses-api.ts
|
|
3145
|
-
var
|
|
3146
|
-
var
|
|
3147
|
-
var
|
|
3148
|
-
() =>
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3255
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
3256
|
+
var import_v421 = require("zod/v4");
|
|
3257
|
+
var jsonValueSchema2 = import_v421.z.lazy(
|
|
3258
|
+
() => import_v421.z.union([
|
|
3259
|
+
import_v421.z.string(),
|
|
3260
|
+
import_v421.z.number(),
|
|
3261
|
+
import_v421.z.boolean(),
|
|
3262
|
+
import_v421.z.null(),
|
|
3263
|
+
import_v421.z.array(jsonValueSchema2),
|
|
3264
|
+
import_v421.z.record(import_v421.z.string(), jsonValueSchema2.optional())
|
|
3265
|
+
])
|
|
3266
|
+
);
|
|
3267
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
|
|
3268
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
3269
|
+
import_v421.z.union([
|
|
3270
|
+
import_v421.z.object({
|
|
3271
|
+
type: import_v421.z.literal("response.output_text.delta"),
|
|
3272
|
+
item_id: import_v421.z.string(),
|
|
3273
|
+
delta: import_v421.z.string(),
|
|
3274
|
+
logprobs: import_v421.z.array(
|
|
3275
|
+
import_v421.z.object({
|
|
3276
|
+
token: import_v421.z.string(),
|
|
3277
|
+
logprob: import_v421.z.number(),
|
|
3278
|
+
top_logprobs: import_v421.z.array(
|
|
3279
|
+
import_v421.z.object({
|
|
3280
|
+
token: import_v421.z.string(),
|
|
3281
|
+
logprob: import_v421.z.number()
|
|
3162
3282
|
})
|
|
3163
3283
|
)
|
|
3164
3284
|
})
|
|
3165
3285
|
).nullish()
|
|
3166
3286
|
}),
|
|
3167
|
-
|
|
3168
|
-
type:
|
|
3169
|
-
response:
|
|
3170
|
-
incomplete_details:
|
|
3171
|
-
usage:
|
|
3172
|
-
input_tokens:
|
|
3173
|
-
input_tokens_details:
|
|
3174
|
-
output_tokens:
|
|
3175
|
-
output_tokens_details:
|
|
3287
|
+
import_v421.z.object({
|
|
3288
|
+
type: import_v421.z.enum(["response.completed", "response.incomplete"]),
|
|
3289
|
+
response: import_v421.z.object({
|
|
3290
|
+
incomplete_details: import_v421.z.object({ reason: import_v421.z.string() }).nullish(),
|
|
3291
|
+
usage: import_v421.z.object({
|
|
3292
|
+
input_tokens: import_v421.z.number(),
|
|
3293
|
+
input_tokens_details: import_v421.z.object({ cached_tokens: import_v421.z.number().nullish() }).nullish(),
|
|
3294
|
+
output_tokens: import_v421.z.number(),
|
|
3295
|
+
output_tokens_details: import_v421.z.object({ reasoning_tokens: import_v421.z.number().nullish() }).nullish()
|
|
3176
3296
|
}),
|
|
3177
|
-
service_tier:
|
|
3297
|
+
service_tier: import_v421.z.string().nullish()
|
|
3178
3298
|
})
|
|
3179
3299
|
}),
|
|
3180
|
-
|
|
3181
|
-
type:
|
|
3182
|
-
response:
|
|
3183
|
-
id:
|
|
3184
|
-
created_at:
|
|
3185
|
-
model:
|
|
3186
|
-
service_tier:
|
|
3300
|
+
import_v421.z.object({
|
|
3301
|
+
type: import_v421.z.literal("response.created"),
|
|
3302
|
+
response: import_v421.z.object({
|
|
3303
|
+
id: import_v421.z.string(),
|
|
3304
|
+
created_at: import_v421.z.number(),
|
|
3305
|
+
model: import_v421.z.string(),
|
|
3306
|
+
service_tier: import_v421.z.string().nullish()
|
|
3187
3307
|
})
|
|
3188
3308
|
}),
|
|
3189
|
-
|
|
3190
|
-
type:
|
|
3191
|
-
output_index:
|
|
3192
|
-
item:
|
|
3193
|
-
|
|
3194
|
-
type:
|
|
3195
|
-
id:
|
|
3196
|
-
phase:
|
|
3309
|
+
import_v421.z.object({
|
|
3310
|
+
type: import_v421.z.literal("response.output_item.added"),
|
|
3311
|
+
output_index: import_v421.z.number(),
|
|
3312
|
+
item: import_v421.z.discriminatedUnion("type", [
|
|
3313
|
+
import_v421.z.object({
|
|
3314
|
+
type: import_v421.z.literal("message"),
|
|
3315
|
+
id: import_v421.z.string(),
|
|
3316
|
+
phase: import_v421.z.enum(["commentary", "final_answer"]).nullish()
|
|
3197
3317
|
}),
|
|
3198
|
-
|
|
3199
|
-
type:
|
|
3200
|
-
id:
|
|
3201
|
-
encrypted_content:
|
|
3318
|
+
import_v421.z.object({
|
|
3319
|
+
type: import_v421.z.literal("reasoning"),
|
|
3320
|
+
id: import_v421.z.string(),
|
|
3321
|
+
encrypted_content: import_v421.z.string().nullish()
|
|
3202
3322
|
}),
|
|
3203
|
-
|
|
3204
|
-
type:
|
|
3205
|
-
id:
|
|
3206
|
-
call_id:
|
|
3207
|
-
name:
|
|
3208
|
-
arguments:
|
|
3323
|
+
import_v421.z.object({
|
|
3324
|
+
type: import_v421.z.literal("function_call"),
|
|
3325
|
+
id: import_v421.z.string(),
|
|
3326
|
+
call_id: import_v421.z.string(),
|
|
3327
|
+
name: import_v421.z.string(),
|
|
3328
|
+
arguments: import_v421.z.string()
|
|
3209
3329
|
}),
|
|
3210
|
-
|
|
3211
|
-
type:
|
|
3212
|
-
id:
|
|
3213
|
-
status:
|
|
3330
|
+
import_v421.z.object({
|
|
3331
|
+
type: import_v421.z.literal("web_search_call"),
|
|
3332
|
+
id: import_v421.z.string(),
|
|
3333
|
+
status: import_v421.z.string()
|
|
3214
3334
|
}),
|
|
3215
|
-
|
|
3216
|
-
type:
|
|
3217
|
-
id:
|
|
3218
|
-
status:
|
|
3335
|
+
import_v421.z.object({
|
|
3336
|
+
type: import_v421.z.literal("computer_call"),
|
|
3337
|
+
id: import_v421.z.string(),
|
|
3338
|
+
status: import_v421.z.string()
|
|
3219
3339
|
}),
|
|
3220
|
-
|
|
3221
|
-
type:
|
|
3222
|
-
id:
|
|
3340
|
+
import_v421.z.object({
|
|
3341
|
+
type: import_v421.z.literal("file_search_call"),
|
|
3342
|
+
id: import_v421.z.string()
|
|
3223
3343
|
}),
|
|
3224
|
-
|
|
3225
|
-
type:
|
|
3226
|
-
id:
|
|
3344
|
+
import_v421.z.object({
|
|
3345
|
+
type: import_v421.z.literal("image_generation_call"),
|
|
3346
|
+
id: import_v421.z.string()
|
|
3227
3347
|
}),
|
|
3228
|
-
|
|
3229
|
-
type:
|
|
3230
|
-
id:
|
|
3231
|
-
container_id:
|
|
3232
|
-
code:
|
|
3233
|
-
outputs:
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3348
|
+
import_v421.z.object({
|
|
3349
|
+
type: import_v421.z.literal("code_interpreter_call"),
|
|
3350
|
+
id: import_v421.z.string(),
|
|
3351
|
+
container_id: import_v421.z.string(),
|
|
3352
|
+
code: import_v421.z.string().nullable(),
|
|
3353
|
+
outputs: import_v421.z.array(
|
|
3354
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3355
|
+
import_v421.z.object({ type: import_v421.z.literal("logs"), logs: import_v421.z.string() }),
|
|
3356
|
+
import_v421.z.object({ type: import_v421.z.literal("image"), url: import_v421.z.string() })
|
|
3237
3357
|
])
|
|
3238
3358
|
).nullable(),
|
|
3239
|
-
status:
|
|
3359
|
+
status: import_v421.z.string()
|
|
3240
3360
|
}),
|
|
3241
|
-
|
|
3242
|
-
type:
|
|
3243
|
-
id:
|
|
3244
|
-
status:
|
|
3245
|
-
approval_request_id:
|
|
3361
|
+
import_v421.z.object({
|
|
3362
|
+
type: import_v421.z.literal("mcp_call"),
|
|
3363
|
+
id: import_v421.z.string(),
|
|
3364
|
+
status: import_v421.z.string(),
|
|
3365
|
+
approval_request_id: import_v421.z.string().nullish()
|
|
3246
3366
|
}),
|
|
3247
|
-
|
|
3248
|
-
type:
|
|
3249
|
-
id:
|
|
3367
|
+
import_v421.z.object({
|
|
3368
|
+
type: import_v421.z.literal("mcp_list_tools"),
|
|
3369
|
+
id: import_v421.z.string()
|
|
3250
3370
|
}),
|
|
3251
|
-
|
|
3252
|
-
type:
|
|
3253
|
-
id:
|
|
3371
|
+
import_v421.z.object({
|
|
3372
|
+
type: import_v421.z.literal("mcp_approval_request"),
|
|
3373
|
+
id: import_v421.z.string()
|
|
3254
3374
|
}),
|
|
3255
|
-
|
|
3256
|
-
type:
|
|
3257
|
-
id:
|
|
3258
|
-
call_id:
|
|
3259
|
-
status:
|
|
3260
|
-
operation:
|
|
3261
|
-
|
|
3262
|
-
type:
|
|
3263
|
-
path:
|
|
3264
|
-
diff:
|
|
3375
|
+
import_v421.z.object({
|
|
3376
|
+
type: import_v421.z.literal("apply_patch_call"),
|
|
3377
|
+
id: import_v421.z.string(),
|
|
3378
|
+
call_id: import_v421.z.string(),
|
|
3379
|
+
status: import_v421.z.enum(["in_progress", "completed"]),
|
|
3380
|
+
operation: import_v421.z.discriminatedUnion("type", [
|
|
3381
|
+
import_v421.z.object({
|
|
3382
|
+
type: import_v421.z.literal("create_file"),
|
|
3383
|
+
path: import_v421.z.string(),
|
|
3384
|
+
diff: import_v421.z.string()
|
|
3265
3385
|
}),
|
|
3266
|
-
|
|
3267
|
-
type:
|
|
3268
|
-
path:
|
|
3386
|
+
import_v421.z.object({
|
|
3387
|
+
type: import_v421.z.literal("delete_file"),
|
|
3388
|
+
path: import_v421.z.string()
|
|
3269
3389
|
}),
|
|
3270
|
-
|
|
3271
|
-
type:
|
|
3272
|
-
path:
|
|
3273
|
-
diff:
|
|
3390
|
+
import_v421.z.object({
|
|
3391
|
+
type: import_v421.z.literal("update_file"),
|
|
3392
|
+
path: import_v421.z.string(),
|
|
3393
|
+
diff: import_v421.z.string()
|
|
3274
3394
|
})
|
|
3275
3395
|
])
|
|
3276
3396
|
}),
|
|
3277
|
-
|
|
3278
|
-
type:
|
|
3279
|
-
id:
|
|
3280
|
-
call_id:
|
|
3281
|
-
name:
|
|
3282
|
-
input:
|
|
3397
|
+
import_v421.z.object({
|
|
3398
|
+
type: import_v421.z.literal("custom_tool_call"),
|
|
3399
|
+
id: import_v421.z.string(),
|
|
3400
|
+
call_id: import_v421.z.string(),
|
|
3401
|
+
name: import_v421.z.string(),
|
|
3402
|
+
input: import_v421.z.string()
|
|
3283
3403
|
}),
|
|
3284
|
-
|
|
3285
|
-
type:
|
|
3286
|
-
id:
|
|
3287
|
-
call_id:
|
|
3288
|
-
status:
|
|
3289
|
-
action:
|
|
3290
|
-
commands:
|
|
3404
|
+
import_v421.z.object({
|
|
3405
|
+
type: import_v421.z.literal("shell_call"),
|
|
3406
|
+
id: import_v421.z.string(),
|
|
3407
|
+
call_id: import_v421.z.string(),
|
|
3408
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3409
|
+
action: import_v421.z.object({
|
|
3410
|
+
commands: import_v421.z.array(import_v421.z.string())
|
|
3291
3411
|
})
|
|
3292
3412
|
}),
|
|
3293
|
-
|
|
3294
|
-
type:
|
|
3295
|
-
id:
|
|
3296
|
-
call_id:
|
|
3297
|
-
status:
|
|
3298
|
-
output:
|
|
3299
|
-
|
|
3300
|
-
stdout:
|
|
3301
|
-
stderr:
|
|
3302
|
-
outcome:
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
type:
|
|
3306
|
-
exit_code:
|
|
3413
|
+
import_v421.z.object({
|
|
3414
|
+
type: import_v421.z.literal("shell_call_output"),
|
|
3415
|
+
id: import_v421.z.string(),
|
|
3416
|
+
call_id: import_v421.z.string(),
|
|
3417
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3418
|
+
output: import_v421.z.array(
|
|
3419
|
+
import_v421.z.object({
|
|
3420
|
+
stdout: import_v421.z.string(),
|
|
3421
|
+
stderr: import_v421.z.string(),
|
|
3422
|
+
outcome: import_v421.z.discriminatedUnion("type", [
|
|
3423
|
+
import_v421.z.object({ type: import_v421.z.literal("timeout") }),
|
|
3424
|
+
import_v421.z.object({
|
|
3425
|
+
type: import_v421.z.literal("exit"),
|
|
3426
|
+
exit_code: import_v421.z.number()
|
|
3307
3427
|
})
|
|
3308
3428
|
])
|
|
3309
3429
|
})
|
|
3310
3430
|
)
|
|
3431
|
+
}),
|
|
3432
|
+
import_v421.z.object({
|
|
3433
|
+
type: import_v421.z.literal("tool_search_call"),
|
|
3434
|
+
id: import_v421.z.string(),
|
|
3435
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
3436
|
+
call_id: import_v421.z.string().nullable(),
|
|
3437
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3438
|
+
arguments: import_v421.z.unknown()
|
|
3439
|
+
}),
|
|
3440
|
+
import_v421.z.object({
|
|
3441
|
+
type: import_v421.z.literal("tool_search_output"),
|
|
3442
|
+
id: import_v421.z.string(),
|
|
3443
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
3444
|
+
call_id: import_v421.z.string().nullable(),
|
|
3445
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3446
|
+
tools: import_v421.z.array(import_v421.z.record(import_v421.z.string(), jsonValueSchema2.optional()))
|
|
3311
3447
|
})
|
|
3312
3448
|
])
|
|
3313
3449
|
}),
|
|
3314
|
-
|
|
3315
|
-
type:
|
|
3316
|
-
output_index:
|
|
3317
|
-
item:
|
|
3318
|
-
|
|
3319
|
-
type:
|
|
3320
|
-
id:
|
|
3321
|
-
phase:
|
|
3450
|
+
import_v421.z.object({
|
|
3451
|
+
type: import_v421.z.literal("response.output_item.done"),
|
|
3452
|
+
output_index: import_v421.z.number(),
|
|
3453
|
+
item: import_v421.z.discriminatedUnion("type", [
|
|
3454
|
+
import_v421.z.object({
|
|
3455
|
+
type: import_v421.z.literal("message"),
|
|
3456
|
+
id: import_v421.z.string(),
|
|
3457
|
+
phase: import_v421.z.enum(["commentary", "final_answer"]).nullish()
|
|
3322
3458
|
}),
|
|
3323
|
-
|
|
3324
|
-
type:
|
|
3325
|
-
id:
|
|
3326
|
-
encrypted_content:
|
|
3459
|
+
import_v421.z.object({
|
|
3460
|
+
type: import_v421.z.literal("reasoning"),
|
|
3461
|
+
id: import_v421.z.string(),
|
|
3462
|
+
encrypted_content: import_v421.z.string().nullish()
|
|
3327
3463
|
}),
|
|
3328
|
-
|
|
3329
|
-
type:
|
|
3330
|
-
id:
|
|
3331
|
-
call_id:
|
|
3332
|
-
name:
|
|
3333
|
-
arguments:
|
|
3334
|
-
status:
|
|
3464
|
+
import_v421.z.object({
|
|
3465
|
+
type: import_v421.z.literal("function_call"),
|
|
3466
|
+
id: import_v421.z.string(),
|
|
3467
|
+
call_id: import_v421.z.string(),
|
|
3468
|
+
name: import_v421.z.string(),
|
|
3469
|
+
arguments: import_v421.z.string(),
|
|
3470
|
+
status: import_v421.z.literal("completed")
|
|
3335
3471
|
}),
|
|
3336
|
-
|
|
3337
|
-
type:
|
|
3338
|
-
id:
|
|
3339
|
-
call_id:
|
|
3340
|
-
name:
|
|
3341
|
-
input:
|
|
3342
|
-
status:
|
|
3472
|
+
import_v421.z.object({
|
|
3473
|
+
type: import_v421.z.literal("custom_tool_call"),
|
|
3474
|
+
id: import_v421.z.string(),
|
|
3475
|
+
call_id: import_v421.z.string(),
|
|
3476
|
+
name: import_v421.z.string(),
|
|
3477
|
+
input: import_v421.z.string(),
|
|
3478
|
+
status: import_v421.z.literal("completed")
|
|
3343
3479
|
}),
|
|
3344
|
-
|
|
3345
|
-
type:
|
|
3346
|
-
id:
|
|
3347
|
-
code:
|
|
3348
|
-
container_id:
|
|
3349
|
-
outputs:
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3480
|
+
import_v421.z.object({
|
|
3481
|
+
type: import_v421.z.literal("code_interpreter_call"),
|
|
3482
|
+
id: import_v421.z.string(),
|
|
3483
|
+
code: import_v421.z.string().nullable(),
|
|
3484
|
+
container_id: import_v421.z.string(),
|
|
3485
|
+
outputs: import_v421.z.array(
|
|
3486
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3487
|
+
import_v421.z.object({ type: import_v421.z.literal("logs"), logs: import_v421.z.string() }),
|
|
3488
|
+
import_v421.z.object({ type: import_v421.z.literal("image"), url: import_v421.z.string() })
|
|
3353
3489
|
])
|
|
3354
3490
|
).nullable()
|
|
3355
3491
|
}),
|
|
3356
|
-
|
|
3357
|
-
type:
|
|
3358
|
-
id:
|
|
3359
|
-
result:
|
|
3492
|
+
import_v421.z.object({
|
|
3493
|
+
type: import_v421.z.literal("image_generation_call"),
|
|
3494
|
+
id: import_v421.z.string(),
|
|
3495
|
+
result: import_v421.z.string()
|
|
3360
3496
|
}),
|
|
3361
|
-
|
|
3362
|
-
type:
|
|
3363
|
-
id:
|
|
3364
|
-
status:
|
|
3365
|
-
action:
|
|
3366
|
-
|
|
3367
|
-
type:
|
|
3368
|
-
query:
|
|
3369
|
-
sources:
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3497
|
+
import_v421.z.object({
|
|
3498
|
+
type: import_v421.z.literal("web_search_call"),
|
|
3499
|
+
id: import_v421.z.string(),
|
|
3500
|
+
status: import_v421.z.string(),
|
|
3501
|
+
action: import_v421.z.discriminatedUnion("type", [
|
|
3502
|
+
import_v421.z.object({
|
|
3503
|
+
type: import_v421.z.literal("search"),
|
|
3504
|
+
query: import_v421.z.string().nullish(),
|
|
3505
|
+
sources: import_v421.z.array(
|
|
3506
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3507
|
+
import_v421.z.object({ type: import_v421.z.literal("url"), url: import_v421.z.string() }),
|
|
3508
|
+
import_v421.z.object({ type: import_v421.z.literal("api"), name: import_v421.z.string() })
|
|
3373
3509
|
])
|
|
3374
3510
|
).nullish()
|
|
3375
3511
|
}),
|
|
3376
|
-
|
|
3377
|
-
type:
|
|
3378
|
-
url:
|
|
3512
|
+
import_v421.z.object({
|
|
3513
|
+
type: import_v421.z.literal("open_page"),
|
|
3514
|
+
url: import_v421.z.string().nullish()
|
|
3379
3515
|
}),
|
|
3380
|
-
|
|
3381
|
-
type:
|
|
3382
|
-
url:
|
|
3383
|
-
pattern:
|
|
3516
|
+
import_v421.z.object({
|
|
3517
|
+
type: import_v421.z.literal("find_in_page"),
|
|
3518
|
+
url: import_v421.z.string().nullish(),
|
|
3519
|
+
pattern: import_v421.z.string().nullish()
|
|
3384
3520
|
})
|
|
3385
3521
|
]).nullish()
|
|
3386
3522
|
}),
|
|
3387
|
-
|
|
3388
|
-
type:
|
|
3389
|
-
id:
|
|
3390
|
-
queries:
|
|
3391
|
-
results:
|
|
3392
|
-
|
|
3393
|
-
attributes:
|
|
3394
|
-
|
|
3395
|
-
|
|
3523
|
+
import_v421.z.object({
|
|
3524
|
+
type: import_v421.z.literal("file_search_call"),
|
|
3525
|
+
id: import_v421.z.string(),
|
|
3526
|
+
queries: import_v421.z.array(import_v421.z.string()),
|
|
3527
|
+
results: import_v421.z.array(
|
|
3528
|
+
import_v421.z.object({
|
|
3529
|
+
attributes: import_v421.z.record(
|
|
3530
|
+
import_v421.z.string(),
|
|
3531
|
+
import_v421.z.union([import_v421.z.string(), import_v421.z.number(), import_v421.z.boolean()])
|
|
3396
3532
|
),
|
|
3397
|
-
file_id:
|
|
3398
|
-
filename:
|
|
3399
|
-
score:
|
|
3400
|
-
text:
|
|
3533
|
+
file_id: import_v421.z.string(),
|
|
3534
|
+
filename: import_v421.z.string(),
|
|
3535
|
+
score: import_v421.z.number(),
|
|
3536
|
+
text: import_v421.z.string()
|
|
3401
3537
|
})
|
|
3402
3538
|
).nullish()
|
|
3403
3539
|
}),
|
|
3404
|
-
|
|
3405
|
-
type:
|
|
3406
|
-
id:
|
|
3407
|
-
call_id:
|
|
3408
|
-
action:
|
|
3409
|
-
type:
|
|
3410
|
-
command:
|
|
3411
|
-
timeout_ms:
|
|
3412
|
-
user:
|
|
3413
|
-
working_directory:
|
|
3414
|
-
env:
|
|
3540
|
+
import_v421.z.object({
|
|
3541
|
+
type: import_v421.z.literal("local_shell_call"),
|
|
3542
|
+
id: import_v421.z.string(),
|
|
3543
|
+
call_id: import_v421.z.string(),
|
|
3544
|
+
action: import_v421.z.object({
|
|
3545
|
+
type: import_v421.z.literal("exec"),
|
|
3546
|
+
command: import_v421.z.array(import_v421.z.string()),
|
|
3547
|
+
timeout_ms: import_v421.z.number().optional(),
|
|
3548
|
+
user: import_v421.z.string().optional(),
|
|
3549
|
+
working_directory: import_v421.z.string().optional(),
|
|
3550
|
+
env: import_v421.z.record(import_v421.z.string(), import_v421.z.string()).optional()
|
|
3415
3551
|
})
|
|
3416
3552
|
}),
|
|
3417
|
-
|
|
3418
|
-
type:
|
|
3419
|
-
id:
|
|
3420
|
-
status:
|
|
3553
|
+
import_v421.z.object({
|
|
3554
|
+
type: import_v421.z.literal("computer_call"),
|
|
3555
|
+
id: import_v421.z.string(),
|
|
3556
|
+
status: import_v421.z.literal("completed")
|
|
3421
3557
|
}),
|
|
3422
|
-
|
|
3423
|
-
type:
|
|
3424
|
-
id:
|
|
3425
|
-
status:
|
|
3426
|
-
arguments:
|
|
3427
|
-
name:
|
|
3428
|
-
server_label:
|
|
3429
|
-
output:
|
|
3430
|
-
error:
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
type:
|
|
3434
|
-
code:
|
|
3435
|
-
message:
|
|
3558
|
+
import_v421.z.object({
|
|
3559
|
+
type: import_v421.z.literal("mcp_call"),
|
|
3560
|
+
id: import_v421.z.string(),
|
|
3561
|
+
status: import_v421.z.string(),
|
|
3562
|
+
arguments: import_v421.z.string(),
|
|
3563
|
+
name: import_v421.z.string(),
|
|
3564
|
+
server_label: import_v421.z.string(),
|
|
3565
|
+
output: import_v421.z.string().nullish(),
|
|
3566
|
+
error: import_v421.z.union([
|
|
3567
|
+
import_v421.z.string(),
|
|
3568
|
+
import_v421.z.object({
|
|
3569
|
+
type: import_v421.z.string().optional(),
|
|
3570
|
+
code: import_v421.z.union([import_v421.z.number(), import_v421.z.string()]).optional(),
|
|
3571
|
+
message: import_v421.z.string().optional()
|
|
3436
3572
|
}).loose()
|
|
3437
3573
|
]).nullish(),
|
|
3438
|
-
approval_request_id:
|
|
3574
|
+
approval_request_id: import_v421.z.string().nullish()
|
|
3439
3575
|
}),
|
|
3440
|
-
|
|
3441
|
-
type:
|
|
3442
|
-
id:
|
|
3443
|
-
server_label:
|
|
3444
|
-
tools:
|
|
3445
|
-
|
|
3446
|
-
name:
|
|
3447
|
-
description:
|
|
3448
|
-
input_schema:
|
|
3449
|
-
annotations:
|
|
3576
|
+
import_v421.z.object({
|
|
3577
|
+
type: import_v421.z.literal("mcp_list_tools"),
|
|
3578
|
+
id: import_v421.z.string(),
|
|
3579
|
+
server_label: import_v421.z.string(),
|
|
3580
|
+
tools: import_v421.z.array(
|
|
3581
|
+
import_v421.z.object({
|
|
3582
|
+
name: import_v421.z.string(),
|
|
3583
|
+
description: import_v421.z.string().optional(),
|
|
3584
|
+
input_schema: import_v421.z.any(),
|
|
3585
|
+
annotations: import_v421.z.record(import_v421.z.string(), import_v421.z.unknown()).optional()
|
|
3450
3586
|
})
|
|
3451
3587
|
),
|
|
3452
|
-
error:
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
type:
|
|
3456
|
-
code:
|
|
3457
|
-
message:
|
|
3588
|
+
error: import_v421.z.union([
|
|
3589
|
+
import_v421.z.string(),
|
|
3590
|
+
import_v421.z.object({
|
|
3591
|
+
type: import_v421.z.string().optional(),
|
|
3592
|
+
code: import_v421.z.union([import_v421.z.number(), import_v421.z.string()]).optional(),
|
|
3593
|
+
message: import_v421.z.string().optional()
|
|
3458
3594
|
}).loose()
|
|
3459
3595
|
]).optional()
|
|
3460
3596
|
}),
|
|
3461
|
-
|
|
3462
|
-
type:
|
|
3463
|
-
id:
|
|
3464
|
-
server_label:
|
|
3465
|
-
name:
|
|
3466
|
-
arguments:
|
|
3467
|
-
approval_request_id:
|
|
3597
|
+
import_v421.z.object({
|
|
3598
|
+
type: import_v421.z.literal("mcp_approval_request"),
|
|
3599
|
+
id: import_v421.z.string(),
|
|
3600
|
+
server_label: import_v421.z.string(),
|
|
3601
|
+
name: import_v421.z.string(),
|
|
3602
|
+
arguments: import_v421.z.string(),
|
|
3603
|
+
approval_request_id: import_v421.z.string().optional()
|
|
3468
3604
|
}),
|
|
3469
|
-
|
|
3470
|
-
type:
|
|
3471
|
-
id:
|
|
3472
|
-
call_id:
|
|
3473
|
-
status:
|
|
3474
|
-
operation:
|
|
3475
|
-
|
|
3476
|
-
type:
|
|
3477
|
-
path:
|
|
3478
|
-
diff:
|
|
3605
|
+
import_v421.z.object({
|
|
3606
|
+
type: import_v421.z.literal("apply_patch_call"),
|
|
3607
|
+
id: import_v421.z.string(),
|
|
3608
|
+
call_id: import_v421.z.string(),
|
|
3609
|
+
status: import_v421.z.enum(["in_progress", "completed"]),
|
|
3610
|
+
operation: import_v421.z.discriminatedUnion("type", [
|
|
3611
|
+
import_v421.z.object({
|
|
3612
|
+
type: import_v421.z.literal("create_file"),
|
|
3613
|
+
path: import_v421.z.string(),
|
|
3614
|
+
diff: import_v421.z.string()
|
|
3479
3615
|
}),
|
|
3480
|
-
|
|
3481
|
-
type:
|
|
3482
|
-
path:
|
|
3616
|
+
import_v421.z.object({
|
|
3617
|
+
type: import_v421.z.literal("delete_file"),
|
|
3618
|
+
path: import_v421.z.string()
|
|
3483
3619
|
}),
|
|
3484
|
-
|
|
3485
|
-
type:
|
|
3486
|
-
path:
|
|
3487
|
-
diff:
|
|
3620
|
+
import_v421.z.object({
|
|
3621
|
+
type: import_v421.z.literal("update_file"),
|
|
3622
|
+
path: import_v421.z.string(),
|
|
3623
|
+
diff: import_v421.z.string()
|
|
3488
3624
|
})
|
|
3489
3625
|
])
|
|
3490
3626
|
}),
|
|
3491
|
-
|
|
3492
|
-
type:
|
|
3493
|
-
id:
|
|
3494
|
-
call_id:
|
|
3495
|
-
status:
|
|
3496
|
-
action:
|
|
3497
|
-
commands:
|
|
3627
|
+
import_v421.z.object({
|
|
3628
|
+
type: import_v421.z.literal("shell_call"),
|
|
3629
|
+
id: import_v421.z.string(),
|
|
3630
|
+
call_id: import_v421.z.string(),
|
|
3631
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3632
|
+
action: import_v421.z.object({
|
|
3633
|
+
commands: import_v421.z.array(import_v421.z.string())
|
|
3498
3634
|
})
|
|
3499
3635
|
}),
|
|
3500
|
-
|
|
3501
|
-
type:
|
|
3502
|
-
id:
|
|
3503
|
-
call_id:
|
|
3504
|
-
status:
|
|
3505
|
-
output:
|
|
3506
|
-
|
|
3507
|
-
stdout:
|
|
3508
|
-
stderr:
|
|
3509
|
-
outcome:
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
type:
|
|
3513
|
-
exit_code:
|
|
3636
|
+
import_v421.z.object({
|
|
3637
|
+
type: import_v421.z.literal("shell_call_output"),
|
|
3638
|
+
id: import_v421.z.string(),
|
|
3639
|
+
call_id: import_v421.z.string(),
|
|
3640
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3641
|
+
output: import_v421.z.array(
|
|
3642
|
+
import_v421.z.object({
|
|
3643
|
+
stdout: import_v421.z.string(),
|
|
3644
|
+
stderr: import_v421.z.string(),
|
|
3645
|
+
outcome: import_v421.z.discriminatedUnion("type", [
|
|
3646
|
+
import_v421.z.object({ type: import_v421.z.literal("timeout") }),
|
|
3647
|
+
import_v421.z.object({
|
|
3648
|
+
type: import_v421.z.literal("exit"),
|
|
3649
|
+
exit_code: import_v421.z.number()
|
|
3514
3650
|
})
|
|
3515
3651
|
])
|
|
3516
3652
|
})
|
|
3517
3653
|
)
|
|
3654
|
+
}),
|
|
3655
|
+
import_v421.z.object({
|
|
3656
|
+
type: import_v421.z.literal("tool_search_call"),
|
|
3657
|
+
id: import_v421.z.string(),
|
|
3658
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
3659
|
+
call_id: import_v421.z.string().nullable(),
|
|
3660
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3661
|
+
arguments: import_v421.z.unknown()
|
|
3662
|
+
}),
|
|
3663
|
+
import_v421.z.object({
|
|
3664
|
+
type: import_v421.z.literal("tool_search_output"),
|
|
3665
|
+
id: import_v421.z.string(),
|
|
3666
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
3667
|
+
call_id: import_v421.z.string().nullable(),
|
|
3668
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3669
|
+
tools: import_v421.z.array(import_v421.z.record(import_v421.z.string(), jsonValueSchema2.optional()))
|
|
3518
3670
|
})
|
|
3519
3671
|
])
|
|
3520
3672
|
}),
|
|
3521
|
-
|
|
3522
|
-
type:
|
|
3523
|
-
item_id:
|
|
3524
|
-
output_index:
|
|
3525
|
-
delta:
|
|
3673
|
+
import_v421.z.object({
|
|
3674
|
+
type: import_v421.z.literal("response.function_call_arguments.delta"),
|
|
3675
|
+
item_id: import_v421.z.string(),
|
|
3676
|
+
output_index: import_v421.z.number(),
|
|
3677
|
+
delta: import_v421.z.string()
|
|
3526
3678
|
}),
|
|
3527
|
-
|
|
3528
|
-
type:
|
|
3529
|
-
item_id:
|
|
3530
|
-
output_index:
|
|
3531
|
-
delta:
|
|
3679
|
+
import_v421.z.object({
|
|
3680
|
+
type: import_v421.z.literal("response.custom_tool_call_input.delta"),
|
|
3681
|
+
item_id: import_v421.z.string(),
|
|
3682
|
+
output_index: import_v421.z.number(),
|
|
3683
|
+
delta: import_v421.z.string()
|
|
3532
3684
|
}),
|
|
3533
|
-
|
|
3534
|
-
type:
|
|
3535
|
-
item_id:
|
|
3536
|
-
output_index:
|
|
3537
|
-
partial_image_b64:
|
|
3685
|
+
import_v421.z.object({
|
|
3686
|
+
type: import_v421.z.literal("response.image_generation_call.partial_image"),
|
|
3687
|
+
item_id: import_v421.z.string(),
|
|
3688
|
+
output_index: import_v421.z.number(),
|
|
3689
|
+
partial_image_b64: import_v421.z.string()
|
|
3538
3690
|
}),
|
|
3539
|
-
|
|
3540
|
-
type:
|
|
3541
|
-
item_id:
|
|
3542
|
-
output_index:
|
|
3543
|
-
delta:
|
|
3691
|
+
import_v421.z.object({
|
|
3692
|
+
type: import_v421.z.literal("response.code_interpreter_call_code.delta"),
|
|
3693
|
+
item_id: import_v421.z.string(),
|
|
3694
|
+
output_index: import_v421.z.number(),
|
|
3695
|
+
delta: import_v421.z.string()
|
|
3544
3696
|
}),
|
|
3545
|
-
|
|
3546
|
-
type:
|
|
3547
|
-
item_id:
|
|
3548
|
-
output_index:
|
|
3549
|
-
code:
|
|
3697
|
+
import_v421.z.object({
|
|
3698
|
+
type: import_v421.z.literal("response.code_interpreter_call_code.done"),
|
|
3699
|
+
item_id: import_v421.z.string(),
|
|
3700
|
+
output_index: import_v421.z.number(),
|
|
3701
|
+
code: import_v421.z.string()
|
|
3550
3702
|
}),
|
|
3551
|
-
|
|
3552
|
-
type:
|
|
3553
|
-
annotation:
|
|
3554
|
-
|
|
3555
|
-
type:
|
|
3556
|
-
start_index:
|
|
3557
|
-
end_index:
|
|
3558
|
-
url:
|
|
3559
|
-
title:
|
|
3703
|
+
import_v421.z.object({
|
|
3704
|
+
type: import_v421.z.literal("response.output_text.annotation.added"),
|
|
3705
|
+
annotation: import_v421.z.discriminatedUnion("type", [
|
|
3706
|
+
import_v421.z.object({
|
|
3707
|
+
type: import_v421.z.literal("url_citation"),
|
|
3708
|
+
start_index: import_v421.z.number(),
|
|
3709
|
+
end_index: import_v421.z.number(),
|
|
3710
|
+
url: import_v421.z.string(),
|
|
3711
|
+
title: import_v421.z.string()
|
|
3560
3712
|
}),
|
|
3561
|
-
|
|
3562
|
-
type:
|
|
3563
|
-
file_id:
|
|
3564
|
-
filename:
|
|
3565
|
-
index:
|
|
3713
|
+
import_v421.z.object({
|
|
3714
|
+
type: import_v421.z.literal("file_citation"),
|
|
3715
|
+
file_id: import_v421.z.string(),
|
|
3716
|
+
filename: import_v421.z.string(),
|
|
3717
|
+
index: import_v421.z.number()
|
|
3566
3718
|
}),
|
|
3567
|
-
|
|
3568
|
-
type:
|
|
3569
|
-
container_id:
|
|
3570
|
-
file_id:
|
|
3571
|
-
filename:
|
|
3572
|
-
start_index:
|
|
3573
|
-
end_index:
|
|
3719
|
+
import_v421.z.object({
|
|
3720
|
+
type: import_v421.z.literal("container_file_citation"),
|
|
3721
|
+
container_id: import_v421.z.string(),
|
|
3722
|
+
file_id: import_v421.z.string(),
|
|
3723
|
+
filename: import_v421.z.string(),
|
|
3724
|
+
start_index: import_v421.z.number(),
|
|
3725
|
+
end_index: import_v421.z.number()
|
|
3574
3726
|
}),
|
|
3575
|
-
|
|
3576
|
-
type:
|
|
3577
|
-
file_id:
|
|
3578
|
-
index:
|
|
3727
|
+
import_v421.z.object({
|
|
3728
|
+
type: import_v421.z.literal("file_path"),
|
|
3729
|
+
file_id: import_v421.z.string(),
|
|
3730
|
+
index: import_v421.z.number()
|
|
3579
3731
|
})
|
|
3580
3732
|
])
|
|
3581
3733
|
}),
|
|
3582
|
-
|
|
3583
|
-
type:
|
|
3584
|
-
item_id:
|
|
3585
|
-
summary_index:
|
|
3734
|
+
import_v421.z.object({
|
|
3735
|
+
type: import_v421.z.literal("response.reasoning_summary_part.added"),
|
|
3736
|
+
item_id: import_v421.z.string(),
|
|
3737
|
+
summary_index: import_v421.z.number()
|
|
3586
3738
|
}),
|
|
3587
|
-
|
|
3588
|
-
type:
|
|
3589
|
-
item_id:
|
|
3590
|
-
summary_index:
|
|
3591
|
-
delta:
|
|
3739
|
+
import_v421.z.object({
|
|
3740
|
+
type: import_v421.z.literal("response.reasoning_summary_text.delta"),
|
|
3741
|
+
item_id: import_v421.z.string(),
|
|
3742
|
+
summary_index: import_v421.z.number(),
|
|
3743
|
+
delta: import_v421.z.string()
|
|
3592
3744
|
}),
|
|
3593
|
-
|
|
3594
|
-
type:
|
|
3595
|
-
item_id:
|
|
3596
|
-
summary_index:
|
|
3745
|
+
import_v421.z.object({
|
|
3746
|
+
type: import_v421.z.literal("response.reasoning_summary_part.done"),
|
|
3747
|
+
item_id: import_v421.z.string(),
|
|
3748
|
+
summary_index: import_v421.z.number()
|
|
3597
3749
|
}),
|
|
3598
|
-
|
|
3599
|
-
type:
|
|
3600
|
-
item_id:
|
|
3601
|
-
output_index:
|
|
3602
|
-
delta:
|
|
3603
|
-
obfuscation:
|
|
3750
|
+
import_v421.z.object({
|
|
3751
|
+
type: import_v421.z.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3752
|
+
item_id: import_v421.z.string(),
|
|
3753
|
+
output_index: import_v421.z.number(),
|
|
3754
|
+
delta: import_v421.z.string(),
|
|
3755
|
+
obfuscation: import_v421.z.string().nullish()
|
|
3604
3756
|
}),
|
|
3605
|
-
|
|
3606
|
-
type:
|
|
3607
|
-
item_id:
|
|
3608
|
-
output_index:
|
|
3609
|
-
diff:
|
|
3757
|
+
import_v421.z.object({
|
|
3758
|
+
type: import_v421.z.literal("response.apply_patch_call_operation_diff.done"),
|
|
3759
|
+
item_id: import_v421.z.string(),
|
|
3760
|
+
output_index: import_v421.z.number(),
|
|
3761
|
+
diff: import_v421.z.string()
|
|
3610
3762
|
}),
|
|
3611
|
-
|
|
3612
|
-
type:
|
|
3613
|
-
sequence_number:
|
|
3614
|
-
error:
|
|
3615
|
-
type:
|
|
3616
|
-
code:
|
|
3617
|
-
message:
|
|
3618
|
-
param:
|
|
3763
|
+
import_v421.z.object({
|
|
3764
|
+
type: import_v421.z.literal("error"),
|
|
3765
|
+
sequence_number: import_v421.z.number(),
|
|
3766
|
+
error: import_v421.z.object({
|
|
3767
|
+
type: import_v421.z.string(),
|
|
3768
|
+
code: import_v421.z.string(),
|
|
3769
|
+
message: import_v421.z.string(),
|
|
3770
|
+
param: import_v421.z.string().nullish()
|
|
3619
3771
|
})
|
|
3620
3772
|
}),
|
|
3621
|
-
|
|
3773
|
+
import_v421.z.object({ type: import_v421.z.string() }).loose().transform((value) => ({
|
|
3622
3774
|
type: "unknown_chunk",
|
|
3623
3775
|
message: value.type
|
|
3624
3776
|
}))
|
|
@@ -3626,294 +3778,310 @@ var openaiResponsesChunkSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3626
3778
|
])
|
|
3627
3779
|
)
|
|
3628
3780
|
);
|
|
3629
|
-
var openaiResponsesResponseSchema = (0,
|
|
3630
|
-
() => (0,
|
|
3631
|
-
|
|
3632
|
-
id:
|
|
3633
|
-
created_at:
|
|
3634
|
-
error:
|
|
3635
|
-
message:
|
|
3636
|
-
type:
|
|
3637
|
-
param:
|
|
3638
|
-
code:
|
|
3781
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils26.lazySchema)(
|
|
3782
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
3783
|
+
import_v421.z.object({
|
|
3784
|
+
id: import_v421.z.string().optional(),
|
|
3785
|
+
created_at: import_v421.z.number().optional(),
|
|
3786
|
+
error: import_v421.z.object({
|
|
3787
|
+
message: import_v421.z.string(),
|
|
3788
|
+
type: import_v421.z.string(),
|
|
3789
|
+
param: import_v421.z.string().nullish(),
|
|
3790
|
+
code: import_v421.z.string()
|
|
3639
3791
|
}).nullish(),
|
|
3640
|
-
model:
|
|
3641
|
-
output:
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
type:
|
|
3645
|
-
role:
|
|
3646
|
-
id:
|
|
3647
|
-
phase:
|
|
3648
|
-
content:
|
|
3649
|
-
|
|
3650
|
-
type:
|
|
3651
|
-
text:
|
|
3652
|
-
logprobs:
|
|
3653
|
-
|
|
3654
|
-
token:
|
|
3655
|
-
logprob:
|
|
3656
|
-
top_logprobs:
|
|
3657
|
-
|
|
3658
|
-
token:
|
|
3659
|
-
logprob:
|
|
3792
|
+
model: import_v421.z.string().optional(),
|
|
3793
|
+
output: import_v421.z.array(
|
|
3794
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3795
|
+
import_v421.z.object({
|
|
3796
|
+
type: import_v421.z.literal("message"),
|
|
3797
|
+
role: import_v421.z.literal("assistant"),
|
|
3798
|
+
id: import_v421.z.string(),
|
|
3799
|
+
phase: import_v421.z.enum(["commentary", "final_answer"]).nullish(),
|
|
3800
|
+
content: import_v421.z.array(
|
|
3801
|
+
import_v421.z.object({
|
|
3802
|
+
type: import_v421.z.literal("output_text"),
|
|
3803
|
+
text: import_v421.z.string(),
|
|
3804
|
+
logprobs: import_v421.z.array(
|
|
3805
|
+
import_v421.z.object({
|
|
3806
|
+
token: import_v421.z.string(),
|
|
3807
|
+
logprob: import_v421.z.number(),
|
|
3808
|
+
top_logprobs: import_v421.z.array(
|
|
3809
|
+
import_v421.z.object({
|
|
3810
|
+
token: import_v421.z.string(),
|
|
3811
|
+
logprob: import_v421.z.number()
|
|
3660
3812
|
})
|
|
3661
3813
|
)
|
|
3662
3814
|
})
|
|
3663
3815
|
).nullish(),
|
|
3664
|
-
annotations:
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
type:
|
|
3668
|
-
start_index:
|
|
3669
|
-
end_index:
|
|
3670
|
-
url:
|
|
3671
|
-
title:
|
|
3816
|
+
annotations: import_v421.z.array(
|
|
3817
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3818
|
+
import_v421.z.object({
|
|
3819
|
+
type: import_v421.z.literal("url_citation"),
|
|
3820
|
+
start_index: import_v421.z.number(),
|
|
3821
|
+
end_index: import_v421.z.number(),
|
|
3822
|
+
url: import_v421.z.string(),
|
|
3823
|
+
title: import_v421.z.string()
|
|
3672
3824
|
}),
|
|
3673
|
-
|
|
3674
|
-
type:
|
|
3675
|
-
file_id:
|
|
3676
|
-
filename:
|
|
3677
|
-
index:
|
|
3825
|
+
import_v421.z.object({
|
|
3826
|
+
type: import_v421.z.literal("file_citation"),
|
|
3827
|
+
file_id: import_v421.z.string(),
|
|
3828
|
+
filename: import_v421.z.string(),
|
|
3829
|
+
index: import_v421.z.number()
|
|
3678
3830
|
}),
|
|
3679
|
-
|
|
3680
|
-
type:
|
|
3681
|
-
container_id:
|
|
3682
|
-
file_id:
|
|
3683
|
-
filename:
|
|
3684
|
-
start_index:
|
|
3685
|
-
end_index:
|
|
3831
|
+
import_v421.z.object({
|
|
3832
|
+
type: import_v421.z.literal("container_file_citation"),
|
|
3833
|
+
container_id: import_v421.z.string(),
|
|
3834
|
+
file_id: import_v421.z.string(),
|
|
3835
|
+
filename: import_v421.z.string(),
|
|
3836
|
+
start_index: import_v421.z.number(),
|
|
3837
|
+
end_index: import_v421.z.number()
|
|
3686
3838
|
}),
|
|
3687
|
-
|
|
3688
|
-
type:
|
|
3689
|
-
file_id:
|
|
3690
|
-
index:
|
|
3839
|
+
import_v421.z.object({
|
|
3840
|
+
type: import_v421.z.literal("file_path"),
|
|
3841
|
+
file_id: import_v421.z.string(),
|
|
3842
|
+
index: import_v421.z.number()
|
|
3691
3843
|
})
|
|
3692
3844
|
])
|
|
3693
3845
|
)
|
|
3694
3846
|
})
|
|
3695
3847
|
)
|
|
3696
3848
|
}),
|
|
3697
|
-
|
|
3698
|
-
type:
|
|
3699
|
-
id:
|
|
3700
|
-
status:
|
|
3701
|
-
action:
|
|
3702
|
-
|
|
3703
|
-
type:
|
|
3704
|
-
query:
|
|
3705
|
-
sources:
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
type:
|
|
3710
|
-
name:
|
|
3849
|
+
import_v421.z.object({
|
|
3850
|
+
type: import_v421.z.literal("web_search_call"),
|
|
3851
|
+
id: import_v421.z.string(),
|
|
3852
|
+
status: import_v421.z.string(),
|
|
3853
|
+
action: import_v421.z.discriminatedUnion("type", [
|
|
3854
|
+
import_v421.z.object({
|
|
3855
|
+
type: import_v421.z.literal("search"),
|
|
3856
|
+
query: import_v421.z.string().nullish(),
|
|
3857
|
+
sources: import_v421.z.array(
|
|
3858
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3859
|
+
import_v421.z.object({ type: import_v421.z.literal("url"), url: import_v421.z.string() }),
|
|
3860
|
+
import_v421.z.object({
|
|
3861
|
+
type: import_v421.z.literal("api"),
|
|
3862
|
+
name: import_v421.z.string()
|
|
3711
3863
|
})
|
|
3712
3864
|
])
|
|
3713
3865
|
).nullish()
|
|
3714
3866
|
}),
|
|
3715
|
-
|
|
3716
|
-
type:
|
|
3717
|
-
url:
|
|
3867
|
+
import_v421.z.object({
|
|
3868
|
+
type: import_v421.z.literal("open_page"),
|
|
3869
|
+
url: import_v421.z.string().nullish()
|
|
3718
3870
|
}),
|
|
3719
|
-
|
|
3720
|
-
type:
|
|
3721
|
-
url:
|
|
3722
|
-
pattern:
|
|
3871
|
+
import_v421.z.object({
|
|
3872
|
+
type: import_v421.z.literal("find_in_page"),
|
|
3873
|
+
url: import_v421.z.string().nullish(),
|
|
3874
|
+
pattern: import_v421.z.string().nullish()
|
|
3723
3875
|
})
|
|
3724
3876
|
]).nullish()
|
|
3725
3877
|
}),
|
|
3726
|
-
|
|
3727
|
-
type:
|
|
3728
|
-
id:
|
|
3729
|
-
queries:
|
|
3730
|
-
results:
|
|
3731
|
-
|
|
3732
|
-
attributes:
|
|
3733
|
-
|
|
3734
|
-
|
|
3878
|
+
import_v421.z.object({
|
|
3879
|
+
type: import_v421.z.literal("file_search_call"),
|
|
3880
|
+
id: import_v421.z.string(),
|
|
3881
|
+
queries: import_v421.z.array(import_v421.z.string()),
|
|
3882
|
+
results: import_v421.z.array(
|
|
3883
|
+
import_v421.z.object({
|
|
3884
|
+
attributes: import_v421.z.record(
|
|
3885
|
+
import_v421.z.string(),
|
|
3886
|
+
import_v421.z.union([import_v421.z.string(), import_v421.z.number(), import_v421.z.boolean()])
|
|
3735
3887
|
),
|
|
3736
|
-
file_id:
|
|
3737
|
-
filename:
|
|
3738
|
-
score:
|
|
3739
|
-
text:
|
|
3888
|
+
file_id: import_v421.z.string(),
|
|
3889
|
+
filename: import_v421.z.string(),
|
|
3890
|
+
score: import_v421.z.number(),
|
|
3891
|
+
text: import_v421.z.string()
|
|
3740
3892
|
})
|
|
3741
3893
|
).nullish()
|
|
3742
3894
|
}),
|
|
3743
|
-
|
|
3744
|
-
type:
|
|
3745
|
-
id:
|
|
3746
|
-
code:
|
|
3747
|
-
container_id:
|
|
3748
|
-
outputs:
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3895
|
+
import_v421.z.object({
|
|
3896
|
+
type: import_v421.z.literal("code_interpreter_call"),
|
|
3897
|
+
id: import_v421.z.string(),
|
|
3898
|
+
code: import_v421.z.string().nullable(),
|
|
3899
|
+
container_id: import_v421.z.string(),
|
|
3900
|
+
outputs: import_v421.z.array(
|
|
3901
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3902
|
+
import_v421.z.object({ type: import_v421.z.literal("logs"), logs: import_v421.z.string() }),
|
|
3903
|
+
import_v421.z.object({ type: import_v421.z.literal("image"), url: import_v421.z.string() })
|
|
3752
3904
|
])
|
|
3753
3905
|
).nullable()
|
|
3754
3906
|
}),
|
|
3755
|
-
|
|
3756
|
-
type:
|
|
3757
|
-
id:
|
|
3758
|
-
result:
|
|
3907
|
+
import_v421.z.object({
|
|
3908
|
+
type: import_v421.z.literal("image_generation_call"),
|
|
3909
|
+
id: import_v421.z.string(),
|
|
3910
|
+
result: import_v421.z.string()
|
|
3759
3911
|
}),
|
|
3760
|
-
|
|
3761
|
-
type:
|
|
3762
|
-
id:
|
|
3763
|
-
call_id:
|
|
3764
|
-
action:
|
|
3765
|
-
type:
|
|
3766
|
-
command:
|
|
3767
|
-
timeout_ms:
|
|
3768
|
-
user:
|
|
3769
|
-
working_directory:
|
|
3770
|
-
env:
|
|
3912
|
+
import_v421.z.object({
|
|
3913
|
+
type: import_v421.z.literal("local_shell_call"),
|
|
3914
|
+
id: import_v421.z.string(),
|
|
3915
|
+
call_id: import_v421.z.string(),
|
|
3916
|
+
action: import_v421.z.object({
|
|
3917
|
+
type: import_v421.z.literal("exec"),
|
|
3918
|
+
command: import_v421.z.array(import_v421.z.string()),
|
|
3919
|
+
timeout_ms: import_v421.z.number().optional(),
|
|
3920
|
+
user: import_v421.z.string().optional(),
|
|
3921
|
+
working_directory: import_v421.z.string().optional(),
|
|
3922
|
+
env: import_v421.z.record(import_v421.z.string(), import_v421.z.string()).optional()
|
|
3771
3923
|
})
|
|
3772
3924
|
}),
|
|
3773
|
-
|
|
3774
|
-
type:
|
|
3775
|
-
call_id:
|
|
3776
|
-
name:
|
|
3777
|
-
arguments:
|
|
3778
|
-
id:
|
|
3925
|
+
import_v421.z.object({
|
|
3926
|
+
type: import_v421.z.literal("function_call"),
|
|
3927
|
+
call_id: import_v421.z.string(),
|
|
3928
|
+
name: import_v421.z.string(),
|
|
3929
|
+
arguments: import_v421.z.string(),
|
|
3930
|
+
id: import_v421.z.string()
|
|
3779
3931
|
}),
|
|
3780
|
-
|
|
3781
|
-
type:
|
|
3782
|
-
call_id:
|
|
3783
|
-
name:
|
|
3784
|
-
input:
|
|
3785
|
-
id:
|
|
3932
|
+
import_v421.z.object({
|
|
3933
|
+
type: import_v421.z.literal("custom_tool_call"),
|
|
3934
|
+
call_id: import_v421.z.string(),
|
|
3935
|
+
name: import_v421.z.string(),
|
|
3936
|
+
input: import_v421.z.string(),
|
|
3937
|
+
id: import_v421.z.string()
|
|
3786
3938
|
}),
|
|
3787
|
-
|
|
3788
|
-
type:
|
|
3789
|
-
id:
|
|
3790
|
-
status:
|
|
3939
|
+
import_v421.z.object({
|
|
3940
|
+
type: import_v421.z.literal("computer_call"),
|
|
3941
|
+
id: import_v421.z.string(),
|
|
3942
|
+
status: import_v421.z.string().optional()
|
|
3791
3943
|
}),
|
|
3792
|
-
|
|
3793
|
-
type:
|
|
3794
|
-
id:
|
|
3795
|
-
encrypted_content:
|
|
3796
|
-
summary:
|
|
3797
|
-
|
|
3798
|
-
type:
|
|
3799
|
-
text:
|
|
3944
|
+
import_v421.z.object({
|
|
3945
|
+
type: import_v421.z.literal("reasoning"),
|
|
3946
|
+
id: import_v421.z.string(),
|
|
3947
|
+
encrypted_content: import_v421.z.string().nullish(),
|
|
3948
|
+
summary: import_v421.z.array(
|
|
3949
|
+
import_v421.z.object({
|
|
3950
|
+
type: import_v421.z.literal("summary_text"),
|
|
3951
|
+
text: import_v421.z.string()
|
|
3800
3952
|
})
|
|
3801
3953
|
)
|
|
3802
3954
|
}),
|
|
3803
|
-
|
|
3804
|
-
type:
|
|
3805
|
-
id:
|
|
3806
|
-
status:
|
|
3807
|
-
arguments:
|
|
3808
|
-
name:
|
|
3809
|
-
server_label:
|
|
3810
|
-
output:
|
|
3811
|
-
error:
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
type:
|
|
3815
|
-
code:
|
|
3816
|
-
message:
|
|
3955
|
+
import_v421.z.object({
|
|
3956
|
+
type: import_v421.z.literal("mcp_call"),
|
|
3957
|
+
id: import_v421.z.string(),
|
|
3958
|
+
status: import_v421.z.string(),
|
|
3959
|
+
arguments: import_v421.z.string(),
|
|
3960
|
+
name: import_v421.z.string(),
|
|
3961
|
+
server_label: import_v421.z.string(),
|
|
3962
|
+
output: import_v421.z.string().nullish(),
|
|
3963
|
+
error: import_v421.z.union([
|
|
3964
|
+
import_v421.z.string(),
|
|
3965
|
+
import_v421.z.object({
|
|
3966
|
+
type: import_v421.z.string().optional(),
|
|
3967
|
+
code: import_v421.z.union([import_v421.z.number(), import_v421.z.string()]).optional(),
|
|
3968
|
+
message: import_v421.z.string().optional()
|
|
3817
3969
|
}).loose()
|
|
3818
3970
|
]).nullish(),
|
|
3819
|
-
approval_request_id:
|
|
3971
|
+
approval_request_id: import_v421.z.string().nullish()
|
|
3820
3972
|
}),
|
|
3821
|
-
|
|
3822
|
-
type:
|
|
3823
|
-
id:
|
|
3824
|
-
server_label:
|
|
3825
|
-
tools:
|
|
3826
|
-
|
|
3827
|
-
name:
|
|
3828
|
-
description:
|
|
3829
|
-
input_schema:
|
|
3830
|
-
annotations:
|
|
3973
|
+
import_v421.z.object({
|
|
3974
|
+
type: import_v421.z.literal("mcp_list_tools"),
|
|
3975
|
+
id: import_v421.z.string(),
|
|
3976
|
+
server_label: import_v421.z.string(),
|
|
3977
|
+
tools: import_v421.z.array(
|
|
3978
|
+
import_v421.z.object({
|
|
3979
|
+
name: import_v421.z.string(),
|
|
3980
|
+
description: import_v421.z.string().optional(),
|
|
3981
|
+
input_schema: import_v421.z.any(),
|
|
3982
|
+
annotations: import_v421.z.record(import_v421.z.string(), import_v421.z.unknown()).optional()
|
|
3831
3983
|
})
|
|
3832
3984
|
),
|
|
3833
|
-
error:
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
type:
|
|
3837
|
-
code:
|
|
3838
|
-
message:
|
|
3985
|
+
error: import_v421.z.union([
|
|
3986
|
+
import_v421.z.string(),
|
|
3987
|
+
import_v421.z.object({
|
|
3988
|
+
type: import_v421.z.string().optional(),
|
|
3989
|
+
code: import_v421.z.union([import_v421.z.number(), import_v421.z.string()]).optional(),
|
|
3990
|
+
message: import_v421.z.string().optional()
|
|
3839
3991
|
}).loose()
|
|
3840
3992
|
]).optional()
|
|
3841
3993
|
}),
|
|
3842
|
-
|
|
3843
|
-
type:
|
|
3844
|
-
id:
|
|
3845
|
-
server_label:
|
|
3846
|
-
name:
|
|
3847
|
-
arguments:
|
|
3848
|
-
approval_request_id:
|
|
3994
|
+
import_v421.z.object({
|
|
3995
|
+
type: import_v421.z.literal("mcp_approval_request"),
|
|
3996
|
+
id: import_v421.z.string(),
|
|
3997
|
+
server_label: import_v421.z.string(),
|
|
3998
|
+
name: import_v421.z.string(),
|
|
3999
|
+
arguments: import_v421.z.string(),
|
|
4000
|
+
approval_request_id: import_v421.z.string().optional()
|
|
3849
4001
|
}),
|
|
3850
|
-
|
|
3851
|
-
type:
|
|
3852
|
-
id:
|
|
3853
|
-
call_id:
|
|
3854
|
-
status:
|
|
3855
|
-
operation:
|
|
3856
|
-
|
|
3857
|
-
type:
|
|
3858
|
-
path:
|
|
3859
|
-
diff:
|
|
4002
|
+
import_v421.z.object({
|
|
4003
|
+
type: import_v421.z.literal("apply_patch_call"),
|
|
4004
|
+
id: import_v421.z.string(),
|
|
4005
|
+
call_id: import_v421.z.string(),
|
|
4006
|
+
status: import_v421.z.enum(["in_progress", "completed"]),
|
|
4007
|
+
operation: import_v421.z.discriminatedUnion("type", [
|
|
4008
|
+
import_v421.z.object({
|
|
4009
|
+
type: import_v421.z.literal("create_file"),
|
|
4010
|
+
path: import_v421.z.string(),
|
|
4011
|
+
diff: import_v421.z.string()
|
|
3860
4012
|
}),
|
|
3861
|
-
|
|
3862
|
-
type:
|
|
3863
|
-
path:
|
|
4013
|
+
import_v421.z.object({
|
|
4014
|
+
type: import_v421.z.literal("delete_file"),
|
|
4015
|
+
path: import_v421.z.string()
|
|
3864
4016
|
}),
|
|
3865
|
-
|
|
3866
|
-
type:
|
|
3867
|
-
path:
|
|
3868
|
-
diff:
|
|
4017
|
+
import_v421.z.object({
|
|
4018
|
+
type: import_v421.z.literal("update_file"),
|
|
4019
|
+
path: import_v421.z.string(),
|
|
4020
|
+
diff: import_v421.z.string()
|
|
3869
4021
|
})
|
|
3870
4022
|
])
|
|
3871
4023
|
}),
|
|
3872
|
-
|
|
3873
|
-
type:
|
|
3874
|
-
id:
|
|
3875
|
-
call_id:
|
|
3876
|
-
status:
|
|
3877
|
-
action:
|
|
3878
|
-
commands:
|
|
4024
|
+
import_v421.z.object({
|
|
4025
|
+
type: import_v421.z.literal("shell_call"),
|
|
4026
|
+
id: import_v421.z.string(),
|
|
4027
|
+
call_id: import_v421.z.string(),
|
|
4028
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4029
|
+
action: import_v421.z.object({
|
|
4030
|
+
commands: import_v421.z.array(import_v421.z.string())
|
|
3879
4031
|
})
|
|
3880
4032
|
}),
|
|
3881
|
-
|
|
3882
|
-
type:
|
|
3883
|
-
id:
|
|
3884
|
-
call_id:
|
|
3885
|
-
status:
|
|
3886
|
-
output:
|
|
3887
|
-
|
|
3888
|
-
stdout:
|
|
3889
|
-
stderr:
|
|
3890
|
-
outcome:
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
type:
|
|
3894
|
-
exit_code:
|
|
4033
|
+
import_v421.z.object({
|
|
4034
|
+
type: import_v421.z.literal("shell_call_output"),
|
|
4035
|
+
id: import_v421.z.string(),
|
|
4036
|
+
call_id: import_v421.z.string(),
|
|
4037
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4038
|
+
output: import_v421.z.array(
|
|
4039
|
+
import_v421.z.object({
|
|
4040
|
+
stdout: import_v421.z.string(),
|
|
4041
|
+
stderr: import_v421.z.string(),
|
|
4042
|
+
outcome: import_v421.z.discriminatedUnion("type", [
|
|
4043
|
+
import_v421.z.object({ type: import_v421.z.literal("timeout") }),
|
|
4044
|
+
import_v421.z.object({
|
|
4045
|
+
type: import_v421.z.literal("exit"),
|
|
4046
|
+
exit_code: import_v421.z.number()
|
|
3895
4047
|
})
|
|
3896
4048
|
])
|
|
3897
4049
|
})
|
|
3898
4050
|
)
|
|
4051
|
+
}),
|
|
4052
|
+
import_v421.z.object({
|
|
4053
|
+
type: import_v421.z.literal("tool_search_call"),
|
|
4054
|
+
id: import_v421.z.string(),
|
|
4055
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
4056
|
+
call_id: import_v421.z.string().nullable(),
|
|
4057
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4058
|
+
arguments: import_v421.z.unknown()
|
|
4059
|
+
}),
|
|
4060
|
+
import_v421.z.object({
|
|
4061
|
+
type: import_v421.z.literal("tool_search_output"),
|
|
4062
|
+
id: import_v421.z.string(),
|
|
4063
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
4064
|
+
call_id: import_v421.z.string().nullable(),
|
|
4065
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4066
|
+
tools: import_v421.z.array(import_v421.z.record(import_v421.z.string(), jsonValueSchema2.optional()))
|
|
3899
4067
|
})
|
|
3900
4068
|
])
|
|
3901
4069
|
).optional(),
|
|
3902
|
-
service_tier:
|
|
3903
|
-
incomplete_details:
|
|
3904
|
-
usage:
|
|
3905
|
-
input_tokens:
|
|
3906
|
-
input_tokens_details:
|
|
3907
|
-
output_tokens:
|
|
3908
|
-
output_tokens_details:
|
|
4070
|
+
service_tier: import_v421.z.string().nullish(),
|
|
4071
|
+
incomplete_details: import_v421.z.object({ reason: import_v421.z.string() }).nullish(),
|
|
4072
|
+
usage: import_v421.z.object({
|
|
4073
|
+
input_tokens: import_v421.z.number(),
|
|
4074
|
+
input_tokens_details: import_v421.z.object({ cached_tokens: import_v421.z.number().nullish() }).nullish(),
|
|
4075
|
+
output_tokens: import_v421.z.number(),
|
|
4076
|
+
output_tokens_details: import_v421.z.object({ reasoning_tokens: import_v421.z.number().nullish() }).nullish()
|
|
3909
4077
|
}).optional()
|
|
3910
4078
|
})
|
|
3911
4079
|
)
|
|
3912
4080
|
);
|
|
3913
4081
|
|
|
3914
4082
|
// src/responses/openai-responses-options.ts
|
|
3915
|
-
var
|
|
3916
|
-
var
|
|
4083
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
4084
|
+
var import_v422 = require("zod/v4");
|
|
3917
4085
|
var TOP_LOGPROBS_MAX = 20;
|
|
3918
4086
|
var openaiResponsesReasoningModelIds = [
|
|
3919
4087
|
"o1",
|
|
@@ -3942,11 +4110,12 @@ var openaiResponsesReasoningModelIds = [
|
|
|
3942
4110
|
"gpt-5.2-chat-latest",
|
|
3943
4111
|
"gpt-5.2-pro",
|
|
3944
4112
|
"gpt-5.2-codex",
|
|
4113
|
+
"gpt-5.3-chat-latest",
|
|
4114
|
+
"gpt-5.3-codex",
|
|
3945
4115
|
"gpt-5.4",
|
|
3946
4116
|
"gpt-5.4-2026-03-05",
|
|
3947
4117
|
"gpt-5.4-pro",
|
|
3948
|
-
"gpt-5.4-pro-2026-03-05"
|
|
3949
|
-
"gpt-5.3-codex"
|
|
4118
|
+
"gpt-5.4-pro-2026-03-05"
|
|
3950
4119
|
];
|
|
3951
4120
|
var openaiResponsesModelIds = [
|
|
3952
4121
|
"gpt-4.1",
|
|
@@ -3973,9 +4142,9 @@ var openaiResponsesModelIds = [
|
|
|
3973
4142
|
"gpt-5-chat-latest",
|
|
3974
4143
|
...openaiResponsesReasoningModelIds
|
|
3975
4144
|
];
|
|
3976
|
-
var openaiLanguageModelResponsesOptionsSchema = (0,
|
|
3977
|
-
() => (0,
|
|
3978
|
-
|
|
4145
|
+
var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazySchema)(
|
|
4146
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
4147
|
+
import_v422.z.object({
|
|
3979
4148
|
/**
|
|
3980
4149
|
* The ID of the OpenAI Conversation to continue.
|
|
3981
4150
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -3983,13 +4152,13 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
3983
4152
|
* Defaults to `undefined`.
|
|
3984
4153
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3985
4154
|
*/
|
|
3986
|
-
conversation:
|
|
4155
|
+
conversation: import_v422.z.string().nullish(),
|
|
3987
4156
|
/**
|
|
3988
4157
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
3989
4158
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
3990
4159
|
*/
|
|
3991
|
-
include:
|
|
3992
|
-
|
|
4160
|
+
include: import_v422.z.array(
|
|
4161
|
+
import_v422.z.enum([
|
|
3993
4162
|
"reasoning.encrypted_content",
|
|
3994
4163
|
// handled internally by default, only needed for unknown reasoning models
|
|
3995
4164
|
"file_search_call.results",
|
|
@@ -4001,7 +4170,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4001
4170
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
4002
4171
|
* Defaults to `undefined`.
|
|
4003
4172
|
*/
|
|
4004
|
-
instructions:
|
|
4173
|
+
instructions: import_v422.z.string().nullish(),
|
|
4005
4174
|
/**
|
|
4006
4175
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
4007
4176
|
* the response size and can slow down response times. However, it can
|
|
@@ -4016,30 +4185,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4016
4185
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
4017
4186
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
4018
4187
|
*/
|
|
4019
|
-
logprobs:
|
|
4188
|
+
logprobs: import_v422.z.union([import_v422.z.boolean(), import_v422.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
4020
4189
|
/**
|
|
4021
4190
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
4022
4191
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
4023
4192
|
* Any further attempts to call a tool by the model will be ignored.
|
|
4024
4193
|
*/
|
|
4025
|
-
maxToolCalls:
|
|
4194
|
+
maxToolCalls: import_v422.z.number().nullish(),
|
|
4026
4195
|
/**
|
|
4027
4196
|
* Additional metadata to store with the generation.
|
|
4028
4197
|
*/
|
|
4029
|
-
metadata:
|
|
4198
|
+
metadata: import_v422.z.any().nullish(),
|
|
4030
4199
|
/**
|
|
4031
4200
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
4032
4201
|
*/
|
|
4033
|
-
parallelToolCalls:
|
|
4202
|
+
parallelToolCalls: import_v422.z.boolean().nullish(),
|
|
4034
4203
|
/**
|
|
4035
4204
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
4036
4205
|
* Defaults to `undefined`.
|
|
4037
4206
|
*/
|
|
4038
|
-
previousResponseId:
|
|
4207
|
+
previousResponseId: import_v422.z.string().nullish(),
|
|
4039
4208
|
/**
|
|
4040
4209
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
4041
4210
|
*/
|
|
4042
|
-
promptCacheKey:
|
|
4211
|
+
promptCacheKey: import_v422.z.string().nullish(),
|
|
4043
4212
|
/**
|
|
4044
4213
|
* The retention policy for the prompt cache.
|
|
4045
4214
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -4048,7 +4217,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4048
4217
|
*
|
|
4049
4218
|
* @default 'in_memory'
|
|
4050
4219
|
*/
|
|
4051
|
-
promptCacheRetention:
|
|
4220
|
+
promptCacheRetention: import_v422.z.enum(["in_memory", "24h"]).nullish(),
|
|
4052
4221
|
/**
|
|
4053
4222
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
4054
4223
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -4059,17 +4228,17 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4059
4228
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
4060
4229
|
* an error.
|
|
4061
4230
|
*/
|
|
4062
|
-
reasoningEffort:
|
|
4231
|
+
reasoningEffort: import_v422.z.string().nullish(),
|
|
4063
4232
|
/**
|
|
4064
4233
|
* Controls reasoning summary output from the model.
|
|
4065
4234
|
* Set to "auto" to automatically receive the richest level available,
|
|
4066
4235
|
* or "detailed" for comprehensive summaries.
|
|
4067
4236
|
*/
|
|
4068
|
-
reasoningSummary:
|
|
4237
|
+
reasoningSummary: import_v422.z.string().nullish(),
|
|
4069
4238
|
/**
|
|
4070
4239
|
* The identifier for safety monitoring and tracking.
|
|
4071
4240
|
*/
|
|
4072
|
-
safetyIdentifier:
|
|
4241
|
+
safetyIdentifier: import_v422.z.string().nullish(),
|
|
4073
4242
|
/**
|
|
4074
4243
|
* Service tier for the request.
|
|
4075
4244
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -4077,34 +4246,34 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4077
4246
|
*
|
|
4078
4247
|
* Defaults to 'auto'.
|
|
4079
4248
|
*/
|
|
4080
|
-
serviceTier:
|
|
4249
|
+
serviceTier: import_v422.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
4081
4250
|
/**
|
|
4082
4251
|
* Whether to store the generation. Defaults to `true`.
|
|
4083
4252
|
*/
|
|
4084
|
-
store:
|
|
4253
|
+
store: import_v422.z.boolean().nullish(),
|
|
4085
4254
|
/**
|
|
4086
4255
|
* Whether to use strict JSON schema validation.
|
|
4087
4256
|
* Defaults to `true`.
|
|
4088
4257
|
*/
|
|
4089
|
-
strictJsonSchema:
|
|
4258
|
+
strictJsonSchema: import_v422.z.boolean().nullish(),
|
|
4090
4259
|
/**
|
|
4091
4260
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
4092
4261
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
4093
4262
|
* Valid values: 'low', 'medium', 'high'.
|
|
4094
4263
|
*/
|
|
4095
|
-
textVerbosity:
|
|
4264
|
+
textVerbosity: import_v422.z.enum(["low", "medium", "high"]).nullish(),
|
|
4096
4265
|
/**
|
|
4097
4266
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
4098
4267
|
* 'disabled' turns truncation off.
|
|
4099
4268
|
*/
|
|
4100
|
-
truncation:
|
|
4269
|
+
truncation: import_v422.z.enum(["auto", "disabled"]).nullish(),
|
|
4101
4270
|
/**
|
|
4102
4271
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
4103
4272
|
* monitor and detect abuse.
|
|
4104
4273
|
* Defaults to `undefined`.
|
|
4105
4274
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
4106
4275
|
*/
|
|
4107
|
-
user:
|
|
4276
|
+
user: import_v422.z.string().nullish(),
|
|
4108
4277
|
/**
|
|
4109
4278
|
* Override the system message mode for this model.
|
|
4110
4279
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -4113,7 +4282,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4113
4282
|
*
|
|
4114
4283
|
* If not specified, the mode is automatically determined based on the model.
|
|
4115
4284
|
*/
|
|
4116
|
-
systemMessageMode:
|
|
4285
|
+
systemMessageMode: import_v422.z.enum(["system", "developer", "remove"]).optional(),
|
|
4117
4286
|
/**
|
|
4118
4287
|
* Force treating this model as a reasoning model.
|
|
4119
4288
|
*
|
|
@@ -4123,21 +4292,21 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4123
4292
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4124
4293
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4125
4294
|
*/
|
|
4126
|
-
forceReasoning:
|
|
4295
|
+
forceReasoning: import_v422.z.boolean().optional()
|
|
4127
4296
|
})
|
|
4128
4297
|
)
|
|
4129
4298
|
);
|
|
4130
4299
|
|
|
4131
4300
|
// src/responses/openai-responses-prepare-tools.ts
|
|
4132
4301
|
var import_provider7 = require("@ai-sdk/provider");
|
|
4133
|
-
var
|
|
4302
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
4134
4303
|
async function prepareResponsesTools({
|
|
4135
4304
|
tools,
|
|
4136
4305
|
toolChoice,
|
|
4137
4306
|
toolNameMapping,
|
|
4138
4307
|
customProviderToolNames
|
|
4139
4308
|
}) {
|
|
4140
|
-
var _a;
|
|
4309
|
+
var _a, _b;
|
|
4141
4310
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
4142
4311
|
const toolWarnings = [];
|
|
4143
4312
|
if (tools == null) {
|
|
@@ -4147,19 +4316,23 @@ async function prepareResponsesTools({
|
|
|
4147
4316
|
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
4148
4317
|
for (const tool of tools) {
|
|
4149
4318
|
switch (tool.type) {
|
|
4150
|
-
case "function":
|
|
4319
|
+
case "function": {
|
|
4320
|
+
const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
|
|
4321
|
+
const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
|
|
4151
4322
|
openaiTools2.push({
|
|
4152
4323
|
type: "function",
|
|
4153
4324
|
name: tool.name,
|
|
4154
4325
|
description: tool.description,
|
|
4155
4326
|
parameters: tool.inputSchema,
|
|
4156
|
-
...tool.strict != null ? { strict: tool.strict } : {}
|
|
4327
|
+
...tool.strict != null ? { strict: tool.strict } : {},
|
|
4328
|
+
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
4157
4329
|
});
|
|
4158
4330
|
break;
|
|
4331
|
+
}
|
|
4159
4332
|
case "provider": {
|
|
4160
4333
|
switch (tool.id) {
|
|
4161
4334
|
case "openai.file_search": {
|
|
4162
|
-
const args = await (0,
|
|
4335
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4163
4336
|
value: tool.args,
|
|
4164
4337
|
schema: fileSearchArgsSchema
|
|
4165
4338
|
});
|
|
@@ -4182,7 +4355,7 @@ async function prepareResponsesTools({
|
|
|
4182
4355
|
break;
|
|
4183
4356
|
}
|
|
4184
4357
|
case "openai.shell": {
|
|
4185
|
-
const args = await (0,
|
|
4358
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4186
4359
|
value: tool.args,
|
|
4187
4360
|
schema: shellArgsSchema
|
|
4188
4361
|
});
|
|
@@ -4201,7 +4374,7 @@ async function prepareResponsesTools({
|
|
|
4201
4374
|
break;
|
|
4202
4375
|
}
|
|
4203
4376
|
case "openai.web_search_preview": {
|
|
4204
|
-
const args = await (0,
|
|
4377
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4205
4378
|
value: tool.args,
|
|
4206
4379
|
schema: webSearchPreviewArgsSchema
|
|
4207
4380
|
});
|
|
@@ -4213,7 +4386,7 @@ async function prepareResponsesTools({
|
|
|
4213
4386
|
break;
|
|
4214
4387
|
}
|
|
4215
4388
|
case "openai.web_search": {
|
|
4216
|
-
const args = await (0,
|
|
4389
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4217
4390
|
value: tool.args,
|
|
4218
4391
|
schema: webSearchArgsSchema
|
|
4219
4392
|
});
|
|
@@ -4227,7 +4400,7 @@ async function prepareResponsesTools({
|
|
|
4227
4400
|
break;
|
|
4228
4401
|
}
|
|
4229
4402
|
case "openai.code_interpreter": {
|
|
4230
|
-
const args = await (0,
|
|
4403
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4231
4404
|
value: tool.args,
|
|
4232
4405
|
schema: codeInterpreterArgsSchema
|
|
4233
4406
|
});
|
|
@@ -4238,7 +4411,7 @@ async function prepareResponsesTools({
|
|
|
4238
4411
|
break;
|
|
4239
4412
|
}
|
|
4240
4413
|
case "openai.image_generation": {
|
|
4241
|
-
const args = await (0,
|
|
4414
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4242
4415
|
value: tool.args,
|
|
4243
4416
|
schema: imageGenerationArgsSchema
|
|
4244
4417
|
});
|
|
@@ -4261,7 +4434,7 @@ async function prepareResponsesTools({
|
|
|
4261
4434
|
break;
|
|
4262
4435
|
}
|
|
4263
4436
|
case "openai.mcp": {
|
|
4264
|
-
const args = await (0,
|
|
4437
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4265
4438
|
value: tool.args,
|
|
4266
4439
|
schema: mcpArgsSchema
|
|
4267
4440
|
});
|
|
@@ -4287,17 +4460,30 @@ async function prepareResponsesTools({
|
|
|
4287
4460
|
break;
|
|
4288
4461
|
}
|
|
4289
4462
|
case "openai.custom": {
|
|
4290
|
-
const args = await (0,
|
|
4463
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4291
4464
|
value: tool.args,
|
|
4292
4465
|
schema: customArgsSchema
|
|
4293
4466
|
});
|
|
4294
4467
|
openaiTools2.push({
|
|
4295
4468
|
type: "custom",
|
|
4296
|
-
name:
|
|
4469
|
+
name: tool.name,
|
|
4297
4470
|
description: args.description,
|
|
4298
4471
|
format: args.format
|
|
4299
4472
|
});
|
|
4300
|
-
resolvedCustomProviderToolNames.add(
|
|
4473
|
+
resolvedCustomProviderToolNames.add(tool.name);
|
|
4474
|
+
break;
|
|
4475
|
+
}
|
|
4476
|
+
case "openai.tool_search": {
|
|
4477
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4478
|
+
value: tool.args,
|
|
4479
|
+
schema: toolSearchArgsSchema
|
|
4480
|
+
});
|
|
4481
|
+
openaiTools2.push({
|
|
4482
|
+
type: "tool_search",
|
|
4483
|
+
...args.execution != null ? { execution: args.execution } : {},
|
|
4484
|
+
...args.description != null ? { description: args.description } : {},
|
|
4485
|
+
...args.parameters != null ? { parameters: args.parameters } : {}
|
|
4486
|
+
});
|
|
4301
4487
|
break;
|
|
4302
4488
|
}
|
|
4303
4489
|
}
|
|
@@ -4321,7 +4507,7 @@ async function prepareResponsesTools({
|
|
|
4321
4507
|
case "required":
|
|
4322
4508
|
return { tools: openaiTools2, toolChoice: type, toolWarnings };
|
|
4323
4509
|
case "tool": {
|
|
4324
|
-
const resolvedToolName = (
|
|
4510
|
+
const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
|
|
4325
4511
|
return {
|
|
4326
4512
|
tools: openaiTools2,
|
|
4327
4513
|
toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
|
|
@@ -4401,7 +4587,7 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
|
4401
4587
|
}
|
|
4402
4588
|
var OpenAIResponsesLanguageModel = class {
|
|
4403
4589
|
constructor(modelId, config) {
|
|
4404
|
-
this.specificationVersion = "
|
|
4590
|
+
this.specificationVersion = "v4";
|
|
4405
4591
|
this.supportedUrls = {
|
|
4406
4592
|
"image/*": [/^https?:\/\/.*$/],
|
|
4407
4593
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -4446,13 +4632,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4446
4632
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
4447
4633
|
}
|
|
4448
4634
|
const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
|
|
4449
|
-
let openaiOptions = await (0,
|
|
4635
|
+
let openaiOptions = await (0, import_provider_utils29.parseProviderOptions)({
|
|
4450
4636
|
provider: providerOptionsName,
|
|
4451
4637
|
providerOptions,
|
|
4452
4638
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4453
4639
|
});
|
|
4454
4640
|
if (openaiOptions == null && providerOptionsName !== "openai") {
|
|
4455
|
-
openaiOptions = await (0,
|
|
4641
|
+
openaiOptions = await (0, import_provider_utils29.parseProviderOptions)({
|
|
4456
4642
|
provider: "openai",
|
|
4457
4643
|
providerOptions,
|
|
4458
4644
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
@@ -4466,7 +4652,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4466
4652
|
details: "conversation and previousResponseId cannot be used together"
|
|
4467
4653
|
});
|
|
4468
4654
|
}
|
|
4469
|
-
const toolNameMapping = (0,
|
|
4655
|
+
const toolNameMapping = (0, import_provider_utils29.createToolNameMapping)({
|
|
4470
4656
|
tools,
|
|
4471
4657
|
providerToolNames: {
|
|
4472
4658
|
"openai.code_interpreter": "code_interpreter",
|
|
@@ -4477,9 +4663,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4477
4663
|
"openai.web_search": "web_search",
|
|
4478
4664
|
"openai.web_search_preview": "web_search_preview",
|
|
4479
4665
|
"openai.mcp": "mcp",
|
|
4480
|
-
"openai.apply_patch": "apply_patch"
|
|
4481
|
-
|
|
4482
|
-
|
|
4666
|
+
"openai.apply_patch": "apply_patch",
|
|
4667
|
+
"openai.tool_search": "tool_search"
|
|
4668
|
+
}
|
|
4483
4669
|
});
|
|
4484
4670
|
const customProviderToolNames = /* @__PURE__ */ new Set();
|
|
4485
4671
|
const {
|
|
@@ -4655,7 +4841,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4655
4841
|
};
|
|
4656
4842
|
}
|
|
4657
4843
|
async doGenerate(options) {
|
|
4658
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
4844
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
|
|
4659
4845
|
const {
|
|
4660
4846
|
args: body,
|
|
4661
4847
|
warnings,
|
|
@@ -4673,12 +4859,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4673
4859
|
responseHeaders,
|
|
4674
4860
|
value: response,
|
|
4675
4861
|
rawValue: rawResponse
|
|
4676
|
-
} = await (0,
|
|
4862
|
+
} = await (0, import_provider_utils29.postJsonToApi)({
|
|
4677
4863
|
url,
|
|
4678
|
-
headers: (0,
|
|
4864
|
+
headers: (0, import_provider_utils29.combineHeaders)(this.config.headers(), options.headers),
|
|
4679
4865
|
body,
|
|
4680
4866
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4681
|
-
successfulResponseHandler: (0,
|
|
4867
|
+
successfulResponseHandler: (0, import_provider_utils29.createJsonResponseHandler)(
|
|
4682
4868
|
openaiResponsesResponseSchema
|
|
4683
4869
|
),
|
|
4684
4870
|
abortSignal: options.abortSignal,
|
|
@@ -4698,6 +4884,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4698
4884
|
const content = [];
|
|
4699
4885
|
const logprobs = [];
|
|
4700
4886
|
let hasFunctionCall = false;
|
|
4887
|
+
const hostedToolSearchCallIds = [];
|
|
4701
4888
|
for (const part of response.output) {
|
|
4702
4889
|
switch (part.type) {
|
|
4703
4890
|
case "reasoning": {
|
|
@@ -4736,6 +4923,46 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4736
4923
|
});
|
|
4737
4924
|
break;
|
|
4738
4925
|
}
|
|
4926
|
+
case "tool_search_call": {
|
|
4927
|
+
const toolCallId = (_b = part.call_id) != null ? _b : part.id;
|
|
4928
|
+
const isHosted = part.execution === "server";
|
|
4929
|
+
if (isHosted) {
|
|
4930
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
4931
|
+
}
|
|
4932
|
+
content.push({
|
|
4933
|
+
type: "tool-call",
|
|
4934
|
+
toolCallId,
|
|
4935
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
4936
|
+
input: JSON.stringify({
|
|
4937
|
+
arguments: part.arguments,
|
|
4938
|
+
call_id: part.call_id
|
|
4939
|
+
}),
|
|
4940
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
4941
|
+
providerMetadata: {
|
|
4942
|
+
[providerOptionsName]: {
|
|
4943
|
+
itemId: part.id
|
|
4944
|
+
}
|
|
4945
|
+
}
|
|
4946
|
+
});
|
|
4947
|
+
break;
|
|
4948
|
+
}
|
|
4949
|
+
case "tool_search_output": {
|
|
4950
|
+
const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
|
|
4951
|
+
content.push({
|
|
4952
|
+
type: "tool-result",
|
|
4953
|
+
toolCallId,
|
|
4954
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
4955
|
+
result: {
|
|
4956
|
+
tools: part.tools
|
|
4957
|
+
},
|
|
4958
|
+
providerMetadata: {
|
|
4959
|
+
[providerOptionsName]: {
|
|
4960
|
+
itemId: part.id
|
|
4961
|
+
}
|
|
4962
|
+
}
|
|
4963
|
+
});
|
|
4964
|
+
break;
|
|
4965
|
+
}
|
|
4739
4966
|
case "local_shell_call": {
|
|
4740
4967
|
content.push({
|
|
4741
4968
|
type: "tool-call",
|
|
@@ -4791,7 +5018,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4791
5018
|
}
|
|
4792
5019
|
case "message": {
|
|
4793
5020
|
for (const contentPart of part.content) {
|
|
4794
|
-
if (((
|
|
5021
|
+
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
|
|
4795
5022
|
logprobs.push(contentPart.logprobs);
|
|
4796
5023
|
}
|
|
4797
5024
|
const providerMetadata2 = {
|
|
@@ -4813,7 +5040,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4813
5040
|
content.push({
|
|
4814
5041
|
type: "source",
|
|
4815
5042
|
sourceType: "url",
|
|
4816
|
-
id: (
|
|
5043
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils29.generateId)(),
|
|
4817
5044
|
url: annotation.url,
|
|
4818
5045
|
title: annotation.title
|
|
4819
5046
|
});
|
|
@@ -4821,7 +5048,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4821
5048
|
content.push({
|
|
4822
5049
|
type: "source",
|
|
4823
5050
|
sourceType: "document",
|
|
4824
|
-
id: (
|
|
5051
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils29.generateId)(),
|
|
4825
5052
|
mediaType: "text/plain",
|
|
4826
5053
|
title: annotation.filename,
|
|
4827
5054
|
filename: annotation.filename,
|
|
@@ -4837,7 +5064,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4837
5064
|
content.push({
|
|
4838
5065
|
type: "source",
|
|
4839
5066
|
sourceType: "document",
|
|
4840
|
-
id: (
|
|
5067
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils29.generateId)(),
|
|
4841
5068
|
mediaType: "text/plain",
|
|
4842
5069
|
title: annotation.filename,
|
|
4843
5070
|
filename: annotation.filename,
|
|
@@ -4853,7 +5080,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4853
5080
|
content.push({
|
|
4854
5081
|
type: "source",
|
|
4855
5082
|
sourceType: "document",
|
|
4856
|
-
id: (
|
|
5083
|
+
id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils29.generateId)(),
|
|
4857
5084
|
mediaType: "application/octet-stream",
|
|
4858
5085
|
title: annotation.file_id,
|
|
4859
5086
|
filename: annotation.file_id,
|
|
@@ -4922,7 +5149,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4922
5149
|
break;
|
|
4923
5150
|
}
|
|
4924
5151
|
case "mcp_call": {
|
|
4925
|
-
const toolCallId = part.approval_request_id != null ? (
|
|
5152
|
+
const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
|
|
4926
5153
|
const toolName = `mcp.${part.name}`;
|
|
4927
5154
|
content.push({
|
|
4928
5155
|
type: "tool-call",
|
|
@@ -4956,8 +5183,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4956
5183
|
break;
|
|
4957
5184
|
}
|
|
4958
5185
|
case "mcp_approval_request": {
|
|
4959
|
-
const approvalRequestId = (
|
|
4960
|
-
const dummyToolCallId = (
|
|
5186
|
+
const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
|
|
5187
|
+
const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils29.generateId)();
|
|
4961
5188
|
const toolName = `mcp.${part.name}`;
|
|
4962
5189
|
content.push({
|
|
4963
5190
|
type: "tool-call",
|
|
@@ -5007,13 +5234,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5007
5234
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5008
5235
|
result: {
|
|
5009
5236
|
queries: part.queries,
|
|
5010
|
-
results: (
|
|
5237
|
+
results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
|
|
5011
5238
|
attributes: result.attributes,
|
|
5012
5239
|
fileId: result.file_id,
|
|
5013
5240
|
filename: result.filename,
|
|
5014
5241
|
score: result.score,
|
|
5015
5242
|
text: result.text
|
|
5016
|
-
}))) != null ?
|
|
5243
|
+
}))) != null ? _y : null
|
|
5017
5244
|
}
|
|
5018
5245
|
});
|
|
5019
5246
|
break;
|
|
@@ -5070,10 +5297,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5070
5297
|
content,
|
|
5071
5298
|
finishReason: {
|
|
5072
5299
|
unified: mapOpenAIResponseFinishReason({
|
|
5073
|
-
finishReason: (
|
|
5300
|
+
finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
|
|
5074
5301
|
hasFunctionCall
|
|
5075
5302
|
}),
|
|
5076
|
-
raw: (
|
|
5303
|
+
raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
|
|
5077
5304
|
},
|
|
5078
5305
|
usage: convertOpenAIResponsesUsage(usage),
|
|
5079
5306
|
request: { body },
|
|
@@ -5098,18 +5325,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5098
5325
|
providerOptionsName,
|
|
5099
5326
|
isShellProviderExecuted
|
|
5100
5327
|
} = await this.getArgs(options);
|
|
5101
|
-
const { responseHeaders, value: response } = await (0,
|
|
5328
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils29.postJsonToApi)({
|
|
5102
5329
|
url: this.config.url({
|
|
5103
5330
|
path: "/responses",
|
|
5104
5331
|
modelId: this.modelId
|
|
5105
5332
|
}),
|
|
5106
|
-
headers: (0,
|
|
5333
|
+
headers: (0, import_provider_utils29.combineHeaders)(this.config.headers(), options.headers),
|
|
5107
5334
|
body: {
|
|
5108
5335
|
...body,
|
|
5109
5336
|
stream: true
|
|
5110
5337
|
},
|
|
5111
5338
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
5112
|
-
successfulResponseHandler: (0,
|
|
5339
|
+
successfulResponseHandler: (0, import_provider_utils29.createEventSourceResponseHandler)(
|
|
5113
5340
|
openaiResponsesChunkSchema
|
|
5114
5341
|
),
|
|
5115
5342
|
abortSignal: options.abortSignal,
|
|
@@ -5131,6 +5358,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5131
5358
|
let hasFunctionCall = false;
|
|
5132
5359
|
const activeReasoning = {};
|
|
5133
5360
|
let serviceTier;
|
|
5361
|
+
const hostedToolSearchCallIds = [];
|
|
5134
5362
|
return {
|
|
5135
5363
|
stream: response.pipeThrough(
|
|
5136
5364
|
new TransformStream({
|
|
@@ -5138,7 +5366,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5138
5366
|
controller.enqueue({ type: "stream-start", warnings });
|
|
5139
5367
|
},
|
|
5140
5368
|
transform(chunk, controller) {
|
|
5141
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
5369
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J;
|
|
5142
5370
|
if (options.includeRawChunks) {
|
|
5143
5371
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
5144
5372
|
}
|
|
@@ -5246,6 +5474,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5246
5474
|
input: "{}",
|
|
5247
5475
|
providerExecuted: true
|
|
5248
5476
|
});
|
|
5477
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5478
|
+
const toolCallId = value.item.id;
|
|
5479
|
+
const toolName = toolNameMapping.toCustomToolName("tool_search");
|
|
5480
|
+
const isHosted = value.item.execution === "server";
|
|
5481
|
+
ongoingToolCalls[value.output_index] = {
|
|
5482
|
+
toolName,
|
|
5483
|
+
toolCallId,
|
|
5484
|
+
toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
|
|
5485
|
+
};
|
|
5486
|
+
if (isHosted) {
|
|
5487
|
+
controller.enqueue({
|
|
5488
|
+
type: "tool-input-start",
|
|
5489
|
+
id: toolCallId,
|
|
5490
|
+
toolName,
|
|
5491
|
+
providerExecuted: true
|
|
5492
|
+
});
|
|
5493
|
+
}
|
|
5494
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5249
5495
|
} else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
|
|
5250
5496
|
} else if (value.item.type === "apply_patch_call") {
|
|
5251
5497
|
const { call_id: callId, operation } = value.item;
|
|
@@ -5292,7 +5538,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5292
5538
|
} else if (value.item.type === "shell_call_output") {
|
|
5293
5539
|
} else if (value.item.type === "message") {
|
|
5294
5540
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
5295
|
-
activeMessagePhase = (
|
|
5541
|
+
activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
|
|
5296
5542
|
controller.enqueue({
|
|
5297
5543
|
type: "text-start",
|
|
5298
5544
|
id: value.item.id,
|
|
@@ -5316,14 +5562,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5316
5562
|
providerMetadata: {
|
|
5317
5563
|
[providerOptionsName]: {
|
|
5318
5564
|
itemId: value.item.id,
|
|
5319
|
-
reasoningEncryptedContent: (
|
|
5565
|
+
reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
|
|
5320
5566
|
}
|
|
5321
5567
|
}
|
|
5322
5568
|
});
|
|
5323
5569
|
}
|
|
5324
5570
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
5325
5571
|
if (value.item.type === "message") {
|
|
5326
|
-
const phase = (
|
|
5572
|
+
const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
|
|
5327
5573
|
activeMessagePhase = void 0;
|
|
5328
5574
|
controller.enqueue({
|
|
5329
5575
|
type: "text-end",
|
|
@@ -5417,13 +5663,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5417
5663
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5418
5664
|
result: {
|
|
5419
5665
|
queries: value.item.queries,
|
|
5420
|
-
results: (
|
|
5666
|
+
results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
|
|
5421
5667
|
attributes: result.attributes,
|
|
5422
5668
|
fileId: result.file_id,
|
|
5423
5669
|
filename: result.filename,
|
|
5424
5670
|
score: result.score,
|
|
5425
5671
|
text: result.text
|
|
5426
|
-
}))) != null ?
|
|
5672
|
+
}))) != null ? _f : null
|
|
5427
5673
|
}
|
|
5428
5674
|
});
|
|
5429
5675
|
} else if (value.item.type === "code_interpreter_call") {
|
|
@@ -5445,12 +5691,62 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5445
5691
|
result: value.item.result
|
|
5446
5692
|
}
|
|
5447
5693
|
});
|
|
5694
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5695
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
5696
|
+
const isHosted = value.item.execution === "server";
|
|
5697
|
+
if (toolCall != null) {
|
|
5698
|
+
const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
|
|
5699
|
+
if (isHosted) {
|
|
5700
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5701
|
+
} else {
|
|
5702
|
+
controller.enqueue({
|
|
5703
|
+
type: "tool-input-start",
|
|
5704
|
+
id: toolCallId,
|
|
5705
|
+
toolName: toolCall.toolName
|
|
5706
|
+
});
|
|
5707
|
+
}
|
|
5708
|
+
controller.enqueue({
|
|
5709
|
+
type: "tool-input-end",
|
|
5710
|
+
id: toolCallId
|
|
5711
|
+
});
|
|
5712
|
+
controller.enqueue({
|
|
5713
|
+
type: "tool-call",
|
|
5714
|
+
toolCallId,
|
|
5715
|
+
toolName: toolCall.toolName,
|
|
5716
|
+
input: JSON.stringify({
|
|
5717
|
+
arguments: value.item.arguments,
|
|
5718
|
+
call_id: isHosted ? null : toolCallId
|
|
5719
|
+
}),
|
|
5720
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5721
|
+
providerMetadata: {
|
|
5722
|
+
[providerOptionsName]: {
|
|
5723
|
+
itemId: value.item.id
|
|
5724
|
+
}
|
|
5725
|
+
}
|
|
5726
|
+
});
|
|
5727
|
+
}
|
|
5728
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
5729
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5730
|
+
const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
|
|
5731
|
+
controller.enqueue({
|
|
5732
|
+
type: "tool-result",
|
|
5733
|
+
toolCallId,
|
|
5734
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5735
|
+
result: {
|
|
5736
|
+
tools: value.item.tools
|
|
5737
|
+
},
|
|
5738
|
+
providerMetadata: {
|
|
5739
|
+
[providerOptionsName]: {
|
|
5740
|
+
itemId: value.item.id
|
|
5741
|
+
}
|
|
5742
|
+
}
|
|
5743
|
+
});
|
|
5448
5744
|
} else if (value.item.type === "mcp_call") {
|
|
5449
5745
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5450
|
-
const approvalRequestId = (
|
|
5451
|
-
const aliasedToolCallId = approvalRequestId != null ? (
|
|
5746
|
+
const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
|
|
5747
|
+
const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
5452
5748
|
approvalRequestId
|
|
5453
|
-
)) != null ?
|
|
5749
|
+
)) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
|
|
5454
5750
|
const toolName = `mcp.${value.item.name}`;
|
|
5455
5751
|
controller.enqueue({
|
|
5456
5752
|
type: "tool-call",
|
|
@@ -5520,8 +5816,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5520
5816
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5521
5817
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5522
5818
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5523
|
-
const dummyToolCallId = (
|
|
5524
|
-
const approvalRequestId = (
|
|
5819
|
+
const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils29.generateId)();
|
|
5820
|
+
const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
|
|
5525
5821
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5526
5822
|
approvalRequestId,
|
|
5527
5823
|
dummyToolCallId
|
|
@@ -5610,7 +5906,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5610
5906
|
providerMetadata: {
|
|
5611
5907
|
[providerOptionsName]: {
|
|
5612
5908
|
itemId: value.item.id,
|
|
5613
|
-
reasoningEncryptedContent: (
|
|
5909
|
+
reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
|
|
5614
5910
|
}
|
|
5615
5911
|
}
|
|
5616
5912
|
});
|
|
@@ -5723,7 +6019,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5723
6019
|
id: value.item_id,
|
|
5724
6020
|
delta: value.delta
|
|
5725
6021
|
});
|
|
5726
|
-
if (((
|
|
6022
|
+
if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
|
|
5727
6023
|
logprobs.push(value.logprobs);
|
|
5728
6024
|
}
|
|
5729
6025
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -5752,7 +6048,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5752
6048
|
providerMetadata: {
|
|
5753
6049
|
[providerOptionsName]: {
|
|
5754
6050
|
itemId: value.item_id,
|
|
5755
|
-
reasoningEncryptedContent: (
|
|
6051
|
+
reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
|
|
5756
6052
|
}
|
|
5757
6053
|
}
|
|
5758
6054
|
});
|
|
@@ -5786,10 +6082,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5786
6082
|
} else if (isResponseFinishedChunk(value)) {
|
|
5787
6083
|
finishReason = {
|
|
5788
6084
|
unified: mapOpenAIResponseFinishReason({
|
|
5789
|
-
finishReason: (
|
|
6085
|
+
finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
|
|
5790
6086
|
hasFunctionCall
|
|
5791
6087
|
}),
|
|
5792
|
-
raw: (
|
|
6088
|
+
raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
|
|
5793
6089
|
};
|
|
5794
6090
|
usage = value.response.usage;
|
|
5795
6091
|
if (typeof value.response.service_tier === "string") {
|
|
@@ -5801,7 +6097,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5801
6097
|
controller.enqueue({
|
|
5802
6098
|
type: "source",
|
|
5803
6099
|
sourceType: "url",
|
|
5804
|
-
id: (
|
|
6100
|
+
id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : (0, import_provider_utils29.generateId)(),
|
|
5805
6101
|
url: value.annotation.url,
|
|
5806
6102
|
title: value.annotation.title
|
|
5807
6103
|
});
|
|
@@ -5809,7 +6105,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5809
6105
|
controller.enqueue({
|
|
5810
6106
|
type: "source",
|
|
5811
6107
|
sourceType: "document",
|
|
5812
|
-
id: (
|
|
6108
|
+
id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : (0, import_provider_utils29.generateId)(),
|
|
5813
6109
|
mediaType: "text/plain",
|
|
5814
6110
|
title: value.annotation.filename,
|
|
5815
6111
|
filename: value.annotation.filename,
|
|
@@ -5825,7 +6121,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5825
6121
|
controller.enqueue({
|
|
5826
6122
|
type: "source",
|
|
5827
6123
|
sourceType: "document",
|
|
5828
|
-
id: (
|
|
6124
|
+
id: (_G = (_F = (_E = self.config).generateId) == null ? void 0 : _F.call(_E)) != null ? _G : (0, import_provider_utils29.generateId)(),
|
|
5829
6125
|
mediaType: "text/plain",
|
|
5830
6126
|
title: value.annotation.filename,
|
|
5831
6127
|
filename: value.annotation.filename,
|
|
@@ -5841,7 +6137,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5841
6137
|
controller.enqueue({
|
|
5842
6138
|
type: "source",
|
|
5843
6139
|
sourceType: "document",
|
|
5844
|
-
id: (
|
|
6140
|
+
id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : (0, import_provider_utils29.generateId)(),
|
|
5845
6141
|
mediaType: "application/octet-stream",
|
|
5846
6142
|
title: value.annotation.file_id,
|
|
5847
6143
|
filename: value.annotation.file_id,
|
|
@@ -5951,16 +6247,16 @@ function escapeJSONDelta(delta) {
|
|
|
5951
6247
|
}
|
|
5952
6248
|
|
|
5953
6249
|
// src/speech/openai-speech-model.ts
|
|
5954
|
-
var
|
|
6250
|
+
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
5955
6251
|
|
|
5956
6252
|
// src/speech/openai-speech-options.ts
|
|
5957
|
-
var
|
|
5958
|
-
var
|
|
5959
|
-
var openaiSpeechModelOptionsSchema = (0,
|
|
5960
|
-
() => (0,
|
|
5961
|
-
|
|
5962
|
-
instructions:
|
|
5963
|
-
speed:
|
|
6253
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
6254
|
+
var import_v423 = require("zod/v4");
|
|
6255
|
+
var openaiSpeechModelOptionsSchema = (0, import_provider_utils30.lazySchema)(
|
|
6256
|
+
() => (0, import_provider_utils30.zodSchema)(
|
|
6257
|
+
import_v423.z.object({
|
|
6258
|
+
instructions: import_v423.z.string().nullish(),
|
|
6259
|
+
speed: import_v423.z.number().min(0.25).max(4).default(1).nullish()
|
|
5964
6260
|
})
|
|
5965
6261
|
)
|
|
5966
6262
|
);
|
|
@@ -5970,7 +6266,7 @@ var OpenAISpeechModel = class {
|
|
|
5970
6266
|
constructor(modelId, config) {
|
|
5971
6267
|
this.modelId = modelId;
|
|
5972
6268
|
this.config = config;
|
|
5973
|
-
this.specificationVersion = "
|
|
6269
|
+
this.specificationVersion = "v4";
|
|
5974
6270
|
}
|
|
5975
6271
|
get provider() {
|
|
5976
6272
|
return this.config.provider;
|
|
@@ -5985,7 +6281,7 @@ var OpenAISpeechModel = class {
|
|
|
5985
6281
|
providerOptions
|
|
5986
6282
|
}) {
|
|
5987
6283
|
const warnings = [];
|
|
5988
|
-
const openAIOptions = await (0,
|
|
6284
|
+
const openAIOptions = await (0, import_provider_utils31.parseProviderOptions)({
|
|
5989
6285
|
provider: "openai",
|
|
5990
6286
|
providerOptions,
|
|
5991
6287
|
schema: openaiSpeechModelOptionsSchema
|
|
@@ -6038,15 +6334,15 @@ var OpenAISpeechModel = class {
|
|
|
6038
6334
|
value: audio,
|
|
6039
6335
|
responseHeaders,
|
|
6040
6336
|
rawValue: rawResponse
|
|
6041
|
-
} = await (0,
|
|
6337
|
+
} = await (0, import_provider_utils31.postJsonToApi)({
|
|
6042
6338
|
url: this.config.url({
|
|
6043
6339
|
path: "/audio/speech",
|
|
6044
6340
|
modelId: this.modelId
|
|
6045
6341
|
}),
|
|
6046
|
-
headers: (0,
|
|
6342
|
+
headers: (0, import_provider_utils31.combineHeaders)(this.config.headers(), options.headers),
|
|
6047
6343
|
body: requestBody,
|
|
6048
6344
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6049
|
-
successfulResponseHandler: (0,
|
|
6345
|
+
successfulResponseHandler: (0, import_provider_utils31.createBinaryResponseHandler)(),
|
|
6050
6346
|
abortSignal: options.abortSignal,
|
|
6051
6347
|
fetch: this.config.fetch
|
|
6052
6348
|
});
|
|
@@ -6067,36 +6363,36 @@ var OpenAISpeechModel = class {
|
|
|
6067
6363
|
};
|
|
6068
6364
|
|
|
6069
6365
|
// src/transcription/openai-transcription-model.ts
|
|
6070
|
-
var
|
|
6366
|
+
var import_provider_utils34 = require("@ai-sdk/provider-utils");
|
|
6071
6367
|
|
|
6072
6368
|
// src/transcription/openai-transcription-api.ts
|
|
6073
|
-
var
|
|
6074
|
-
var
|
|
6075
|
-
var openaiTranscriptionResponseSchema = (0,
|
|
6076
|
-
() => (0,
|
|
6077
|
-
|
|
6078
|
-
text:
|
|
6079
|
-
language:
|
|
6080
|
-
duration:
|
|
6081
|
-
words:
|
|
6082
|
-
|
|
6083
|
-
word:
|
|
6084
|
-
start:
|
|
6085
|
-
end:
|
|
6369
|
+
var import_provider_utils32 = require("@ai-sdk/provider-utils");
|
|
6370
|
+
var import_v424 = require("zod/v4");
|
|
6371
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils32.lazySchema)(
|
|
6372
|
+
() => (0, import_provider_utils32.zodSchema)(
|
|
6373
|
+
import_v424.z.object({
|
|
6374
|
+
text: import_v424.z.string(),
|
|
6375
|
+
language: import_v424.z.string().nullish(),
|
|
6376
|
+
duration: import_v424.z.number().nullish(),
|
|
6377
|
+
words: import_v424.z.array(
|
|
6378
|
+
import_v424.z.object({
|
|
6379
|
+
word: import_v424.z.string(),
|
|
6380
|
+
start: import_v424.z.number(),
|
|
6381
|
+
end: import_v424.z.number()
|
|
6086
6382
|
})
|
|
6087
6383
|
).nullish(),
|
|
6088
|
-
segments:
|
|
6089
|
-
|
|
6090
|
-
id:
|
|
6091
|
-
seek:
|
|
6092
|
-
start:
|
|
6093
|
-
end:
|
|
6094
|
-
text:
|
|
6095
|
-
tokens:
|
|
6096
|
-
temperature:
|
|
6097
|
-
avg_logprob:
|
|
6098
|
-
compression_ratio:
|
|
6099
|
-
no_speech_prob:
|
|
6384
|
+
segments: import_v424.z.array(
|
|
6385
|
+
import_v424.z.object({
|
|
6386
|
+
id: import_v424.z.number(),
|
|
6387
|
+
seek: import_v424.z.number(),
|
|
6388
|
+
start: import_v424.z.number(),
|
|
6389
|
+
end: import_v424.z.number(),
|
|
6390
|
+
text: import_v424.z.string(),
|
|
6391
|
+
tokens: import_v424.z.array(import_v424.z.number()),
|
|
6392
|
+
temperature: import_v424.z.number(),
|
|
6393
|
+
avg_logprob: import_v424.z.number(),
|
|
6394
|
+
compression_ratio: import_v424.z.number(),
|
|
6395
|
+
no_speech_prob: import_v424.z.number()
|
|
6100
6396
|
})
|
|
6101
6397
|
).nullish()
|
|
6102
6398
|
})
|
|
@@ -6104,33 +6400,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils31.lazySchema)(
|
|
|
6104
6400
|
);
|
|
6105
6401
|
|
|
6106
6402
|
// src/transcription/openai-transcription-options.ts
|
|
6107
|
-
var
|
|
6108
|
-
var
|
|
6109
|
-
var openAITranscriptionModelOptions = (0,
|
|
6110
|
-
() => (0,
|
|
6111
|
-
|
|
6403
|
+
var import_provider_utils33 = require("@ai-sdk/provider-utils");
|
|
6404
|
+
var import_v425 = require("zod/v4");
|
|
6405
|
+
var openAITranscriptionModelOptions = (0, import_provider_utils33.lazySchema)(
|
|
6406
|
+
() => (0, import_provider_utils33.zodSchema)(
|
|
6407
|
+
import_v425.z.object({
|
|
6112
6408
|
/**
|
|
6113
6409
|
* Additional information to include in the transcription response.
|
|
6114
6410
|
*/
|
|
6115
|
-
include:
|
|
6411
|
+
include: import_v425.z.array(import_v425.z.string()).optional(),
|
|
6116
6412
|
/**
|
|
6117
6413
|
* The language of the input audio in ISO-639-1 format.
|
|
6118
6414
|
*/
|
|
6119
|
-
language:
|
|
6415
|
+
language: import_v425.z.string().optional(),
|
|
6120
6416
|
/**
|
|
6121
6417
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
6122
6418
|
*/
|
|
6123
|
-
prompt:
|
|
6419
|
+
prompt: import_v425.z.string().optional(),
|
|
6124
6420
|
/**
|
|
6125
6421
|
* The sampling temperature, between 0 and 1.
|
|
6126
6422
|
* @default 0
|
|
6127
6423
|
*/
|
|
6128
|
-
temperature:
|
|
6424
|
+
temperature: import_v425.z.number().min(0).max(1).default(0).optional(),
|
|
6129
6425
|
/**
|
|
6130
6426
|
* The timestamp granularities to populate for this transcription.
|
|
6131
6427
|
* @default ['segment']
|
|
6132
6428
|
*/
|
|
6133
|
-
timestampGranularities:
|
|
6429
|
+
timestampGranularities: import_v425.z.array(import_v425.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
6134
6430
|
})
|
|
6135
6431
|
)
|
|
6136
6432
|
);
|
|
@@ -6199,7 +6495,7 @@ var OpenAITranscriptionModel = class {
|
|
|
6199
6495
|
constructor(modelId, config) {
|
|
6200
6496
|
this.modelId = modelId;
|
|
6201
6497
|
this.config = config;
|
|
6202
|
-
this.specificationVersion = "
|
|
6498
|
+
this.specificationVersion = "v4";
|
|
6203
6499
|
}
|
|
6204
6500
|
get provider() {
|
|
6205
6501
|
return this.config.provider;
|
|
@@ -6210,15 +6506,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6210
6506
|
providerOptions
|
|
6211
6507
|
}) {
|
|
6212
6508
|
const warnings = [];
|
|
6213
|
-
const openAIOptions = await (0,
|
|
6509
|
+
const openAIOptions = await (0, import_provider_utils34.parseProviderOptions)({
|
|
6214
6510
|
provider: "openai",
|
|
6215
6511
|
providerOptions,
|
|
6216
6512
|
schema: openAITranscriptionModelOptions
|
|
6217
6513
|
});
|
|
6218
6514
|
const formData = new FormData();
|
|
6219
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
6515
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils34.convertBase64ToUint8Array)(audio)]);
|
|
6220
6516
|
formData.append("model", this.modelId);
|
|
6221
|
-
const fileExtension = (0,
|
|
6517
|
+
const fileExtension = (0, import_provider_utils34.mediaTypeToExtension)(mediaType);
|
|
6222
6518
|
formData.append(
|
|
6223
6519
|
"file",
|
|
6224
6520
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -6263,15 +6559,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6263
6559
|
value: response,
|
|
6264
6560
|
responseHeaders,
|
|
6265
6561
|
rawValue: rawResponse
|
|
6266
|
-
} = await (0,
|
|
6562
|
+
} = await (0, import_provider_utils34.postFormDataToApi)({
|
|
6267
6563
|
url: this.config.url({
|
|
6268
6564
|
path: "/audio/transcriptions",
|
|
6269
6565
|
modelId: this.modelId
|
|
6270
6566
|
}),
|
|
6271
|
-
headers: (0,
|
|
6567
|
+
headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
|
|
6272
6568
|
formData,
|
|
6273
6569
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6274
|
-
successfulResponseHandler: (0,
|
|
6570
|
+
successfulResponseHandler: (0, import_provider_utils34.createJsonResponseHandler)(
|
|
6275
6571
|
openaiTranscriptionResponseSchema
|
|
6276
6572
|
),
|
|
6277
6573
|
abortSignal: options.abortSignal,
|
|
@@ -6303,21 +6599,21 @@ var OpenAITranscriptionModel = class {
|
|
|
6303
6599
|
};
|
|
6304
6600
|
|
|
6305
6601
|
// src/version.ts
|
|
6306
|
-
var VERSION = true ? "4.0.0-beta.
|
|
6602
|
+
var VERSION = true ? "4.0.0-beta.10" : "0.0.0-test";
|
|
6307
6603
|
|
|
6308
6604
|
// src/openai-provider.ts
|
|
6309
6605
|
function createOpenAI(options = {}) {
|
|
6310
6606
|
var _a, _b;
|
|
6311
|
-
const baseURL = (_a = (0,
|
|
6312
|
-
(0,
|
|
6607
|
+
const baseURL = (_a = (0, import_provider_utils35.withoutTrailingSlash)(
|
|
6608
|
+
(0, import_provider_utils35.loadOptionalSetting)({
|
|
6313
6609
|
settingValue: options.baseURL,
|
|
6314
6610
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
6315
6611
|
})
|
|
6316
6612
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
6317
6613
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
6318
|
-
const getHeaders = () => (0,
|
|
6614
|
+
const getHeaders = () => (0, import_provider_utils35.withUserAgentSuffix)(
|
|
6319
6615
|
{
|
|
6320
|
-
Authorization: `Bearer ${(0,
|
|
6616
|
+
Authorization: `Bearer ${(0, import_provider_utils35.loadApiKey)({
|
|
6321
6617
|
apiKey: options.apiKey,
|
|
6322
6618
|
environmentVariableName: "OPENAI_API_KEY",
|
|
6323
6619
|
description: "OpenAI"
|
|
@@ -6384,7 +6680,7 @@ function createOpenAI(options = {}) {
|
|
|
6384
6680
|
const provider = function(modelId) {
|
|
6385
6681
|
return createLanguageModel(modelId);
|
|
6386
6682
|
};
|
|
6387
|
-
provider.specificationVersion = "
|
|
6683
|
+
provider.specificationVersion = "v4";
|
|
6388
6684
|
provider.languageModel = createLanguageModel;
|
|
6389
6685
|
provider.chat = createChatModel;
|
|
6390
6686
|
provider.completion = createCompletionModel;
|