@ai-sdk/openai 3.0.0-beta.53 → 3.0.0-beta.55
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 +12 -0
- package/dist/index.d.mts +51 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +851 -476
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +809 -430
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +383 -25
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +365 -3
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ __export(src_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(src_exports);
|
|
28
28
|
|
|
29
29
|
// src/openai-provider.ts
|
|
30
|
-
var
|
|
30
|
+
var import_provider_utils31 = 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");
|
|
@@ -1989,6 +1989,94 @@ var webSearchPreview = (0, import_provider_utils19.createProviderDefinedToolFact
|
|
|
1989
1989
|
outputSchema: webSearchPreviewOutputSchema
|
|
1990
1990
|
});
|
|
1991
1991
|
|
|
1992
|
+
// src/tool/mcp.ts
|
|
1993
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
1994
|
+
var import_v415 = require("zod/v4");
|
|
1995
|
+
var jsonValueSchema = import_v415.z.lazy(
|
|
1996
|
+
() => import_v415.z.union([
|
|
1997
|
+
import_v415.z.string(),
|
|
1998
|
+
import_v415.z.number(),
|
|
1999
|
+
import_v415.z.boolean(),
|
|
2000
|
+
import_v415.z.null(),
|
|
2001
|
+
import_v415.z.array(jsonValueSchema),
|
|
2002
|
+
import_v415.z.record(import_v415.z.string(), jsonValueSchema)
|
|
2003
|
+
])
|
|
2004
|
+
);
|
|
2005
|
+
var mcpArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
2006
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2007
|
+
import_v415.z.object({
|
|
2008
|
+
serverLabel: import_v415.z.string(),
|
|
2009
|
+
allowedTools: import_v415.z.union([
|
|
2010
|
+
import_v415.z.array(import_v415.z.string()),
|
|
2011
|
+
import_v415.z.object({
|
|
2012
|
+
readOnly: import_v415.z.boolean().optional(),
|
|
2013
|
+
toolNames: import_v415.z.array(import_v415.z.string()).optional()
|
|
2014
|
+
})
|
|
2015
|
+
]).optional(),
|
|
2016
|
+
authorization: import_v415.z.string().optional(),
|
|
2017
|
+
connectorId: import_v415.z.string().optional(),
|
|
2018
|
+
headers: import_v415.z.record(import_v415.z.string(), import_v415.z.string()).optional(),
|
|
2019
|
+
// TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
|
|
2020
|
+
// requireApproval: z
|
|
2021
|
+
// .union([
|
|
2022
|
+
// z.enum(['always', 'never']),
|
|
2023
|
+
// z.object({
|
|
2024
|
+
// readOnly: z.boolean().optional(),
|
|
2025
|
+
// toolNames: z.array(z.string()).optional(),
|
|
2026
|
+
// }),
|
|
2027
|
+
// ])
|
|
2028
|
+
// .optional(),
|
|
2029
|
+
serverDescription: import_v415.z.string().optional(),
|
|
2030
|
+
serverUrl: import_v415.z.string().optional()
|
|
2031
|
+
}).refine(
|
|
2032
|
+
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2033
|
+
"One of serverUrl or connectorId must be provided."
|
|
2034
|
+
)
|
|
2035
|
+
)
|
|
2036
|
+
);
|
|
2037
|
+
var mcpInputSchema = (0, import_provider_utils20.lazySchema)(() => (0, import_provider_utils20.zodSchema)(import_v415.z.object({})));
|
|
2038
|
+
var mcpOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2039
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2040
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2041
|
+
import_v415.z.object({
|
|
2042
|
+
type: import_v415.z.literal("call"),
|
|
2043
|
+
serverLabel: import_v415.z.string(),
|
|
2044
|
+
name: import_v415.z.string(),
|
|
2045
|
+
arguments: import_v415.z.string(),
|
|
2046
|
+
output: import_v415.z.string().nullable().optional(),
|
|
2047
|
+
error: import_v415.z.union([import_v415.z.string(), jsonValueSchema]).optional()
|
|
2048
|
+
}),
|
|
2049
|
+
import_v415.z.object({
|
|
2050
|
+
type: import_v415.z.literal("listTools"),
|
|
2051
|
+
serverLabel: import_v415.z.string(),
|
|
2052
|
+
tools: import_v415.z.array(
|
|
2053
|
+
import_v415.z.object({
|
|
2054
|
+
name: import_v415.z.string(),
|
|
2055
|
+
description: import_v415.z.string().optional(),
|
|
2056
|
+
inputSchema: jsonValueSchema,
|
|
2057
|
+
annotations: import_v415.z.record(import_v415.z.string(), jsonValueSchema).optional()
|
|
2058
|
+
})
|
|
2059
|
+
),
|
|
2060
|
+
error: import_v415.z.union([import_v415.z.string(), jsonValueSchema]).optional()
|
|
2061
|
+
}),
|
|
2062
|
+
import_v415.z.object({
|
|
2063
|
+
type: import_v415.z.literal("approvalRequest"),
|
|
2064
|
+
serverLabel: import_v415.z.string(),
|
|
2065
|
+
name: import_v415.z.string(),
|
|
2066
|
+
arguments: import_v415.z.string(),
|
|
2067
|
+
approvalRequestId: import_v415.z.string()
|
|
2068
|
+
})
|
|
2069
|
+
])
|
|
2070
|
+
)
|
|
2071
|
+
);
|
|
2072
|
+
var mcpToolFactory = (0, import_provider_utils20.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2073
|
+
id: "openai.mcp",
|
|
2074
|
+
name: "mcp",
|
|
2075
|
+
inputSchema: mcpInputSchema,
|
|
2076
|
+
outputSchema: mcpOutputSchema
|
|
2077
|
+
});
|
|
2078
|
+
var mcp = (args) => mcpToolFactory(args);
|
|
2079
|
+
|
|
1992
2080
|
// src/openai-tools.ts
|
|
1993
2081
|
var openaiTools = {
|
|
1994
2082
|
/**
|
|
@@ -2064,17 +2152,33 @@ var openaiTools = {
|
|
|
2064
2152
|
* @param searchContextSize - The search context size to use for the web search.
|
|
2065
2153
|
* @param userLocation - The user location to use for the web search.
|
|
2066
2154
|
*/
|
|
2067
|
-
webSearch
|
|
2155
|
+
webSearch,
|
|
2156
|
+
/**
|
|
2157
|
+
* MCP (Model Context Protocol) allows models to call tools exposed by
|
|
2158
|
+
* remote MCP servers or service connectors.
|
|
2159
|
+
*
|
|
2160
|
+
* Must have name `mcp`.
|
|
2161
|
+
*
|
|
2162
|
+
* @param serverLabel - Label to identify the MCP server.
|
|
2163
|
+
* @param allowedTools - Allowed tool names or filter object.
|
|
2164
|
+
* @param authorization - OAuth access token for the MCP server/connector.
|
|
2165
|
+
* @param connectorId - Identifier for a service connector.
|
|
2166
|
+
* @param headers - Optional headers to include in MCP requests.
|
|
2167
|
+
* // param requireApproval - Approval policy ('always'|'never'|filter object). (Removed - always 'never')
|
|
2168
|
+
* @param serverDescription - Optional description of the server.
|
|
2169
|
+
* @param serverUrl - URL for the MCP server.
|
|
2170
|
+
*/
|
|
2171
|
+
mcp
|
|
2068
2172
|
};
|
|
2069
2173
|
|
|
2070
2174
|
// src/responses/openai-responses-language-model.ts
|
|
2071
2175
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2072
|
-
var
|
|
2176
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
2073
2177
|
|
|
2074
2178
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2075
2179
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2076
|
-
var
|
|
2077
|
-
var
|
|
2180
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2181
|
+
var import_v416 = require("zod/v4");
|
|
2078
2182
|
function isFileId(data, prefixes) {
|
|
2079
2183
|
if (!prefixes) return false;
|
|
2080
2184
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2132,7 +2236,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2132
2236
|
return {
|
|
2133
2237
|
type: "input_image",
|
|
2134
2238
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2135
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2239
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
|
|
2136
2240
|
},
|
|
2137
2241
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2138
2242
|
};
|
|
@@ -2147,7 +2251,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2147
2251
|
type: "input_file",
|
|
2148
2252
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2149
2253
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2150
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2254
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
|
|
2151
2255
|
}
|
|
2152
2256
|
};
|
|
2153
2257
|
} else {
|
|
@@ -2190,7 +2294,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2190
2294
|
break;
|
|
2191
2295
|
}
|
|
2192
2296
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2193
|
-
const parsedInput = await (0,
|
|
2297
|
+
const parsedInput = await (0, import_provider_utils21.validateTypes)({
|
|
2194
2298
|
value: part.input,
|
|
2195
2299
|
schema: localShellInputSchema
|
|
2196
2300
|
});
|
|
@@ -2231,7 +2335,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2231
2335
|
break;
|
|
2232
2336
|
}
|
|
2233
2337
|
case "reasoning": {
|
|
2234
|
-
const providerOptions = await (0,
|
|
2338
|
+
const providerOptions = await (0, import_provider_utils21.parseProviderOptions)({
|
|
2235
2339
|
provider: "openai",
|
|
2236
2340
|
providerOptions: part.providerOptions,
|
|
2237
2341
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2292,7 +2396,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2292
2396
|
for (const part of content) {
|
|
2293
2397
|
const output = part.output;
|
|
2294
2398
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2295
|
-
const parsedOutput = await (0,
|
|
2399
|
+
const parsedOutput = await (0, import_provider_utils21.validateTypes)({
|
|
2296
2400
|
value: output.value,
|
|
2297
2401
|
schema: localShellOutputSchema
|
|
2298
2402
|
});
|
|
@@ -2344,7 +2448,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2344
2448
|
return void 0;
|
|
2345
2449
|
}
|
|
2346
2450
|
}
|
|
2347
|
-
}).filter(
|
|
2451
|
+
}).filter(import_provider_utils21.isNonNullable);
|
|
2348
2452
|
break;
|
|
2349
2453
|
}
|
|
2350
2454
|
input.push({
|
|
@@ -2363,9 +2467,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2363
2467
|
}
|
|
2364
2468
|
return { input, warnings };
|
|
2365
2469
|
}
|
|
2366
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2367
|
-
itemId:
|
|
2368
|
-
reasoningEncryptedContent:
|
|
2470
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v416.z.object({
|
|
2471
|
+
itemId: import_v416.z.string().nullish(),
|
|
2472
|
+
reasoningEncryptedContent: import_v416.z.string().nullish()
|
|
2369
2473
|
});
|
|
2370
2474
|
|
|
2371
2475
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2387,285 +2491,344 @@ function mapOpenAIResponseFinishReason({
|
|
|
2387
2491
|
}
|
|
2388
2492
|
|
|
2389
2493
|
// src/responses/openai-responses-api.ts
|
|
2390
|
-
var
|
|
2391
|
-
var
|
|
2392
|
-
var openaiResponsesChunkSchema = (0,
|
|
2393
|
-
() => (0,
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
type:
|
|
2397
|
-
item_id:
|
|
2398
|
-
delta:
|
|
2399
|
-
logprobs:
|
|
2400
|
-
|
|
2401
|
-
token:
|
|
2402
|
-
logprob:
|
|
2403
|
-
top_logprobs:
|
|
2404
|
-
|
|
2405
|
-
token:
|
|
2406
|
-
logprob:
|
|
2494
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2495
|
+
var import_v417 = require("zod/v4");
|
|
2496
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
|
|
2497
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2498
|
+
import_v417.z.union([
|
|
2499
|
+
import_v417.z.object({
|
|
2500
|
+
type: import_v417.z.literal("response.output_text.delta"),
|
|
2501
|
+
item_id: import_v417.z.string(),
|
|
2502
|
+
delta: import_v417.z.string(),
|
|
2503
|
+
logprobs: import_v417.z.array(
|
|
2504
|
+
import_v417.z.object({
|
|
2505
|
+
token: import_v417.z.string(),
|
|
2506
|
+
logprob: import_v417.z.number(),
|
|
2507
|
+
top_logprobs: import_v417.z.array(
|
|
2508
|
+
import_v417.z.object({
|
|
2509
|
+
token: import_v417.z.string(),
|
|
2510
|
+
logprob: import_v417.z.number()
|
|
2407
2511
|
})
|
|
2408
2512
|
)
|
|
2409
2513
|
})
|
|
2410
2514
|
).nullish()
|
|
2411
2515
|
}),
|
|
2412
|
-
|
|
2413
|
-
type:
|
|
2414
|
-
response:
|
|
2415
|
-
incomplete_details:
|
|
2416
|
-
usage:
|
|
2417
|
-
input_tokens:
|
|
2418
|
-
input_tokens_details:
|
|
2419
|
-
output_tokens:
|
|
2420
|
-
output_tokens_details:
|
|
2516
|
+
import_v417.z.object({
|
|
2517
|
+
type: import_v417.z.enum(["response.completed", "response.incomplete"]),
|
|
2518
|
+
response: import_v417.z.object({
|
|
2519
|
+
incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
|
|
2520
|
+
usage: import_v417.z.object({
|
|
2521
|
+
input_tokens: import_v417.z.number(),
|
|
2522
|
+
input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
|
|
2523
|
+
output_tokens: import_v417.z.number(),
|
|
2524
|
+
output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
|
|
2421
2525
|
}),
|
|
2422
|
-
service_tier:
|
|
2526
|
+
service_tier: import_v417.z.string().nullish()
|
|
2423
2527
|
})
|
|
2424
2528
|
}),
|
|
2425
|
-
|
|
2426
|
-
type:
|
|
2427
|
-
response:
|
|
2428
|
-
id:
|
|
2429
|
-
created_at:
|
|
2430
|
-
model:
|
|
2431
|
-
service_tier:
|
|
2529
|
+
import_v417.z.object({
|
|
2530
|
+
type: import_v417.z.literal("response.created"),
|
|
2531
|
+
response: import_v417.z.object({
|
|
2532
|
+
id: import_v417.z.string(),
|
|
2533
|
+
created_at: import_v417.z.number(),
|
|
2534
|
+
model: import_v417.z.string(),
|
|
2535
|
+
service_tier: import_v417.z.string().nullish()
|
|
2432
2536
|
})
|
|
2433
2537
|
}),
|
|
2434
|
-
|
|
2435
|
-
type:
|
|
2436
|
-
output_index:
|
|
2437
|
-
item:
|
|
2438
|
-
|
|
2439
|
-
type:
|
|
2440
|
-
id:
|
|
2538
|
+
import_v417.z.object({
|
|
2539
|
+
type: import_v417.z.literal("response.output_item.added"),
|
|
2540
|
+
output_index: import_v417.z.number(),
|
|
2541
|
+
item: import_v417.z.discriminatedUnion("type", [
|
|
2542
|
+
import_v417.z.object({
|
|
2543
|
+
type: import_v417.z.literal("message"),
|
|
2544
|
+
id: import_v417.z.string()
|
|
2441
2545
|
}),
|
|
2442
|
-
|
|
2443
|
-
type:
|
|
2444
|
-
id:
|
|
2445
|
-
encrypted_content:
|
|
2546
|
+
import_v417.z.object({
|
|
2547
|
+
type: import_v417.z.literal("reasoning"),
|
|
2548
|
+
id: import_v417.z.string(),
|
|
2549
|
+
encrypted_content: import_v417.z.string().nullish()
|
|
2446
2550
|
}),
|
|
2447
|
-
|
|
2448
|
-
type:
|
|
2449
|
-
id:
|
|
2450
|
-
call_id:
|
|
2451
|
-
name:
|
|
2452
|
-
arguments:
|
|
2551
|
+
import_v417.z.object({
|
|
2552
|
+
type: import_v417.z.literal("function_call"),
|
|
2553
|
+
id: import_v417.z.string(),
|
|
2554
|
+
call_id: import_v417.z.string(),
|
|
2555
|
+
name: import_v417.z.string(),
|
|
2556
|
+
arguments: import_v417.z.string()
|
|
2453
2557
|
}),
|
|
2454
|
-
|
|
2455
|
-
type:
|
|
2456
|
-
id:
|
|
2457
|
-
status:
|
|
2558
|
+
import_v417.z.object({
|
|
2559
|
+
type: import_v417.z.literal("web_search_call"),
|
|
2560
|
+
id: import_v417.z.string(),
|
|
2561
|
+
status: import_v417.z.string()
|
|
2458
2562
|
}),
|
|
2459
|
-
|
|
2460
|
-
type:
|
|
2461
|
-
id:
|
|
2462
|
-
status:
|
|
2563
|
+
import_v417.z.object({
|
|
2564
|
+
type: import_v417.z.literal("computer_call"),
|
|
2565
|
+
id: import_v417.z.string(),
|
|
2566
|
+
status: import_v417.z.string()
|
|
2463
2567
|
}),
|
|
2464
|
-
|
|
2465
|
-
type:
|
|
2466
|
-
id:
|
|
2568
|
+
import_v417.z.object({
|
|
2569
|
+
type: import_v417.z.literal("file_search_call"),
|
|
2570
|
+
id: import_v417.z.string()
|
|
2467
2571
|
}),
|
|
2468
|
-
|
|
2469
|
-
type:
|
|
2470
|
-
id:
|
|
2572
|
+
import_v417.z.object({
|
|
2573
|
+
type: import_v417.z.literal("image_generation_call"),
|
|
2574
|
+
id: import_v417.z.string()
|
|
2471
2575
|
}),
|
|
2472
|
-
|
|
2473
|
-
type:
|
|
2474
|
-
id:
|
|
2475
|
-
container_id:
|
|
2476
|
-
code:
|
|
2477
|
-
outputs:
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2576
|
+
import_v417.z.object({
|
|
2577
|
+
type: import_v417.z.literal("code_interpreter_call"),
|
|
2578
|
+
id: import_v417.z.string(),
|
|
2579
|
+
container_id: import_v417.z.string(),
|
|
2580
|
+
code: import_v417.z.string().nullable(),
|
|
2581
|
+
outputs: import_v417.z.array(
|
|
2582
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2583
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
2584
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
2481
2585
|
])
|
|
2482
2586
|
).nullable(),
|
|
2483
|
-
status:
|
|
2587
|
+
status: import_v417.z.string()
|
|
2588
|
+
}),
|
|
2589
|
+
import_v417.z.object({
|
|
2590
|
+
type: import_v417.z.literal("mcp_call"),
|
|
2591
|
+
id: import_v417.z.string(),
|
|
2592
|
+
status: import_v417.z.string()
|
|
2593
|
+
}),
|
|
2594
|
+
import_v417.z.object({
|
|
2595
|
+
type: import_v417.z.literal("mcp_list_tools"),
|
|
2596
|
+
id: import_v417.z.string()
|
|
2597
|
+
}),
|
|
2598
|
+
import_v417.z.object({
|
|
2599
|
+
type: import_v417.z.literal("mcp_approval_request"),
|
|
2600
|
+
id: import_v417.z.string()
|
|
2484
2601
|
})
|
|
2485
2602
|
])
|
|
2486
2603
|
}),
|
|
2487
|
-
|
|
2488
|
-
type:
|
|
2489
|
-
output_index:
|
|
2490
|
-
item:
|
|
2491
|
-
|
|
2492
|
-
type:
|
|
2493
|
-
id:
|
|
2604
|
+
import_v417.z.object({
|
|
2605
|
+
type: import_v417.z.literal("response.output_item.done"),
|
|
2606
|
+
output_index: import_v417.z.number(),
|
|
2607
|
+
item: import_v417.z.discriminatedUnion("type", [
|
|
2608
|
+
import_v417.z.object({
|
|
2609
|
+
type: import_v417.z.literal("message"),
|
|
2610
|
+
id: import_v417.z.string()
|
|
2494
2611
|
}),
|
|
2495
|
-
|
|
2496
|
-
type:
|
|
2497
|
-
id:
|
|
2498
|
-
encrypted_content:
|
|
2612
|
+
import_v417.z.object({
|
|
2613
|
+
type: import_v417.z.literal("reasoning"),
|
|
2614
|
+
id: import_v417.z.string(),
|
|
2615
|
+
encrypted_content: import_v417.z.string().nullish()
|
|
2499
2616
|
}),
|
|
2500
|
-
|
|
2501
|
-
type:
|
|
2502
|
-
id:
|
|
2503
|
-
call_id:
|
|
2504
|
-
name:
|
|
2505
|
-
arguments:
|
|
2506
|
-
status:
|
|
2617
|
+
import_v417.z.object({
|
|
2618
|
+
type: import_v417.z.literal("function_call"),
|
|
2619
|
+
id: import_v417.z.string(),
|
|
2620
|
+
call_id: import_v417.z.string(),
|
|
2621
|
+
name: import_v417.z.string(),
|
|
2622
|
+
arguments: import_v417.z.string(),
|
|
2623
|
+
status: import_v417.z.literal("completed")
|
|
2507
2624
|
}),
|
|
2508
|
-
|
|
2509
|
-
type:
|
|
2510
|
-
id:
|
|
2511
|
-
code:
|
|
2512
|
-
container_id:
|
|
2513
|
-
outputs:
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2625
|
+
import_v417.z.object({
|
|
2626
|
+
type: import_v417.z.literal("code_interpreter_call"),
|
|
2627
|
+
id: import_v417.z.string(),
|
|
2628
|
+
code: import_v417.z.string().nullable(),
|
|
2629
|
+
container_id: import_v417.z.string(),
|
|
2630
|
+
outputs: import_v417.z.array(
|
|
2631
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2632
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
2633
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
2517
2634
|
])
|
|
2518
2635
|
).nullable()
|
|
2519
2636
|
}),
|
|
2520
|
-
|
|
2521
|
-
type:
|
|
2522
|
-
id:
|
|
2523
|
-
result:
|
|
2637
|
+
import_v417.z.object({
|
|
2638
|
+
type: import_v417.z.literal("image_generation_call"),
|
|
2639
|
+
id: import_v417.z.string(),
|
|
2640
|
+
result: import_v417.z.string()
|
|
2524
2641
|
}),
|
|
2525
|
-
|
|
2526
|
-
type:
|
|
2527
|
-
id:
|
|
2528
|
-
status:
|
|
2529
|
-
action:
|
|
2530
|
-
|
|
2531
|
-
type:
|
|
2532
|
-
query:
|
|
2533
|
-
sources:
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2642
|
+
import_v417.z.object({
|
|
2643
|
+
type: import_v417.z.literal("web_search_call"),
|
|
2644
|
+
id: import_v417.z.string(),
|
|
2645
|
+
status: import_v417.z.string(),
|
|
2646
|
+
action: import_v417.z.discriminatedUnion("type", [
|
|
2647
|
+
import_v417.z.object({
|
|
2648
|
+
type: import_v417.z.literal("search"),
|
|
2649
|
+
query: import_v417.z.string().nullish(),
|
|
2650
|
+
sources: import_v417.z.array(
|
|
2651
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2652
|
+
import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
|
|
2653
|
+
import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
|
|
2537
2654
|
])
|
|
2538
2655
|
).nullish()
|
|
2539
2656
|
}),
|
|
2540
|
-
|
|
2541
|
-
type:
|
|
2542
|
-
url:
|
|
2657
|
+
import_v417.z.object({
|
|
2658
|
+
type: import_v417.z.literal("open_page"),
|
|
2659
|
+
url: import_v417.z.string()
|
|
2543
2660
|
}),
|
|
2544
|
-
|
|
2545
|
-
type:
|
|
2546
|
-
url:
|
|
2547
|
-
pattern:
|
|
2661
|
+
import_v417.z.object({
|
|
2662
|
+
type: import_v417.z.literal("find"),
|
|
2663
|
+
url: import_v417.z.string(),
|
|
2664
|
+
pattern: import_v417.z.string()
|
|
2548
2665
|
})
|
|
2549
2666
|
])
|
|
2550
2667
|
}),
|
|
2551
|
-
|
|
2552
|
-
type:
|
|
2553
|
-
id:
|
|
2554
|
-
queries:
|
|
2555
|
-
results:
|
|
2556
|
-
|
|
2557
|
-
attributes:
|
|
2558
|
-
|
|
2559
|
-
|
|
2668
|
+
import_v417.z.object({
|
|
2669
|
+
type: import_v417.z.literal("file_search_call"),
|
|
2670
|
+
id: import_v417.z.string(),
|
|
2671
|
+
queries: import_v417.z.array(import_v417.z.string()),
|
|
2672
|
+
results: import_v417.z.array(
|
|
2673
|
+
import_v417.z.object({
|
|
2674
|
+
attributes: import_v417.z.record(
|
|
2675
|
+
import_v417.z.string(),
|
|
2676
|
+
import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
|
|
2560
2677
|
),
|
|
2561
|
-
file_id:
|
|
2562
|
-
filename:
|
|
2563
|
-
score:
|
|
2564
|
-
text:
|
|
2678
|
+
file_id: import_v417.z.string(),
|
|
2679
|
+
filename: import_v417.z.string(),
|
|
2680
|
+
score: import_v417.z.number(),
|
|
2681
|
+
text: import_v417.z.string()
|
|
2565
2682
|
})
|
|
2566
2683
|
).nullish()
|
|
2567
2684
|
}),
|
|
2568
|
-
|
|
2569
|
-
type:
|
|
2570
|
-
id:
|
|
2571
|
-
call_id:
|
|
2572
|
-
action:
|
|
2573
|
-
type:
|
|
2574
|
-
command:
|
|
2575
|
-
timeout_ms:
|
|
2576
|
-
user:
|
|
2577
|
-
working_directory:
|
|
2578
|
-
env:
|
|
2685
|
+
import_v417.z.object({
|
|
2686
|
+
type: import_v417.z.literal("local_shell_call"),
|
|
2687
|
+
id: import_v417.z.string(),
|
|
2688
|
+
call_id: import_v417.z.string(),
|
|
2689
|
+
action: import_v417.z.object({
|
|
2690
|
+
type: import_v417.z.literal("exec"),
|
|
2691
|
+
command: import_v417.z.array(import_v417.z.string()),
|
|
2692
|
+
timeout_ms: import_v417.z.number().optional(),
|
|
2693
|
+
user: import_v417.z.string().optional(),
|
|
2694
|
+
working_directory: import_v417.z.string().optional(),
|
|
2695
|
+
env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
|
|
2579
2696
|
})
|
|
2580
2697
|
}),
|
|
2581
|
-
|
|
2582
|
-
type:
|
|
2583
|
-
id:
|
|
2584
|
-
status:
|
|
2698
|
+
import_v417.z.object({
|
|
2699
|
+
type: import_v417.z.literal("computer_call"),
|
|
2700
|
+
id: import_v417.z.string(),
|
|
2701
|
+
status: import_v417.z.literal("completed")
|
|
2702
|
+
}),
|
|
2703
|
+
import_v417.z.object({
|
|
2704
|
+
type: import_v417.z.literal("mcp_call"),
|
|
2705
|
+
id: import_v417.z.string(),
|
|
2706
|
+
status: import_v417.z.string(),
|
|
2707
|
+
arguments: import_v417.z.string(),
|
|
2708
|
+
name: import_v417.z.string(),
|
|
2709
|
+
server_label: import_v417.z.string(),
|
|
2710
|
+
output: import_v417.z.string().nullish(),
|
|
2711
|
+
error: import_v417.z.union([
|
|
2712
|
+
import_v417.z.string(),
|
|
2713
|
+
import_v417.z.object({
|
|
2714
|
+
type: import_v417.z.string().optional(),
|
|
2715
|
+
code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
|
|
2716
|
+
message: import_v417.z.string().optional()
|
|
2717
|
+
}).loose()
|
|
2718
|
+
]).nullish()
|
|
2719
|
+
}),
|
|
2720
|
+
import_v417.z.object({
|
|
2721
|
+
type: import_v417.z.literal("mcp_list_tools"),
|
|
2722
|
+
id: import_v417.z.string(),
|
|
2723
|
+
server_label: import_v417.z.string(),
|
|
2724
|
+
tools: import_v417.z.array(
|
|
2725
|
+
import_v417.z.object({
|
|
2726
|
+
name: import_v417.z.string(),
|
|
2727
|
+
description: import_v417.z.string().optional(),
|
|
2728
|
+
input_schema: import_v417.z.any(),
|
|
2729
|
+
annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
|
|
2730
|
+
})
|
|
2731
|
+
),
|
|
2732
|
+
error: import_v417.z.union([
|
|
2733
|
+
import_v417.z.string(),
|
|
2734
|
+
import_v417.z.object({
|
|
2735
|
+
type: import_v417.z.string().optional(),
|
|
2736
|
+
code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
|
|
2737
|
+
message: import_v417.z.string().optional()
|
|
2738
|
+
}).loose()
|
|
2739
|
+
]).optional()
|
|
2740
|
+
}),
|
|
2741
|
+
import_v417.z.object({
|
|
2742
|
+
type: import_v417.z.literal("mcp_approval_request"),
|
|
2743
|
+
id: import_v417.z.string(),
|
|
2744
|
+
server_label: import_v417.z.string(),
|
|
2745
|
+
name: import_v417.z.string(),
|
|
2746
|
+
arguments: import_v417.z.string(),
|
|
2747
|
+
approval_request_id: import_v417.z.string()
|
|
2585
2748
|
})
|
|
2586
2749
|
])
|
|
2587
2750
|
}),
|
|
2588
|
-
|
|
2589
|
-
type:
|
|
2590
|
-
item_id:
|
|
2591
|
-
output_index:
|
|
2592
|
-
delta:
|
|
2751
|
+
import_v417.z.object({
|
|
2752
|
+
type: import_v417.z.literal("response.function_call_arguments.delta"),
|
|
2753
|
+
item_id: import_v417.z.string(),
|
|
2754
|
+
output_index: import_v417.z.number(),
|
|
2755
|
+
delta: import_v417.z.string()
|
|
2593
2756
|
}),
|
|
2594
|
-
|
|
2595
|
-
type:
|
|
2596
|
-
item_id:
|
|
2597
|
-
output_index:
|
|
2598
|
-
partial_image_b64:
|
|
2757
|
+
import_v417.z.object({
|
|
2758
|
+
type: import_v417.z.literal("response.image_generation_call.partial_image"),
|
|
2759
|
+
item_id: import_v417.z.string(),
|
|
2760
|
+
output_index: import_v417.z.number(),
|
|
2761
|
+
partial_image_b64: import_v417.z.string()
|
|
2599
2762
|
}),
|
|
2600
|
-
|
|
2601
|
-
type:
|
|
2602
|
-
item_id:
|
|
2603
|
-
output_index:
|
|
2604
|
-
delta:
|
|
2763
|
+
import_v417.z.object({
|
|
2764
|
+
type: import_v417.z.literal("response.code_interpreter_call_code.delta"),
|
|
2765
|
+
item_id: import_v417.z.string(),
|
|
2766
|
+
output_index: import_v417.z.number(),
|
|
2767
|
+
delta: import_v417.z.string()
|
|
2605
2768
|
}),
|
|
2606
|
-
|
|
2607
|
-
type:
|
|
2608
|
-
item_id:
|
|
2609
|
-
output_index:
|
|
2610
|
-
code:
|
|
2769
|
+
import_v417.z.object({
|
|
2770
|
+
type: import_v417.z.literal("response.code_interpreter_call_code.done"),
|
|
2771
|
+
item_id: import_v417.z.string(),
|
|
2772
|
+
output_index: import_v417.z.number(),
|
|
2773
|
+
code: import_v417.z.string()
|
|
2611
2774
|
}),
|
|
2612
|
-
|
|
2613
|
-
type:
|
|
2614
|
-
annotation:
|
|
2615
|
-
|
|
2616
|
-
type:
|
|
2617
|
-
url:
|
|
2618
|
-
title:
|
|
2775
|
+
import_v417.z.object({
|
|
2776
|
+
type: import_v417.z.literal("response.output_text.annotation.added"),
|
|
2777
|
+
annotation: import_v417.z.discriminatedUnion("type", [
|
|
2778
|
+
import_v417.z.object({
|
|
2779
|
+
type: import_v417.z.literal("url_citation"),
|
|
2780
|
+
url: import_v417.z.string(),
|
|
2781
|
+
title: import_v417.z.string()
|
|
2619
2782
|
}),
|
|
2620
|
-
|
|
2621
|
-
type:
|
|
2622
|
-
file_id:
|
|
2623
|
-
filename:
|
|
2624
|
-
index:
|
|
2625
|
-
start_index:
|
|
2626
|
-
end_index:
|
|
2627
|
-
quote:
|
|
2783
|
+
import_v417.z.object({
|
|
2784
|
+
type: import_v417.z.literal("file_citation"),
|
|
2785
|
+
file_id: import_v417.z.string(),
|
|
2786
|
+
filename: import_v417.z.string().nullish(),
|
|
2787
|
+
index: import_v417.z.number().nullish(),
|
|
2788
|
+
start_index: import_v417.z.number().nullish(),
|
|
2789
|
+
end_index: import_v417.z.number().nullish(),
|
|
2790
|
+
quote: import_v417.z.string().nullish()
|
|
2628
2791
|
}),
|
|
2629
|
-
|
|
2630
|
-
type:
|
|
2631
|
-
container_id:
|
|
2632
|
-
file_id:
|
|
2633
|
-
filename:
|
|
2634
|
-
start_index:
|
|
2635
|
-
end_index:
|
|
2636
|
-
index:
|
|
2792
|
+
import_v417.z.object({
|
|
2793
|
+
type: import_v417.z.literal("container_file_citation"),
|
|
2794
|
+
container_id: import_v417.z.string(),
|
|
2795
|
+
file_id: import_v417.z.string(),
|
|
2796
|
+
filename: import_v417.z.string().nullish(),
|
|
2797
|
+
start_index: import_v417.z.number().nullish(),
|
|
2798
|
+
end_index: import_v417.z.number().nullish(),
|
|
2799
|
+
index: import_v417.z.number().nullish()
|
|
2637
2800
|
}),
|
|
2638
|
-
|
|
2639
|
-
type:
|
|
2640
|
-
file_id:
|
|
2641
|
-
index:
|
|
2801
|
+
import_v417.z.object({
|
|
2802
|
+
type: import_v417.z.literal("file_path"),
|
|
2803
|
+
file_id: import_v417.z.string(),
|
|
2804
|
+
index: import_v417.z.number().nullish()
|
|
2642
2805
|
})
|
|
2643
2806
|
])
|
|
2644
2807
|
}),
|
|
2645
|
-
|
|
2646
|
-
type:
|
|
2647
|
-
item_id:
|
|
2648
|
-
summary_index:
|
|
2808
|
+
import_v417.z.object({
|
|
2809
|
+
type: import_v417.z.literal("response.reasoning_summary_part.added"),
|
|
2810
|
+
item_id: import_v417.z.string(),
|
|
2811
|
+
summary_index: import_v417.z.number()
|
|
2649
2812
|
}),
|
|
2650
|
-
|
|
2651
|
-
type:
|
|
2652
|
-
item_id:
|
|
2653
|
-
summary_index:
|
|
2654
|
-
delta:
|
|
2813
|
+
import_v417.z.object({
|
|
2814
|
+
type: import_v417.z.literal("response.reasoning_summary_text.delta"),
|
|
2815
|
+
item_id: import_v417.z.string(),
|
|
2816
|
+
summary_index: import_v417.z.number(),
|
|
2817
|
+
delta: import_v417.z.string()
|
|
2655
2818
|
}),
|
|
2656
|
-
|
|
2657
|
-
type:
|
|
2658
|
-
item_id:
|
|
2659
|
-
summary_index:
|
|
2819
|
+
import_v417.z.object({
|
|
2820
|
+
type: import_v417.z.literal("response.reasoning_summary_part.done"),
|
|
2821
|
+
item_id: import_v417.z.string(),
|
|
2822
|
+
summary_index: import_v417.z.number()
|
|
2660
2823
|
}),
|
|
2661
|
-
|
|
2662
|
-
type:
|
|
2663
|
-
code:
|
|
2664
|
-
message:
|
|
2665
|
-
param:
|
|
2666
|
-
sequence_number:
|
|
2824
|
+
import_v417.z.object({
|
|
2825
|
+
type: import_v417.z.literal("error"),
|
|
2826
|
+
code: import_v417.z.string(),
|
|
2827
|
+
message: import_v417.z.string(),
|
|
2828
|
+
param: import_v417.z.string().nullish(),
|
|
2829
|
+
sequence_number: import_v417.z.number()
|
|
2667
2830
|
}),
|
|
2668
|
-
|
|
2831
|
+
import_v417.z.object({ type: import_v417.z.string() }).loose().transform((value) => ({
|
|
2669
2832
|
type: "unknown_chunk",
|
|
2670
2833
|
message: value.type
|
|
2671
2834
|
}))
|
|
@@ -2673,198 +2836,248 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2673
2836
|
])
|
|
2674
2837
|
)
|
|
2675
2838
|
);
|
|
2676
|
-
var openaiResponsesResponseSchema = (0,
|
|
2677
|
-
() => (0,
|
|
2678
|
-
|
|
2679
|
-
id:
|
|
2680
|
-
created_at:
|
|
2681
|
-
error:
|
|
2682
|
-
code:
|
|
2683
|
-
message:
|
|
2839
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils22.lazySchema)(
|
|
2840
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2841
|
+
import_v417.z.object({
|
|
2842
|
+
id: import_v417.z.string(),
|
|
2843
|
+
created_at: import_v417.z.number(),
|
|
2844
|
+
error: import_v417.z.object({
|
|
2845
|
+
code: import_v417.z.string(),
|
|
2846
|
+
message: import_v417.z.string()
|
|
2684
2847
|
}).nullish(),
|
|
2685
|
-
model:
|
|
2686
|
-
output:
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
type:
|
|
2690
|
-
role:
|
|
2691
|
-
id:
|
|
2692
|
-
content:
|
|
2693
|
-
|
|
2694
|
-
type:
|
|
2695
|
-
text:
|
|
2696
|
-
logprobs:
|
|
2697
|
-
|
|
2698
|
-
token:
|
|
2699
|
-
logprob:
|
|
2700
|
-
top_logprobs:
|
|
2701
|
-
|
|
2702
|
-
token:
|
|
2703
|
-
logprob:
|
|
2848
|
+
model: import_v417.z.string(),
|
|
2849
|
+
output: import_v417.z.array(
|
|
2850
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2851
|
+
import_v417.z.object({
|
|
2852
|
+
type: import_v417.z.literal("message"),
|
|
2853
|
+
role: import_v417.z.literal("assistant"),
|
|
2854
|
+
id: import_v417.z.string(),
|
|
2855
|
+
content: import_v417.z.array(
|
|
2856
|
+
import_v417.z.object({
|
|
2857
|
+
type: import_v417.z.literal("output_text"),
|
|
2858
|
+
text: import_v417.z.string(),
|
|
2859
|
+
logprobs: import_v417.z.array(
|
|
2860
|
+
import_v417.z.object({
|
|
2861
|
+
token: import_v417.z.string(),
|
|
2862
|
+
logprob: import_v417.z.number(),
|
|
2863
|
+
top_logprobs: import_v417.z.array(
|
|
2864
|
+
import_v417.z.object({
|
|
2865
|
+
token: import_v417.z.string(),
|
|
2866
|
+
logprob: import_v417.z.number()
|
|
2704
2867
|
})
|
|
2705
2868
|
)
|
|
2706
2869
|
})
|
|
2707
2870
|
).nullish(),
|
|
2708
|
-
annotations:
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
type:
|
|
2712
|
-
start_index:
|
|
2713
|
-
end_index:
|
|
2714
|
-
url:
|
|
2715
|
-
title:
|
|
2871
|
+
annotations: import_v417.z.array(
|
|
2872
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2873
|
+
import_v417.z.object({
|
|
2874
|
+
type: import_v417.z.literal("url_citation"),
|
|
2875
|
+
start_index: import_v417.z.number(),
|
|
2876
|
+
end_index: import_v417.z.number(),
|
|
2877
|
+
url: import_v417.z.string(),
|
|
2878
|
+
title: import_v417.z.string()
|
|
2716
2879
|
}),
|
|
2717
|
-
|
|
2718
|
-
type:
|
|
2719
|
-
file_id:
|
|
2720
|
-
filename:
|
|
2721
|
-
index:
|
|
2722
|
-
start_index:
|
|
2723
|
-
end_index:
|
|
2724
|
-
quote:
|
|
2880
|
+
import_v417.z.object({
|
|
2881
|
+
type: import_v417.z.literal("file_citation"),
|
|
2882
|
+
file_id: import_v417.z.string(),
|
|
2883
|
+
filename: import_v417.z.string().nullish(),
|
|
2884
|
+
index: import_v417.z.number().nullish(),
|
|
2885
|
+
start_index: import_v417.z.number().nullish(),
|
|
2886
|
+
end_index: import_v417.z.number().nullish(),
|
|
2887
|
+
quote: import_v417.z.string().nullish()
|
|
2725
2888
|
}),
|
|
2726
|
-
|
|
2727
|
-
type:
|
|
2728
|
-
container_id:
|
|
2729
|
-
file_id:
|
|
2730
|
-
filename:
|
|
2731
|
-
start_index:
|
|
2732
|
-
end_index:
|
|
2733
|
-
index:
|
|
2889
|
+
import_v417.z.object({
|
|
2890
|
+
type: import_v417.z.literal("container_file_citation"),
|
|
2891
|
+
container_id: import_v417.z.string(),
|
|
2892
|
+
file_id: import_v417.z.string(),
|
|
2893
|
+
filename: import_v417.z.string().nullish(),
|
|
2894
|
+
start_index: import_v417.z.number().nullish(),
|
|
2895
|
+
end_index: import_v417.z.number().nullish(),
|
|
2896
|
+
index: import_v417.z.number().nullish()
|
|
2734
2897
|
}),
|
|
2735
|
-
|
|
2736
|
-
type:
|
|
2737
|
-
file_id:
|
|
2738
|
-
index:
|
|
2898
|
+
import_v417.z.object({
|
|
2899
|
+
type: import_v417.z.literal("file_path"),
|
|
2900
|
+
file_id: import_v417.z.string(),
|
|
2901
|
+
index: import_v417.z.number().nullish()
|
|
2739
2902
|
})
|
|
2740
2903
|
])
|
|
2741
2904
|
)
|
|
2742
2905
|
})
|
|
2743
2906
|
)
|
|
2744
2907
|
}),
|
|
2745
|
-
|
|
2746
|
-
type:
|
|
2747
|
-
id:
|
|
2748
|
-
status:
|
|
2749
|
-
action:
|
|
2750
|
-
|
|
2751
|
-
type:
|
|
2752
|
-
query:
|
|
2753
|
-
sources:
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2908
|
+
import_v417.z.object({
|
|
2909
|
+
type: import_v417.z.literal("web_search_call"),
|
|
2910
|
+
id: import_v417.z.string(),
|
|
2911
|
+
status: import_v417.z.string(),
|
|
2912
|
+
action: import_v417.z.discriminatedUnion("type", [
|
|
2913
|
+
import_v417.z.object({
|
|
2914
|
+
type: import_v417.z.literal("search"),
|
|
2915
|
+
query: import_v417.z.string().nullish(),
|
|
2916
|
+
sources: import_v417.z.array(
|
|
2917
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2918
|
+
import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
|
|
2919
|
+
import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
|
|
2757
2920
|
])
|
|
2758
2921
|
).nullish()
|
|
2759
2922
|
}),
|
|
2760
|
-
|
|
2761
|
-
type:
|
|
2762
|
-
url:
|
|
2923
|
+
import_v417.z.object({
|
|
2924
|
+
type: import_v417.z.literal("open_page"),
|
|
2925
|
+
url: import_v417.z.string()
|
|
2763
2926
|
}),
|
|
2764
|
-
|
|
2765
|
-
type:
|
|
2766
|
-
url:
|
|
2767
|
-
pattern:
|
|
2927
|
+
import_v417.z.object({
|
|
2928
|
+
type: import_v417.z.literal("find"),
|
|
2929
|
+
url: import_v417.z.string(),
|
|
2930
|
+
pattern: import_v417.z.string()
|
|
2768
2931
|
})
|
|
2769
2932
|
])
|
|
2770
2933
|
}),
|
|
2771
|
-
|
|
2772
|
-
type:
|
|
2773
|
-
id:
|
|
2774
|
-
queries:
|
|
2775
|
-
results:
|
|
2776
|
-
|
|
2777
|
-
attributes:
|
|
2778
|
-
|
|
2779
|
-
|
|
2934
|
+
import_v417.z.object({
|
|
2935
|
+
type: import_v417.z.literal("file_search_call"),
|
|
2936
|
+
id: import_v417.z.string(),
|
|
2937
|
+
queries: import_v417.z.array(import_v417.z.string()),
|
|
2938
|
+
results: import_v417.z.array(
|
|
2939
|
+
import_v417.z.object({
|
|
2940
|
+
attributes: import_v417.z.record(
|
|
2941
|
+
import_v417.z.string(),
|
|
2942
|
+
import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
|
|
2780
2943
|
),
|
|
2781
|
-
file_id:
|
|
2782
|
-
filename:
|
|
2783
|
-
score:
|
|
2784
|
-
text:
|
|
2944
|
+
file_id: import_v417.z.string(),
|
|
2945
|
+
filename: import_v417.z.string(),
|
|
2946
|
+
score: import_v417.z.number(),
|
|
2947
|
+
text: import_v417.z.string()
|
|
2785
2948
|
})
|
|
2786
2949
|
).nullish()
|
|
2787
2950
|
}),
|
|
2788
|
-
|
|
2789
|
-
type:
|
|
2790
|
-
id:
|
|
2791
|
-
code:
|
|
2792
|
-
container_id:
|
|
2793
|
-
outputs:
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2951
|
+
import_v417.z.object({
|
|
2952
|
+
type: import_v417.z.literal("code_interpreter_call"),
|
|
2953
|
+
id: import_v417.z.string(),
|
|
2954
|
+
code: import_v417.z.string().nullable(),
|
|
2955
|
+
container_id: import_v417.z.string(),
|
|
2956
|
+
outputs: import_v417.z.array(
|
|
2957
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2958
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
2959
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
2797
2960
|
])
|
|
2798
2961
|
).nullable()
|
|
2799
2962
|
}),
|
|
2800
|
-
|
|
2801
|
-
type:
|
|
2802
|
-
id:
|
|
2803
|
-
result:
|
|
2963
|
+
import_v417.z.object({
|
|
2964
|
+
type: import_v417.z.literal("image_generation_call"),
|
|
2965
|
+
id: import_v417.z.string(),
|
|
2966
|
+
result: import_v417.z.string()
|
|
2804
2967
|
}),
|
|
2805
|
-
|
|
2806
|
-
type:
|
|
2807
|
-
id:
|
|
2808
|
-
call_id:
|
|
2809
|
-
action:
|
|
2810
|
-
type:
|
|
2811
|
-
command:
|
|
2812
|
-
timeout_ms:
|
|
2813
|
-
user:
|
|
2814
|
-
working_directory:
|
|
2815
|
-
env:
|
|
2968
|
+
import_v417.z.object({
|
|
2969
|
+
type: import_v417.z.literal("local_shell_call"),
|
|
2970
|
+
id: import_v417.z.string(),
|
|
2971
|
+
call_id: import_v417.z.string(),
|
|
2972
|
+
action: import_v417.z.object({
|
|
2973
|
+
type: import_v417.z.literal("exec"),
|
|
2974
|
+
command: import_v417.z.array(import_v417.z.string()),
|
|
2975
|
+
timeout_ms: import_v417.z.number().optional(),
|
|
2976
|
+
user: import_v417.z.string().optional(),
|
|
2977
|
+
working_directory: import_v417.z.string().optional(),
|
|
2978
|
+
env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
|
|
2816
2979
|
})
|
|
2817
2980
|
}),
|
|
2818
|
-
|
|
2819
|
-
type:
|
|
2820
|
-
call_id:
|
|
2821
|
-
name:
|
|
2822
|
-
arguments:
|
|
2823
|
-
id:
|
|
2981
|
+
import_v417.z.object({
|
|
2982
|
+
type: import_v417.z.literal("function_call"),
|
|
2983
|
+
call_id: import_v417.z.string(),
|
|
2984
|
+
name: import_v417.z.string(),
|
|
2985
|
+
arguments: import_v417.z.string(),
|
|
2986
|
+
id: import_v417.z.string()
|
|
2824
2987
|
}),
|
|
2825
|
-
|
|
2826
|
-
type:
|
|
2827
|
-
id:
|
|
2828
|
-
status:
|
|
2988
|
+
import_v417.z.object({
|
|
2989
|
+
type: import_v417.z.literal("computer_call"),
|
|
2990
|
+
id: import_v417.z.string(),
|
|
2991
|
+
status: import_v417.z.string().optional()
|
|
2829
2992
|
}),
|
|
2830
|
-
|
|
2831
|
-
type:
|
|
2832
|
-
id:
|
|
2833
|
-
encrypted_content:
|
|
2834
|
-
summary:
|
|
2835
|
-
|
|
2836
|
-
type:
|
|
2837
|
-
text:
|
|
2993
|
+
import_v417.z.object({
|
|
2994
|
+
type: import_v417.z.literal("reasoning"),
|
|
2995
|
+
id: import_v417.z.string(),
|
|
2996
|
+
encrypted_content: import_v417.z.string().nullish(),
|
|
2997
|
+
summary: import_v417.z.array(
|
|
2998
|
+
import_v417.z.object({
|
|
2999
|
+
type: import_v417.z.literal("summary_text"),
|
|
3000
|
+
text: import_v417.z.string()
|
|
2838
3001
|
})
|
|
2839
3002
|
)
|
|
3003
|
+
}),
|
|
3004
|
+
import_v417.z.object({
|
|
3005
|
+
type: import_v417.z.literal("mcp_call"),
|
|
3006
|
+
id: import_v417.z.string(),
|
|
3007
|
+
status: import_v417.z.string(),
|
|
3008
|
+
arguments: import_v417.z.string(),
|
|
3009
|
+
name: import_v417.z.string(),
|
|
3010
|
+
server_label: import_v417.z.string(),
|
|
3011
|
+
output: import_v417.z.string().nullish(),
|
|
3012
|
+
error: import_v417.z.union([
|
|
3013
|
+
import_v417.z.string(),
|
|
3014
|
+
import_v417.z.object({
|
|
3015
|
+
type: import_v417.z.string().optional(),
|
|
3016
|
+
code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
|
|
3017
|
+
message: import_v417.z.string().optional()
|
|
3018
|
+
}).loose()
|
|
3019
|
+
]).nullish()
|
|
3020
|
+
}),
|
|
3021
|
+
import_v417.z.object({
|
|
3022
|
+
type: import_v417.z.literal("mcp_list_tools"),
|
|
3023
|
+
id: import_v417.z.string(),
|
|
3024
|
+
server_label: import_v417.z.string(),
|
|
3025
|
+
tools: import_v417.z.array(
|
|
3026
|
+
import_v417.z.object({
|
|
3027
|
+
name: import_v417.z.string(),
|
|
3028
|
+
description: import_v417.z.string().optional(),
|
|
3029
|
+
input_schema: import_v417.z.any(),
|
|
3030
|
+
annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
|
|
3031
|
+
})
|
|
3032
|
+
),
|
|
3033
|
+
error: import_v417.z.union([
|
|
3034
|
+
import_v417.z.string(),
|
|
3035
|
+
import_v417.z.object({
|
|
3036
|
+
type: import_v417.z.string().optional(),
|
|
3037
|
+
code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
|
|
3038
|
+
message: import_v417.z.string().optional()
|
|
3039
|
+
}).loose()
|
|
3040
|
+
]).optional()
|
|
3041
|
+
}),
|
|
3042
|
+
import_v417.z.object({
|
|
3043
|
+
type: import_v417.z.literal("mcp_approval_request"),
|
|
3044
|
+
id: import_v417.z.string(),
|
|
3045
|
+
server_label: import_v417.z.string(),
|
|
3046
|
+
name: import_v417.z.string(),
|
|
3047
|
+
arguments: import_v417.z.string(),
|
|
3048
|
+
approval_request_id: import_v417.z.string()
|
|
2840
3049
|
})
|
|
2841
3050
|
])
|
|
2842
3051
|
),
|
|
2843
|
-
service_tier:
|
|
2844
|
-
incomplete_details:
|
|
2845
|
-
usage:
|
|
2846
|
-
input_tokens:
|
|
2847
|
-
input_tokens_details:
|
|
2848
|
-
output_tokens:
|
|
2849
|
-
output_tokens_details:
|
|
3052
|
+
service_tier: import_v417.z.string().nullish(),
|
|
3053
|
+
incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
|
|
3054
|
+
usage: import_v417.z.object({
|
|
3055
|
+
input_tokens: import_v417.z.number(),
|
|
3056
|
+
input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
|
|
3057
|
+
output_tokens: import_v417.z.number(),
|
|
3058
|
+
output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
|
|
2850
3059
|
})
|
|
2851
3060
|
})
|
|
2852
3061
|
)
|
|
2853
3062
|
);
|
|
2854
3063
|
|
|
2855
3064
|
// src/responses/openai-responses-options.ts
|
|
2856
|
-
var
|
|
2857
|
-
var
|
|
3065
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
3066
|
+
var import_v418 = require("zod/v4");
|
|
2858
3067
|
var TOP_LOGPROBS_MAX = 20;
|
|
2859
3068
|
var openaiResponsesReasoningModelIds = [
|
|
2860
3069
|
"o1",
|
|
2861
3070
|
"o1-2024-12-17",
|
|
2862
|
-
"o3-mini",
|
|
2863
|
-
"o3-mini-2025-01-31",
|
|
2864
3071
|
"o3",
|
|
2865
3072
|
"o3-2025-04-16",
|
|
3073
|
+
"o3-deep-research",
|
|
3074
|
+
"o3-deep-research-2025-06-26",
|
|
3075
|
+
"o3-mini",
|
|
3076
|
+
"o3-mini-2025-01-31",
|
|
2866
3077
|
"o4-mini",
|
|
2867
3078
|
"o4-mini-2025-04-16",
|
|
3079
|
+
"o4-mini-deep-research",
|
|
3080
|
+
"o4-mini-deep-research-2025-06-26",
|
|
2868
3081
|
"codex-mini-latest",
|
|
2869
3082
|
"computer-use-preview",
|
|
2870
3083
|
"gpt-5",
|
|
@@ -2913,18 +3126,18 @@ var openaiResponsesModelIds = [
|
|
|
2913
3126
|
"gpt-5-chat-latest",
|
|
2914
3127
|
...openaiResponsesReasoningModelIds
|
|
2915
3128
|
];
|
|
2916
|
-
var openaiResponsesProviderOptionsSchema = (0,
|
|
2917
|
-
() => (0,
|
|
2918
|
-
|
|
2919
|
-
include:
|
|
2920
|
-
|
|
3129
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazySchema)(
|
|
3130
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
3131
|
+
import_v418.z.object({
|
|
3132
|
+
include: import_v418.z.array(
|
|
3133
|
+
import_v418.z.enum([
|
|
2921
3134
|
"reasoning.encrypted_content",
|
|
2922
3135
|
// handled internally by default, only needed for unknown reasoning models
|
|
2923
3136
|
"file_search_call.results",
|
|
2924
3137
|
"message.output_text.logprobs"
|
|
2925
3138
|
])
|
|
2926
3139
|
).nullish(),
|
|
2927
|
-
instructions:
|
|
3140
|
+
instructions: import_v418.z.string().nullish(),
|
|
2928
3141
|
/**
|
|
2929
3142
|
* Return the log probabilities of the tokens.
|
|
2930
3143
|
*
|
|
@@ -2937,33 +3150,33 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazySchem
|
|
|
2937
3150
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
2938
3151
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
2939
3152
|
*/
|
|
2940
|
-
logprobs:
|
|
3153
|
+
logprobs: import_v418.z.union([import_v418.z.boolean(), import_v418.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
2941
3154
|
/**
|
|
2942
3155
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
2943
3156
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
2944
3157
|
* Any further attempts to call a tool by the model will be ignored.
|
|
2945
3158
|
*/
|
|
2946
|
-
maxToolCalls:
|
|
2947
|
-
metadata:
|
|
2948
|
-
parallelToolCalls:
|
|
2949
|
-
previousResponseId:
|
|
2950
|
-
promptCacheKey:
|
|
2951
|
-
reasoningEffort:
|
|
2952
|
-
reasoningSummary:
|
|
2953
|
-
safetyIdentifier:
|
|
2954
|
-
serviceTier:
|
|
2955
|
-
store:
|
|
2956
|
-
strictJsonSchema:
|
|
2957
|
-
textVerbosity:
|
|
2958
|
-
truncation:
|
|
2959
|
-
user:
|
|
3159
|
+
maxToolCalls: import_v418.z.number().nullish(),
|
|
3160
|
+
metadata: import_v418.z.any().nullish(),
|
|
3161
|
+
parallelToolCalls: import_v418.z.boolean().nullish(),
|
|
3162
|
+
previousResponseId: import_v418.z.string().nullish(),
|
|
3163
|
+
promptCacheKey: import_v418.z.string().nullish(),
|
|
3164
|
+
reasoningEffort: import_v418.z.string().nullish(),
|
|
3165
|
+
reasoningSummary: import_v418.z.string().nullish(),
|
|
3166
|
+
safetyIdentifier: import_v418.z.string().nullish(),
|
|
3167
|
+
serviceTier: import_v418.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3168
|
+
store: import_v418.z.boolean().nullish(),
|
|
3169
|
+
strictJsonSchema: import_v418.z.boolean().nullish(),
|
|
3170
|
+
textVerbosity: import_v418.z.enum(["low", "medium", "high"]).nullish(),
|
|
3171
|
+
truncation: import_v418.z.enum(["auto", "disabled"]).nullish(),
|
|
3172
|
+
user: import_v418.z.string().nullish()
|
|
2960
3173
|
})
|
|
2961
3174
|
)
|
|
2962
3175
|
);
|
|
2963
3176
|
|
|
2964
3177
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2965
3178
|
var import_provider7 = require("@ai-sdk/provider");
|
|
2966
|
-
var
|
|
3179
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
2967
3180
|
async function prepareResponsesTools({
|
|
2968
3181
|
tools,
|
|
2969
3182
|
toolChoice,
|
|
@@ -2989,7 +3202,7 @@ async function prepareResponsesTools({
|
|
|
2989
3202
|
case "provider-defined": {
|
|
2990
3203
|
switch (tool.id) {
|
|
2991
3204
|
case "openai.file_search": {
|
|
2992
|
-
const args = await (0,
|
|
3205
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
2993
3206
|
value: tool.args,
|
|
2994
3207
|
schema: fileSearchArgsSchema
|
|
2995
3208
|
});
|
|
@@ -3012,7 +3225,7 @@ async function prepareResponsesTools({
|
|
|
3012
3225
|
break;
|
|
3013
3226
|
}
|
|
3014
3227
|
case "openai.web_search_preview": {
|
|
3015
|
-
const args = await (0,
|
|
3228
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
3016
3229
|
value: tool.args,
|
|
3017
3230
|
schema: webSearchPreviewArgsSchema
|
|
3018
3231
|
});
|
|
@@ -3024,7 +3237,7 @@ async function prepareResponsesTools({
|
|
|
3024
3237
|
break;
|
|
3025
3238
|
}
|
|
3026
3239
|
case "openai.web_search": {
|
|
3027
|
-
const args = await (0,
|
|
3240
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
3028
3241
|
value: tool.args,
|
|
3029
3242
|
schema: webSearchArgsSchema
|
|
3030
3243
|
});
|
|
@@ -3037,7 +3250,7 @@ async function prepareResponsesTools({
|
|
|
3037
3250
|
break;
|
|
3038
3251
|
}
|
|
3039
3252
|
case "openai.code_interpreter": {
|
|
3040
|
-
const args = await (0,
|
|
3253
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
3041
3254
|
value: tool.args,
|
|
3042
3255
|
schema: codeInterpreterArgsSchema
|
|
3043
3256
|
});
|
|
@@ -3048,7 +3261,7 @@ async function prepareResponsesTools({
|
|
|
3048
3261
|
break;
|
|
3049
3262
|
}
|
|
3050
3263
|
case "openai.image_generation": {
|
|
3051
|
-
const args = await (0,
|
|
3264
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
3052
3265
|
value: tool.args,
|
|
3053
3266
|
schema: imageGenerationArgsSchema
|
|
3054
3267
|
});
|
|
@@ -3070,6 +3283,36 @@ async function prepareResponsesTools({
|
|
|
3070
3283
|
});
|
|
3071
3284
|
break;
|
|
3072
3285
|
}
|
|
3286
|
+
case "openai.mcp": {
|
|
3287
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
3288
|
+
value: tool.args,
|
|
3289
|
+
schema: mcpArgsSchema
|
|
3290
|
+
});
|
|
3291
|
+
openaiTools2.push({
|
|
3292
|
+
type: "mcp",
|
|
3293
|
+
server_label: args.serverLabel,
|
|
3294
|
+
allowed_tools: Array.isArray(args.allowedTools) ? args.allowedTools : args.allowedTools ? {
|
|
3295
|
+
read_only: args.allowedTools.readOnly,
|
|
3296
|
+
tool_names: args.allowedTools.toolNames
|
|
3297
|
+
} : void 0,
|
|
3298
|
+
authorization: args.authorization,
|
|
3299
|
+
connector_id: args.connectorId,
|
|
3300
|
+
headers: args.headers,
|
|
3301
|
+
// require_approval:
|
|
3302
|
+
// typeof args.requireApproval === 'string'
|
|
3303
|
+
// ? args.requireApproval
|
|
3304
|
+
// : args.requireApproval
|
|
3305
|
+
// ? {
|
|
3306
|
+
// read_only: args.requireApproval.readOnly,
|
|
3307
|
+
// tool_names: args.requireApproval.toolNames,
|
|
3308
|
+
// }
|
|
3309
|
+
// : undefined,
|
|
3310
|
+
require_approval: "never",
|
|
3311
|
+
server_description: args.serverDescription,
|
|
3312
|
+
server_url: args.serverUrl
|
|
3313
|
+
});
|
|
3314
|
+
break;
|
|
3315
|
+
}
|
|
3073
3316
|
}
|
|
3074
3317
|
break;
|
|
3075
3318
|
}
|
|
@@ -3090,7 +3333,7 @@ async function prepareResponsesTools({
|
|
|
3090
3333
|
case "tool":
|
|
3091
3334
|
return {
|
|
3092
3335
|
tools: openaiTools2,
|
|
3093
|
-
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
3336
|
+
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
3094
3337
|
toolWarnings
|
|
3095
3338
|
};
|
|
3096
3339
|
default: {
|
|
@@ -3155,7 +3398,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3155
3398
|
if (stopSequences != null) {
|
|
3156
3399
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
3157
3400
|
}
|
|
3158
|
-
const openaiOptions = await (0,
|
|
3401
|
+
const openaiOptions = await (0, import_provider_utils25.parseProviderOptions)({
|
|
3159
3402
|
provider: "openai",
|
|
3160
3403
|
providerOptions,
|
|
3161
3404
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -3331,12 +3574,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3331
3574
|
responseHeaders,
|
|
3332
3575
|
value: response,
|
|
3333
3576
|
rawValue: rawResponse
|
|
3334
|
-
} = await (0,
|
|
3577
|
+
} = await (0, import_provider_utils25.postJsonToApi)({
|
|
3335
3578
|
url,
|
|
3336
|
-
headers: (0,
|
|
3579
|
+
headers: (0, import_provider_utils25.combineHeaders)(this.config.headers(), options.headers),
|
|
3337
3580
|
body,
|
|
3338
3581
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3339
|
-
successfulResponseHandler: (0,
|
|
3582
|
+
successfulResponseHandler: (0, import_provider_utils25.createJsonResponseHandler)(
|
|
3340
3583
|
openaiResponsesResponseSchema
|
|
3341
3584
|
),
|
|
3342
3585
|
abortSignal: options.abortSignal,
|
|
@@ -3433,7 +3676,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3433
3676
|
content.push({
|
|
3434
3677
|
type: "source",
|
|
3435
3678
|
sourceType: "url",
|
|
3436
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
3679
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils25.generateId)(),
|
|
3437
3680
|
url: annotation.url,
|
|
3438
3681
|
title: annotation.title
|
|
3439
3682
|
});
|
|
@@ -3441,7 +3684,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3441
3684
|
content.push({
|
|
3442
3685
|
type: "source",
|
|
3443
3686
|
sourceType: "document",
|
|
3444
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
3687
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils25.generateId)(),
|
|
3445
3688
|
mediaType: "text/plain",
|
|
3446
3689
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3447
3690
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
@@ -3457,7 +3700,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3457
3700
|
content.push({
|
|
3458
3701
|
type: "source",
|
|
3459
3702
|
sourceType: "document",
|
|
3460
|
-
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
3703
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils25.generateId)(),
|
|
3461
3704
|
mediaType: "text/plain",
|
|
3462
3705
|
title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
|
|
3463
3706
|
filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
|
|
@@ -3473,7 +3716,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3473
3716
|
content.push({
|
|
3474
3717
|
type: "source",
|
|
3475
3718
|
sourceType: "document",
|
|
3476
|
-
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0,
|
|
3719
|
+
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils25.generateId)(),
|
|
3477
3720
|
mediaType: "application/octet-stream",
|
|
3478
3721
|
title: annotation.file_id,
|
|
3479
3722
|
filename: annotation.file_id,
|
|
@@ -3520,6 +3763,80 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3520
3763
|
});
|
|
3521
3764
|
break;
|
|
3522
3765
|
}
|
|
3766
|
+
case "mcp_call": {
|
|
3767
|
+
content.push({
|
|
3768
|
+
type: "tool-call",
|
|
3769
|
+
toolCallId: part.id,
|
|
3770
|
+
toolName: "mcp",
|
|
3771
|
+
input: JSON.stringify({}),
|
|
3772
|
+
providerExecuted: true
|
|
3773
|
+
});
|
|
3774
|
+
content.push({
|
|
3775
|
+
type: "tool-result",
|
|
3776
|
+
toolCallId: part.id,
|
|
3777
|
+
toolName: "mcp",
|
|
3778
|
+
result: {
|
|
3779
|
+
type: "call",
|
|
3780
|
+
serverLabel: part.server_label,
|
|
3781
|
+
name: part.name,
|
|
3782
|
+
arguments: part.arguments,
|
|
3783
|
+
...part.output != null ? { output: part.output } : {},
|
|
3784
|
+
...part.error != null ? { error: part.error } : {}
|
|
3785
|
+
}
|
|
3786
|
+
});
|
|
3787
|
+
break;
|
|
3788
|
+
}
|
|
3789
|
+
case "mcp_list_tools": {
|
|
3790
|
+
content.push({
|
|
3791
|
+
type: "tool-call",
|
|
3792
|
+
toolCallId: part.id,
|
|
3793
|
+
toolName: "mcp",
|
|
3794
|
+
input: JSON.stringify({}),
|
|
3795
|
+
providerExecuted: true
|
|
3796
|
+
});
|
|
3797
|
+
content.push({
|
|
3798
|
+
type: "tool-result",
|
|
3799
|
+
toolCallId: part.id,
|
|
3800
|
+
toolName: "mcp",
|
|
3801
|
+
result: {
|
|
3802
|
+
type: "listTools",
|
|
3803
|
+
serverLabel: part.server_label,
|
|
3804
|
+
tools: part.tools.map((t) => {
|
|
3805
|
+
var _a2, _b2;
|
|
3806
|
+
return {
|
|
3807
|
+
name: t.name,
|
|
3808
|
+
description: (_a2 = t.description) != null ? _a2 : void 0,
|
|
3809
|
+
inputSchema: t.input_schema,
|
|
3810
|
+
annotations: (_b2 = t.annotations) != null ? _b2 : void 0
|
|
3811
|
+
};
|
|
3812
|
+
}),
|
|
3813
|
+
...part.error != null ? { error: part.error } : {}
|
|
3814
|
+
}
|
|
3815
|
+
});
|
|
3816
|
+
break;
|
|
3817
|
+
}
|
|
3818
|
+
case "mcp_approval_request": {
|
|
3819
|
+
content.push({
|
|
3820
|
+
type: "tool-call",
|
|
3821
|
+
toolCallId: part.id,
|
|
3822
|
+
toolName: "mcp",
|
|
3823
|
+
input: JSON.stringify({}),
|
|
3824
|
+
providerExecuted: true
|
|
3825
|
+
});
|
|
3826
|
+
content.push({
|
|
3827
|
+
type: "tool-result",
|
|
3828
|
+
toolCallId: part.id,
|
|
3829
|
+
toolName: "mcp",
|
|
3830
|
+
result: {
|
|
3831
|
+
type: "approvalRequest",
|
|
3832
|
+
serverLabel: part.server_label,
|
|
3833
|
+
name: part.name,
|
|
3834
|
+
arguments: part.arguments,
|
|
3835
|
+
approvalRequestId: part.approval_request_id
|
|
3836
|
+
}
|
|
3837
|
+
});
|
|
3838
|
+
break;
|
|
3839
|
+
}
|
|
3523
3840
|
case "computer_call": {
|
|
3524
3841
|
content.push({
|
|
3525
3842
|
type: "tool-call",
|
|
@@ -3628,18 +3945,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3628
3945
|
webSearchToolName,
|
|
3629
3946
|
store
|
|
3630
3947
|
} = await this.getArgs(options);
|
|
3631
|
-
const { responseHeaders, value: response } = await (0,
|
|
3948
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils25.postJsonToApi)({
|
|
3632
3949
|
url: this.config.url({
|
|
3633
3950
|
path: "/responses",
|
|
3634
3951
|
modelId: this.modelId
|
|
3635
3952
|
}),
|
|
3636
|
-
headers: (0,
|
|
3953
|
+
headers: (0, import_provider_utils25.combineHeaders)(this.config.headers(), options.headers),
|
|
3637
3954
|
body: {
|
|
3638
3955
|
...body,
|
|
3639
3956
|
stream: true
|
|
3640
3957
|
},
|
|
3641
3958
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3642
|
-
successfulResponseHandler: (0,
|
|
3959
|
+
successfulResponseHandler: (0, import_provider_utils25.createEventSourceResponseHandler)(
|
|
3643
3960
|
openaiResponsesChunkSchema
|
|
3644
3961
|
),
|
|
3645
3962
|
abortSignal: options.abortSignal,
|
|
@@ -3754,6 +4071,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3754
4071
|
input: "{}",
|
|
3755
4072
|
providerExecuted: true
|
|
3756
4073
|
});
|
|
4074
|
+
} else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
|
|
4075
|
+
controller.enqueue({
|
|
4076
|
+
type: "tool-call",
|
|
4077
|
+
toolCallId: value.item.id,
|
|
4078
|
+
toolName: "mcp",
|
|
4079
|
+
input: "{}",
|
|
4080
|
+
providerExecuted: true
|
|
4081
|
+
});
|
|
3757
4082
|
} else if (value.item.type === "message") {
|
|
3758
4083
|
controller.enqueue({
|
|
3759
4084
|
type: "text-start",
|
|
@@ -3865,6 +4190,56 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3865
4190
|
result: value.item.result
|
|
3866
4191
|
}
|
|
3867
4192
|
});
|
|
4193
|
+
} else if (value.item.type === "mcp_call") {
|
|
4194
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
4195
|
+
controller.enqueue({
|
|
4196
|
+
type: "tool-result",
|
|
4197
|
+
toolCallId: value.item.id,
|
|
4198
|
+
toolName: "mcp",
|
|
4199
|
+
result: {
|
|
4200
|
+
type: "call",
|
|
4201
|
+
serverLabel: value.item.server_label,
|
|
4202
|
+
name: value.item.name,
|
|
4203
|
+
arguments: value.item.arguments,
|
|
4204
|
+
...value.item.output != null ? { output: value.item.output } : {},
|
|
4205
|
+
...value.item.error != null ? { error: value.item.error } : {}
|
|
4206
|
+
}
|
|
4207
|
+
});
|
|
4208
|
+
} else if (value.item.type === "mcp_list_tools") {
|
|
4209
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
4210
|
+
controller.enqueue({
|
|
4211
|
+
type: "tool-result",
|
|
4212
|
+
toolCallId: value.item.id,
|
|
4213
|
+
toolName: "mcp",
|
|
4214
|
+
result: {
|
|
4215
|
+
type: "listTools",
|
|
4216
|
+
serverLabel: value.item.server_label,
|
|
4217
|
+
tools: value.item.tools.map((t) => {
|
|
4218
|
+
var _a2, _b2;
|
|
4219
|
+
return {
|
|
4220
|
+
name: t.name,
|
|
4221
|
+
description: (_a2 = t.description) != null ? _a2 : void 0,
|
|
4222
|
+
inputSchema: t.input_schema,
|
|
4223
|
+
annotations: (_b2 = t.annotations) != null ? _b2 : void 0
|
|
4224
|
+
};
|
|
4225
|
+
}),
|
|
4226
|
+
...value.item.error != null ? { error: value.item.error } : {}
|
|
4227
|
+
}
|
|
4228
|
+
});
|
|
4229
|
+
} else if (value.item.type === "mcp_approval_request") {
|
|
4230
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
4231
|
+
controller.enqueue({
|
|
4232
|
+
type: "tool-result",
|
|
4233
|
+
toolCallId: value.item.id,
|
|
4234
|
+
toolName: "mcp",
|
|
4235
|
+
result: {
|
|
4236
|
+
type: "approvalRequest",
|
|
4237
|
+
serverLabel: value.item.server_label,
|
|
4238
|
+
name: value.item.name,
|
|
4239
|
+
arguments: value.item.arguments,
|
|
4240
|
+
approvalRequestId: value.item.approval_request_id
|
|
4241
|
+
}
|
|
4242
|
+
});
|
|
3868
4243
|
} else if (value.item.type === "local_shell_call") {
|
|
3869
4244
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3870
4245
|
controller.enqueue({
|
|
@@ -4050,7 +4425,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4050
4425
|
controller.enqueue({
|
|
4051
4426
|
type: "source",
|
|
4052
4427
|
sourceType: "url",
|
|
4053
|
-
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0,
|
|
4428
|
+
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0, import_provider_utils25.generateId)(),
|
|
4054
4429
|
url: value.annotation.url,
|
|
4055
4430
|
title: value.annotation.title
|
|
4056
4431
|
});
|
|
@@ -4058,7 +4433,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4058
4433
|
controller.enqueue({
|
|
4059
4434
|
type: "source",
|
|
4060
4435
|
sourceType: "document",
|
|
4061
|
-
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0,
|
|
4436
|
+
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils25.generateId)(),
|
|
4062
4437
|
mediaType: "text/plain",
|
|
4063
4438
|
title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
|
|
4064
4439
|
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
|
|
@@ -4074,7 +4449,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4074
4449
|
controller.enqueue({
|
|
4075
4450
|
type: "source",
|
|
4076
4451
|
sourceType: "document",
|
|
4077
|
-
id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0,
|
|
4452
|
+
id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0, import_provider_utils25.generateId)(),
|
|
4078
4453
|
mediaType: "text/plain",
|
|
4079
4454
|
title: (_A = (_z = value.annotation.filename) != null ? _z : value.annotation.file_id) != null ? _A : "Document",
|
|
4080
4455
|
filename: (_B = value.annotation.filename) != null ? _B : value.annotation.file_id,
|
|
@@ -4090,7 +4465,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4090
4465
|
controller.enqueue({
|
|
4091
4466
|
type: "source",
|
|
4092
4467
|
sourceType: "document",
|
|
4093
|
-
id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0,
|
|
4468
|
+
id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0, import_provider_utils25.generateId)(),
|
|
4094
4469
|
mediaType: "application/octet-stream",
|
|
4095
4470
|
title: value.annotation.file_id,
|
|
4096
4471
|
filename: value.annotation.file_id,
|
|
@@ -4196,16 +4571,16 @@ function mapWebSearchOutput(action) {
|
|
|
4196
4571
|
}
|
|
4197
4572
|
|
|
4198
4573
|
// src/speech/openai-speech-model.ts
|
|
4199
|
-
var
|
|
4574
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
4200
4575
|
|
|
4201
4576
|
// src/speech/openai-speech-options.ts
|
|
4202
|
-
var
|
|
4203
|
-
var
|
|
4204
|
-
var openaiSpeechProviderOptionsSchema = (0,
|
|
4205
|
-
() => (0,
|
|
4206
|
-
|
|
4207
|
-
instructions:
|
|
4208
|
-
speed:
|
|
4577
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
4578
|
+
var import_v419 = require("zod/v4");
|
|
4579
|
+
var openaiSpeechProviderOptionsSchema = (0, import_provider_utils26.lazySchema)(
|
|
4580
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
4581
|
+
import_v419.z.object({
|
|
4582
|
+
instructions: import_v419.z.string().nullish(),
|
|
4583
|
+
speed: import_v419.z.number().min(0.25).max(4).default(1).nullish()
|
|
4209
4584
|
})
|
|
4210
4585
|
)
|
|
4211
4586
|
);
|
|
@@ -4230,7 +4605,7 @@ var OpenAISpeechModel = class {
|
|
|
4230
4605
|
providerOptions
|
|
4231
4606
|
}) {
|
|
4232
4607
|
const warnings = [];
|
|
4233
|
-
const openAIOptions = await (0,
|
|
4608
|
+
const openAIOptions = await (0, import_provider_utils27.parseProviderOptions)({
|
|
4234
4609
|
provider: "openai",
|
|
4235
4610
|
providerOptions,
|
|
4236
4611
|
schema: openaiSpeechProviderOptionsSchema
|
|
@@ -4283,15 +4658,15 @@ var OpenAISpeechModel = class {
|
|
|
4283
4658
|
value: audio,
|
|
4284
4659
|
responseHeaders,
|
|
4285
4660
|
rawValue: rawResponse
|
|
4286
|
-
} = await (0,
|
|
4661
|
+
} = await (0, import_provider_utils27.postJsonToApi)({
|
|
4287
4662
|
url: this.config.url({
|
|
4288
4663
|
path: "/audio/speech",
|
|
4289
4664
|
modelId: this.modelId
|
|
4290
4665
|
}),
|
|
4291
|
-
headers: (0,
|
|
4666
|
+
headers: (0, import_provider_utils27.combineHeaders)(this.config.headers(), options.headers),
|
|
4292
4667
|
body: requestBody,
|
|
4293
4668
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4294
|
-
successfulResponseHandler: (0,
|
|
4669
|
+
successfulResponseHandler: (0, import_provider_utils27.createBinaryResponseHandler)(),
|
|
4295
4670
|
abortSignal: options.abortSignal,
|
|
4296
4671
|
fetch: this.config.fetch
|
|
4297
4672
|
});
|
|
@@ -4312,36 +4687,36 @@ var OpenAISpeechModel = class {
|
|
|
4312
4687
|
};
|
|
4313
4688
|
|
|
4314
4689
|
// src/transcription/openai-transcription-model.ts
|
|
4315
|
-
var
|
|
4690
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
4316
4691
|
|
|
4317
4692
|
// src/transcription/openai-transcription-api.ts
|
|
4318
|
-
var
|
|
4319
|
-
var
|
|
4320
|
-
var openaiTranscriptionResponseSchema = (0,
|
|
4321
|
-
() => (0,
|
|
4322
|
-
|
|
4323
|
-
text:
|
|
4324
|
-
language:
|
|
4325
|
-
duration:
|
|
4326
|
-
words:
|
|
4327
|
-
|
|
4328
|
-
word:
|
|
4329
|
-
start:
|
|
4330
|
-
end:
|
|
4693
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
4694
|
+
var import_v420 = require("zod/v4");
|
|
4695
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils28.lazySchema)(
|
|
4696
|
+
() => (0, import_provider_utils28.zodSchema)(
|
|
4697
|
+
import_v420.z.object({
|
|
4698
|
+
text: import_v420.z.string(),
|
|
4699
|
+
language: import_v420.z.string().nullish(),
|
|
4700
|
+
duration: import_v420.z.number().nullish(),
|
|
4701
|
+
words: import_v420.z.array(
|
|
4702
|
+
import_v420.z.object({
|
|
4703
|
+
word: import_v420.z.string(),
|
|
4704
|
+
start: import_v420.z.number(),
|
|
4705
|
+
end: import_v420.z.number()
|
|
4331
4706
|
})
|
|
4332
4707
|
).nullish(),
|
|
4333
|
-
segments:
|
|
4334
|
-
|
|
4335
|
-
id:
|
|
4336
|
-
seek:
|
|
4337
|
-
start:
|
|
4338
|
-
end:
|
|
4339
|
-
text:
|
|
4340
|
-
tokens:
|
|
4341
|
-
temperature:
|
|
4342
|
-
avg_logprob:
|
|
4343
|
-
compression_ratio:
|
|
4344
|
-
no_speech_prob:
|
|
4708
|
+
segments: import_v420.z.array(
|
|
4709
|
+
import_v420.z.object({
|
|
4710
|
+
id: import_v420.z.number(),
|
|
4711
|
+
seek: import_v420.z.number(),
|
|
4712
|
+
start: import_v420.z.number(),
|
|
4713
|
+
end: import_v420.z.number(),
|
|
4714
|
+
text: import_v420.z.string(),
|
|
4715
|
+
tokens: import_v420.z.array(import_v420.z.number()),
|
|
4716
|
+
temperature: import_v420.z.number(),
|
|
4717
|
+
avg_logprob: import_v420.z.number(),
|
|
4718
|
+
compression_ratio: import_v420.z.number(),
|
|
4719
|
+
no_speech_prob: import_v420.z.number()
|
|
4345
4720
|
})
|
|
4346
4721
|
).nullish()
|
|
4347
4722
|
})
|
|
@@ -4349,33 +4724,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils27.lazySchema)(
|
|
|
4349
4724
|
);
|
|
4350
4725
|
|
|
4351
4726
|
// src/transcription/openai-transcription-options.ts
|
|
4352
|
-
var
|
|
4353
|
-
var
|
|
4354
|
-
var openAITranscriptionProviderOptions = (0,
|
|
4355
|
-
() => (0,
|
|
4356
|
-
|
|
4727
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
4728
|
+
var import_v421 = require("zod/v4");
|
|
4729
|
+
var openAITranscriptionProviderOptions = (0, import_provider_utils29.lazySchema)(
|
|
4730
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
4731
|
+
import_v421.z.object({
|
|
4357
4732
|
/**
|
|
4358
4733
|
* Additional information to include in the transcription response.
|
|
4359
4734
|
*/
|
|
4360
|
-
include:
|
|
4735
|
+
include: import_v421.z.array(import_v421.z.string()).optional(),
|
|
4361
4736
|
/**
|
|
4362
4737
|
* The language of the input audio in ISO-639-1 format.
|
|
4363
4738
|
*/
|
|
4364
|
-
language:
|
|
4739
|
+
language: import_v421.z.string().optional(),
|
|
4365
4740
|
/**
|
|
4366
4741
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
4367
4742
|
*/
|
|
4368
|
-
prompt:
|
|
4743
|
+
prompt: import_v421.z.string().optional(),
|
|
4369
4744
|
/**
|
|
4370
4745
|
* The sampling temperature, between 0 and 1.
|
|
4371
4746
|
* @default 0
|
|
4372
4747
|
*/
|
|
4373
|
-
temperature:
|
|
4748
|
+
temperature: import_v421.z.number().min(0).max(1).default(0).optional(),
|
|
4374
4749
|
/**
|
|
4375
4750
|
* The timestamp granularities to populate for this transcription.
|
|
4376
4751
|
* @default ['segment']
|
|
4377
4752
|
*/
|
|
4378
|
-
timestampGranularities:
|
|
4753
|
+
timestampGranularities: import_v421.z.array(import_v421.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
4379
4754
|
})
|
|
4380
4755
|
)
|
|
4381
4756
|
);
|
|
@@ -4455,15 +4830,15 @@ var OpenAITranscriptionModel = class {
|
|
|
4455
4830
|
providerOptions
|
|
4456
4831
|
}) {
|
|
4457
4832
|
const warnings = [];
|
|
4458
|
-
const openAIOptions = await (0,
|
|
4833
|
+
const openAIOptions = await (0, import_provider_utils30.parseProviderOptions)({
|
|
4459
4834
|
provider: "openai",
|
|
4460
4835
|
providerOptions,
|
|
4461
4836
|
schema: openAITranscriptionProviderOptions
|
|
4462
4837
|
});
|
|
4463
4838
|
const formData = new FormData();
|
|
4464
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
4839
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils30.convertBase64ToUint8Array)(audio)]);
|
|
4465
4840
|
formData.append("model", this.modelId);
|
|
4466
|
-
const fileExtension = (0,
|
|
4841
|
+
const fileExtension = (0, import_provider_utils30.mediaTypeToExtension)(mediaType);
|
|
4467
4842
|
formData.append(
|
|
4468
4843
|
"file",
|
|
4469
4844
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -4508,15 +4883,15 @@ var OpenAITranscriptionModel = class {
|
|
|
4508
4883
|
value: response,
|
|
4509
4884
|
responseHeaders,
|
|
4510
4885
|
rawValue: rawResponse
|
|
4511
|
-
} = await (0,
|
|
4886
|
+
} = await (0, import_provider_utils30.postFormDataToApi)({
|
|
4512
4887
|
url: this.config.url({
|
|
4513
4888
|
path: "/audio/transcriptions",
|
|
4514
4889
|
modelId: this.modelId
|
|
4515
4890
|
}),
|
|
4516
|
-
headers: (0,
|
|
4891
|
+
headers: (0, import_provider_utils30.combineHeaders)(this.config.headers(), options.headers),
|
|
4517
4892
|
formData,
|
|
4518
4893
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4519
|
-
successfulResponseHandler: (0,
|
|
4894
|
+
successfulResponseHandler: (0, import_provider_utils30.createJsonResponseHandler)(
|
|
4520
4895
|
openaiTranscriptionResponseSchema
|
|
4521
4896
|
),
|
|
4522
4897
|
abortSignal: options.abortSignal,
|
|
@@ -4548,21 +4923,21 @@ var OpenAITranscriptionModel = class {
|
|
|
4548
4923
|
};
|
|
4549
4924
|
|
|
4550
4925
|
// src/version.ts
|
|
4551
|
-
var VERSION = true ? "3.0.0-beta.
|
|
4926
|
+
var VERSION = true ? "3.0.0-beta.55" : "0.0.0-test";
|
|
4552
4927
|
|
|
4553
4928
|
// src/openai-provider.ts
|
|
4554
4929
|
function createOpenAI(options = {}) {
|
|
4555
4930
|
var _a, _b;
|
|
4556
|
-
const baseURL = (_a = (0,
|
|
4557
|
-
(0,
|
|
4931
|
+
const baseURL = (_a = (0, import_provider_utils31.withoutTrailingSlash)(
|
|
4932
|
+
(0, import_provider_utils31.loadOptionalSetting)({
|
|
4558
4933
|
settingValue: options.baseURL,
|
|
4559
4934
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
4560
4935
|
})
|
|
4561
4936
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
4562
4937
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
4563
|
-
const getHeaders = () => (0,
|
|
4938
|
+
const getHeaders = () => (0, import_provider_utils31.withUserAgentSuffix)(
|
|
4564
4939
|
{
|
|
4565
|
-
Authorization: `Bearer ${(0,
|
|
4940
|
+
Authorization: `Bearer ${(0, import_provider_utils31.loadApiKey)({
|
|
4566
4941
|
apiKey: options.apiKey,
|
|
4567
4942
|
environmentVariableName: "OPENAI_API_KEY",
|
|
4568
4943
|
description: "OpenAI"
|