@ai-sdk/openai 2.1.0-beta.1 → 2.1.0-beta.11
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 +99 -0
- package/dist/index.d.mts +78 -19
- package/dist/index.d.ts +78 -19
- package/dist/index.js +652 -407
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +622 -376
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +338 -23
- package/dist/internal/index.d.ts +338 -23
- package/dist/internal/index.js +658 -410
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +626 -389
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/internal/index.js
CHANGED
|
@@ -27,12 +27,23 @@ __export(internal_exports, {
|
|
|
27
27
|
OpenAIResponsesLanguageModel: () => OpenAIResponsesLanguageModel,
|
|
28
28
|
OpenAISpeechModel: () => OpenAISpeechModel,
|
|
29
29
|
OpenAITranscriptionModel: () => OpenAITranscriptionModel,
|
|
30
|
+
codeInterpreter: () => codeInterpreter,
|
|
31
|
+
codeInterpreterArgsSchema: () => codeInterpreterArgsSchema,
|
|
32
|
+
codeInterpreterInputSchema: () => codeInterpreterInputSchema,
|
|
33
|
+
codeInterpreterOutputSchema: () => codeInterpreterOutputSchema,
|
|
34
|
+
codeInterpreterToolFactory: () => codeInterpreterToolFactory,
|
|
35
|
+
fileSearch: () => fileSearch,
|
|
36
|
+
fileSearchArgsSchema: () => fileSearchArgsSchema,
|
|
37
|
+
fileSearchOutputSchema: () => fileSearchOutputSchema,
|
|
30
38
|
hasDefaultResponseFormat: () => hasDefaultResponseFormat,
|
|
39
|
+
imageGeneration: () => imageGeneration,
|
|
40
|
+
imageGenerationArgsSchema: () => imageGenerationArgsSchema,
|
|
41
|
+
imageGenerationOutputSchema: () => imageGenerationOutputSchema,
|
|
31
42
|
modelMaxImagesPerCall: () => modelMaxImagesPerCall,
|
|
32
43
|
openAITranscriptionProviderOptions: () => openAITranscriptionProviderOptions,
|
|
44
|
+
openaiChatLanguageModelOptions: () => openaiChatLanguageModelOptions,
|
|
33
45
|
openaiCompletionProviderOptions: () => openaiCompletionProviderOptions,
|
|
34
|
-
openaiEmbeddingProviderOptions: () => openaiEmbeddingProviderOptions
|
|
35
|
-
openaiProviderOptions: () => openaiProviderOptions
|
|
46
|
+
openaiEmbeddingProviderOptions: () => openaiEmbeddingProviderOptions
|
|
36
47
|
});
|
|
37
48
|
module.exports = __toCommonJS(internal_exports);
|
|
38
49
|
|
|
@@ -270,7 +281,7 @@ function mapOpenAIFinishReason(finishReason) {
|
|
|
270
281
|
|
|
271
282
|
// src/chat/openai-chat-options.ts
|
|
272
283
|
var import_v42 = require("zod/v4");
|
|
273
|
-
var
|
|
284
|
+
var openaiChatLanguageModelOptions = import_v42.z.object({
|
|
274
285
|
/**
|
|
275
286
|
* Modify the likelihood of specified tokens appearing in the completion.
|
|
276
287
|
*
|
|
@@ -422,7 +433,7 @@ function prepareChatTools({
|
|
|
422
433
|
// src/chat/openai-chat-language-model.ts
|
|
423
434
|
var OpenAIChatLanguageModel = class {
|
|
424
435
|
constructor(modelId, config) {
|
|
425
|
-
this.specificationVersion = "
|
|
436
|
+
this.specificationVersion = "v3";
|
|
426
437
|
this.supportedUrls = {
|
|
427
438
|
"image/*": [/^https?:\/\/.*$/]
|
|
428
439
|
};
|
|
@@ -452,7 +463,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
452
463
|
const openaiOptions = (_a = await (0, import_provider_utils3.parseProviderOptions)({
|
|
453
464
|
provider: "openai",
|
|
454
465
|
providerOptions,
|
|
455
|
-
schema:
|
|
466
|
+
schema: openaiChatLanguageModelOptions
|
|
456
467
|
})) != null ? _a : {};
|
|
457
468
|
const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
|
|
458
469
|
if (topK != null) {
|
|
@@ -1231,7 +1242,7 @@ var openaiCompletionProviderOptions = import_v44.z.object({
|
|
|
1231
1242
|
// src/completion/openai-completion-language-model.ts
|
|
1232
1243
|
var OpenAICompletionLanguageModel = class {
|
|
1233
1244
|
constructor(modelId, config) {
|
|
1234
|
-
this.specificationVersion = "
|
|
1245
|
+
this.specificationVersion = "v3";
|
|
1235
1246
|
this.supportedUrls = {
|
|
1236
1247
|
// No URLs are supported for completion models.
|
|
1237
1248
|
};
|
|
@@ -1524,7 +1535,7 @@ var openaiEmbeddingProviderOptions = import_v46.z.object({
|
|
|
1524
1535
|
// src/embedding/openai-embedding-model.ts
|
|
1525
1536
|
var OpenAIEmbeddingModel = class {
|
|
1526
1537
|
constructor(modelId, config) {
|
|
1527
|
-
this.specificationVersion = "
|
|
1538
|
+
this.specificationVersion = "v3";
|
|
1528
1539
|
this.maxEmbeddingsPerCall = 2048;
|
|
1529
1540
|
this.supportsParallelCalls = true;
|
|
1530
1541
|
this.modelId = modelId;
|
|
@@ -1606,7 +1617,7 @@ var OpenAIImageModel = class {
|
|
|
1606
1617
|
constructor(modelId, config) {
|
|
1607
1618
|
this.modelId = modelId;
|
|
1608
1619
|
this.config = config;
|
|
1609
|
-
this.specificationVersion = "
|
|
1620
|
+
this.specificationVersion = "v3";
|
|
1610
1621
|
}
|
|
1611
1622
|
get maxImagesPerCall() {
|
|
1612
1623
|
var _a;
|
|
@@ -2018,13 +2029,38 @@ var OpenAISpeechModel = class {
|
|
|
2018
2029
|
|
|
2019
2030
|
// src/responses/openai-responses-language-model.ts
|
|
2020
2031
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2021
|
-
var
|
|
2022
|
-
var
|
|
2032
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2033
|
+
var import_v419 = require("zod/v4");
|
|
2023
2034
|
|
|
2024
2035
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2025
2036
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2037
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
2038
|
+
var import_v413 = require("zod/v4");
|
|
2039
|
+
|
|
2040
|
+
// src/tool/local-shell.ts
|
|
2026
2041
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
2027
2042
|
var import_v412 = require("zod/v4");
|
|
2043
|
+
var localShellInputSchema = import_v412.z.object({
|
|
2044
|
+
action: import_v412.z.object({
|
|
2045
|
+
type: import_v412.z.literal("exec"),
|
|
2046
|
+
command: import_v412.z.array(import_v412.z.string()),
|
|
2047
|
+
timeoutMs: import_v412.z.number().optional(),
|
|
2048
|
+
user: import_v412.z.string().optional(),
|
|
2049
|
+
workingDirectory: import_v412.z.string().optional(),
|
|
2050
|
+
env: import_v412.z.record(import_v412.z.string(), import_v412.z.string()).optional()
|
|
2051
|
+
})
|
|
2052
|
+
});
|
|
2053
|
+
var localShellOutputSchema = import_v412.z.object({
|
|
2054
|
+
output: import_v412.z.string()
|
|
2055
|
+
});
|
|
2056
|
+
var localShell = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2057
|
+
id: "openai.local_shell",
|
|
2058
|
+
name: "local_shell",
|
|
2059
|
+
inputSchema: localShellInputSchema,
|
|
2060
|
+
outputSchema: localShellOutputSchema
|
|
2061
|
+
});
|
|
2062
|
+
|
|
2063
|
+
// src/responses/convert-to-openai-responses-input.ts
|
|
2028
2064
|
function isFileId(data, prefixes) {
|
|
2029
2065
|
if (!prefixes) return false;
|
|
2030
2066
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2033,9 +2069,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2033
2069
|
prompt,
|
|
2034
2070
|
systemMessageMode,
|
|
2035
2071
|
fileIdPrefixes,
|
|
2036
|
-
store
|
|
2072
|
+
store,
|
|
2073
|
+
hasLocalShellTool = false
|
|
2037
2074
|
}) {
|
|
2038
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2075
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2039
2076
|
const input = [];
|
|
2040
2077
|
const warnings = [];
|
|
2041
2078
|
for (const { role, content } of prompt) {
|
|
@@ -2081,7 +2118,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2081
2118
|
return {
|
|
2082
2119
|
type: "input_image",
|
|
2083
2120
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2084
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2121
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils10.convertToBase64)(part.data)}`
|
|
2085
2122
|
},
|
|
2086
2123
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2087
2124
|
};
|
|
@@ -2096,7 +2133,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2096
2133
|
type: "input_file",
|
|
2097
2134
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2098
2135
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2099
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2136
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils10.convertToBase64)(part.data)}`
|
|
2100
2137
|
}
|
|
2101
2138
|
};
|
|
2102
2139
|
} else {
|
|
@@ -2128,12 +2165,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2128
2165
|
if (part.providerExecuted) {
|
|
2129
2166
|
break;
|
|
2130
2167
|
}
|
|
2168
|
+
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2169
|
+
const parsedInput = localShellInputSchema.parse(part.input);
|
|
2170
|
+
input.push({
|
|
2171
|
+
type: "local_shell_call",
|
|
2172
|
+
call_id: part.toolCallId,
|
|
2173
|
+
id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
|
|
2174
|
+
action: {
|
|
2175
|
+
type: "exec",
|
|
2176
|
+
command: parsedInput.action.command,
|
|
2177
|
+
timeout_ms: parsedInput.action.timeoutMs,
|
|
2178
|
+
user: parsedInput.action.user,
|
|
2179
|
+
working_directory: parsedInput.action.workingDirectory,
|
|
2180
|
+
env: parsedInput.action.env
|
|
2181
|
+
}
|
|
2182
|
+
});
|
|
2183
|
+
break;
|
|
2184
|
+
}
|
|
2131
2185
|
input.push({
|
|
2132
2186
|
type: "function_call",
|
|
2133
2187
|
call_id: part.toolCallId,
|
|
2134
2188
|
name: part.toolName,
|
|
2135
2189
|
arguments: JSON.stringify(part.input),
|
|
2136
|
-
id: (
|
|
2190
|
+
id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
|
|
2137
2191
|
});
|
|
2138
2192
|
break;
|
|
2139
2193
|
}
|
|
@@ -2150,33 +2204,47 @@ async function convertToOpenAIResponsesInput({
|
|
|
2150
2204
|
break;
|
|
2151
2205
|
}
|
|
2152
2206
|
case "reasoning": {
|
|
2153
|
-
const providerOptions = await (0,
|
|
2207
|
+
const providerOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
2154
2208
|
provider: "openai",
|
|
2155
2209
|
providerOptions: part.providerOptions,
|
|
2156
2210
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
2157
2211
|
});
|
|
2158
2212
|
const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
2159
2213
|
if (reasoningId != null) {
|
|
2160
|
-
const
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
if (existingReasoningMessage === void 0) {
|
|
2171
|
-
reasoningMessages[reasoningId] = {
|
|
2172
|
-
type: "reasoning",
|
|
2173
|
-
id: reasoningId,
|
|
2174
|
-
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2175
|
-
summary: summaryParts
|
|
2176
|
-
};
|
|
2177
|
-
input.push(reasoningMessages[reasoningId]);
|
|
2214
|
+
const reasoningMessage = reasoningMessages[reasoningId];
|
|
2215
|
+
if (store) {
|
|
2216
|
+
if (reasoningMessage === void 0) {
|
|
2217
|
+
input.push({ type: "item_reference", id: reasoningId });
|
|
2218
|
+
reasoningMessages[reasoningId] = {
|
|
2219
|
+
type: "reasoning",
|
|
2220
|
+
id: reasoningId,
|
|
2221
|
+
summary: []
|
|
2222
|
+
};
|
|
2223
|
+
}
|
|
2178
2224
|
} else {
|
|
2179
|
-
|
|
2225
|
+
const summaryParts = [];
|
|
2226
|
+
if (part.text.length > 0) {
|
|
2227
|
+
summaryParts.push({
|
|
2228
|
+
type: "summary_text",
|
|
2229
|
+
text: part.text
|
|
2230
|
+
});
|
|
2231
|
+
} else if (reasoningMessage !== void 0) {
|
|
2232
|
+
warnings.push({
|
|
2233
|
+
type: "other",
|
|
2234
|
+
message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
|
|
2235
|
+
});
|
|
2236
|
+
}
|
|
2237
|
+
if (reasoningMessage === void 0) {
|
|
2238
|
+
reasoningMessages[reasoningId] = {
|
|
2239
|
+
type: "reasoning",
|
|
2240
|
+
id: reasoningId,
|
|
2241
|
+
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2242
|
+
summary: summaryParts
|
|
2243
|
+
};
|
|
2244
|
+
input.push(reasoningMessages[reasoningId]);
|
|
2245
|
+
} else {
|
|
2246
|
+
reasoningMessage.summary.push(...summaryParts);
|
|
2247
|
+
}
|
|
2180
2248
|
}
|
|
2181
2249
|
} else {
|
|
2182
2250
|
warnings.push({
|
|
@@ -2193,6 +2261,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2193
2261
|
case "tool": {
|
|
2194
2262
|
for (const part of content) {
|
|
2195
2263
|
const output = part.output;
|
|
2264
|
+
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2265
|
+
input.push({
|
|
2266
|
+
type: "local_shell_call_output",
|
|
2267
|
+
call_id: part.toolCallId,
|
|
2268
|
+
output: localShellOutputSchema.parse(output.value).output
|
|
2269
|
+
});
|
|
2270
|
+
break;
|
|
2271
|
+
}
|
|
2196
2272
|
let contentValue;
|
|
2197
2273
|
switch (output.type) {
|
|
2198
2274
|
case "text":
|
|
@@ -2221,9 +2297,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2221
2297
|
}
|
|
2222
2298
|
return { input, warnings };
|
|
2223
2299
|
}
|
|
2224
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2225
|
-
itemId:
|
|
2226
|
-
reasoningEncryptedContent:
|
|
2300
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v413.z.object({
|
|
2301
|
+
itemId: import_v413.z.string().nullish(),
|
|
2302
|
+
reasoningEncryptedContent: import_v413.z.string().nullish()
|
|
2227
2303
|
});
|
|
2228
2304
|
|
|
2229
2305
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2248,200 +2324,207 @@ function mapOpenAIResponseFinishReason({
|
|
|
2248
2324
|
var import_provider7 = require("@ai-sdk/provider");
|
|
2249
2325
|
|
|
2250
2326
|
// src/tool/code-interpreter.ts
|
|
2251
|
-
var
|
|
2252
|
-
var
|
|
2253
|
-
var codeInterpreterInputSchema =
|
|
2254
|
-
code:
|
|
2255
|
-
containerId:
|
|
2327
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
2328
|
+
var import_v414 = require("zod/v4");
|
|
2329
|
+
var codeInterpreterInputSchema = import_v414.z.object({
|
|
2330
|
+
code: import_v414.z.string().nullish(),
|
|
2331
|
+
containerId: import_v414.z.string()
|
|
2256
2332
|
});
|
|
2257
|
-
var codeInterpreterOutputSchema =
|
|
2258
|
-
outputs:
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2333
|
+
var codeInterpreterOutputSchema = import_v414.z.object({
|
|
2334
|
+
outputs: import_v414.z.array(
|
|
2335
|
+
import_v414.z.discriminatedUnion("type", [
|
|
2336
|
+
import_v414.z.object({ type: import_v414.z.literal("logs"), logs: import_v414.z.string() }),
|
|
2337
|
+
import_v414.z.object({ type: import_v414.z.literal("image"), url: import_v414.z.string() })
|
|
2262
2338
|
])
|
|
2263
2339
|
).nullish()
|
|
2264
2340
|
});
|
|
2265
|
-
var codeInterpreterArgsSchema =
|
|
2266
|
-
container:
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
fileIds:
|
|
2341
|
+
var codeInterpreterArgsSchema = import_v414.z.object({
|
|
2342
|
+
container: import_v414.z.union([
|
|
2343
|
+
import_v414.z.string(),
|
|
2344
|
+
import_v414.z.object({
|
|
2345
|
+
fileIds: import_v414.z.array(import_v414.z.string()).optional()
|
|
2270
2346
|
})
|
|
2271
2347
|
]).optional()
|
|
2272
2348
|
});
|
|
2273
|
-
var codeInterpreterToolFactory = (0,
|
|
2349
|
+
var codeInterpreterToolFactory = (0, import_provider_utils11.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2274
2350
|
id: "openai.code_interpreter",
|
|
2275
2351
|
name: "code_interpreter",
|
|
2276
2352
|
inputSchema: codeInterpreterInputSchema,
|
|
2277
2353
|
outputSchema: codeInterpreterOutputSchema
|
|
2278
2354
|
});
|
|
2355
|
+
var codeInterpreter = (args = {}) => {
|
|
2356
|
+
return codeInterpreterToolFactory(args);
|
|
2357
|
+
};
|
|
2279
2358
|
|
|
2280
2359
|
// src/tool/file-search.ts
|
|
2281
|
-
var
|
|
2282
|
-
var
|
|
2283
|
-
var comparisonFilterSchema =
|
|
2284
|
-
key:
|
|
2285
|
-
type:
|
|
2286
|
-
value:
|
|
2360
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2361
|
+
var import_v415 = require("zod/v4");
|
|
2362
|
+
var comparisonFilterSchema = import_v415.z.object({
|
|
2363
|
+
key: import_v415.z.string(),
|
|
2364
|
+
type: import_v415.z.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
2365
|
+
value: import_v415.z.union([import_v415.z.string(), import_v415.z.number(), import_v415.z.boolean()])
|
|
2287
2366
|
});
|
|
2288
|
-
var compoundFilterSchema =
|
|
2289
|
-
type:
|
|
2290
|
-
filters:
|
|
2291
|
-
|
|
2367
|
+
var compoundFilterSchema = import_v415.z.object({
|
|
2368
|
+
type: import_v415.z.enum(["and", "or"]),
|
|
2369
|
+
filters: import_v415.z.array(
|
|
2370
|
+
import_v415.z.union([comparisonFilterSchema, import_v415.z.lazy(() => compoundFilterSchema)])
|
|
2292
2371
|
)
|
|
2293
2372
|
});
|
|
2294
|
-
var fileSearchArgsSchema =
|
|
2295
|
-
vectorStoreIds:
|
|
2296
|
-
maxNumResults:
|
|
2297
|
-
ranking:
|
|
2298
|
-
ranker:
|
|
2299
|
-
scoreThreshold:
|
|
2373
|
+
var fileSearchArgsSchema = import_v415.z.object({
|
|
2374
|
+
vectorStoreIds: import_v415.z.array(import_v415.z.string()),
|
|
2375
|
+
maxNumResults: import_v415.z.number().optional(),
|
|
2376
|
+
ranking: import_v415.z.object({
|
|
2377
|
+
ranker: import_v415.z.string().optional(),
|
|
2378
|
+
scoreThreshold: import_v415.z.number().optional()
|
|
2300
2379
|
}).optional(),
|
|
2301
|
-
filters:
|
|
2380
|
+
filters: import_v415.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2302
2381
|
});
|
|
2303
|
-
var fileSearchOutputSchema =
|
|
2304
|
-
queries:
|
|
2305
|
-
results:
|
|
2306
|
-
|
|
2307
|
-
attributes:
|
|
2308
|
-
fileId:
|
|
2309
|
-
filename:
|
|
2310
|
-
score:
|
|
2311
|
-
text:
|
|
2382
|
+
var fileSearchOutputSchema = import_v415.z.object({
|
|
2383
|
+
queries: import_v415.z.array(import_v415.z.string()),
|
|
2384
|
+
results: import_v415.z.array(
|
|
2385
|
+
import_v415.z.object({
|
|
2386
|
+
attributes: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()),
|
|
2387
|
+
fileId: import_v415.z.string(),
|
|
2388
|
+
filename: import_v415.z.string(),
|
|
2389
|
+
score: import_v415.z.number(),
|
|
2390
|
+
text: import_v415.z.string()
|
|
2312
2391
|
})
|
|
2313
2392
|
).nullable()
|
|
2314
2393
|
});
|
|
2315
|
-
var fileSearch = (0,
|
|
2394
|
+
var fileSearch = (0, import_provider_utils12.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2316
2395
|
id: "openai.file_search",
|
|
2317
2396
|
name: "file_search",
|
|
2318
|
-
inputSchema:
|
|
2397
|
+
inputSchema: import_v415.z.object({}),
|
|
2319
2398
|
outputSchema: fileSearchOutputSchema
|
|
2320
2399
|
});
|
|
2321
2400
|
|
|
2322
2401
|
// src/tool/web-search.ts
|
|
2323
|
-
var
|
|
2324
|
-
var
|
|
2325
|
-
var webSearchArgsSchema =
|
|
2326
|
-
filters:
|
|
2327
|
-
allowedDomains:
|
|
2402
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2403
|
+
var import_v416 = require("zod/v4");
|
|
2404
|
+
var webSearchArgsSchema = import_v416.z.object({
|
|
2405
|
+
filters: import_v416.z.object({
|
|
2406
|
+
allowedDomains: import_v416.z.array(import_v416.z.string()).optional()
|
|
2328
2407
|
}).optional(),
|
|
2329
|
-
searchContextSize:
|
|
2330
|
-
userLocation:
|
|
2331
|
-
type:
|
|
2332
|
-
country:
|
|
2333
|
-
city:
|
|
2334
|
-
region:
|
|
2335
|
-
timezone:
|
|
2408
|
+
searchContextSize: import_v416.z.enum(["low", "medium", "high"]).optional(),
|
|
2409
|
+
userLocation: import_v416.z.object({
|
|
2410
|
+
type: import_v416.z.literal("approximate"),
|
|
2411
|
+
country: import_v416.z.string().optional(),
|
|
2412
|
+
city: import_v416.z.string().optional(),
|
|
2413
|
+
region: import_v416.z.string().optional(),
|
|
2414
|
+
timezone: import_v416.z.string().optional()
|
|
2336
2415
|
}).optional()
|
|
2337
2416
|
});
|
|
2338
|
-
var webSearchToolFactory = (0,
|
|
2417
|
+
var webSearchToolFactory = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2339
2418
|
id: "openai.web_search",
|
|
2340
2419
|
name: "web_search",
|
|
2341
|
-
inputSchema:
|
|
2342
|
-
action:
|
|
2343
|
-
|
|
2344
|
-
type:
|
|
2345
|
-
query:
|
|
2420
|
+
inputSchema: import_v416.z.object({
|
|
2421
|
+
action: import_v416.z.discriminatedUnion("type", [
|
|
2422
|
+
import_v416.z.object({
|
|
2423
|
+
type: import_v416.z.literal("search"),
|
|
2424
|
+
query: import_v416.z.string().nullish()
|
|
2346
2425
|
}),
|
|
2347
|
-
|
|
2348
|
-
type:
|
|
2349
|
-
url:
|
|
2426
|
+
import_v416.z.object({
|
|
2427
|
+
type: import_v416.z.literal("open_page"),
|
|
2428
|
+
url: import_v416.z.string()
|
|
2350
2429
|
}),
|
|
2351
|
-
|
|
2352
|
-
type:
|
|
2353
|
-
url:
|
|
2354
|
-
pattern:
|
|
2430
|
+
import_v416.z.object({
|
|
2431
|
+
type: import_v416.z.literal("find"),
|
|
2432
|
+
url: import_v416.z.string(),
|
|
2433
|
+
pattern: import_v416.z.string()
|
|
2355
2434
|
})
|
|
2356
2435
|
]).nullish()
|
|
2357
2436
|
})
|
|
2358
2437
|
});
|
|
2359
2438
|
|
|
2360
2439
|
// src/tool/web-search-preview.ts
|
|
2361
|
-
var
|
|
2362
|
-
var
|
|
2363
|
-
var webSearchPreviewArgsSchema =
|
|
2440
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2441
|
+
var import_v417 = require("zod/v4");
|
|
2442
|
+
var webSearchPreviewArgsSchema = import_v417.z.object({
|
|
2364
2443
|
/**
|
|
2365
2444
|
* Search context size to use for the web search.
|
|
2366
2445
|
* - high: Most comprehensive context, highest cost, slower response
|
|
2367
2446
|
* - medium: Balanced context, cost, and latency (default)
|
|
2368
2447
|
* - low: Least context, lowest cost, fastest response
|
|
2369
2448
|
*/
|
|
2370
|
-
searchContextSize:
|
|
2449
|
+
searchContextSize: import_v417.z.enum(["low", "medium", "high"]).optional(),
|
|
2371
2450
|
/**
|
|
2372
2451
|
* User location information to provide geographically relevant search results.
|
|
2373
2452
|
*/
|
|
2374
|
-
userLocation:
|
|
2453
|
+
userLocation: import_v417.z.object({
|
|
2375
2454
|
/**
|
|
2376
2455
|
* Type of location (always 'approximate')
|
|
2377
2456
|
*/
|
|
2378
|
-
type:
|
|
2457
|
+
type: import_v417.z.literal("approximate"),
|
|
2379
2458
|
/**
|
|
2380
2459
|
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
2381
2460
|
*/
|
|
2382
|
-
country:
|
|
2461
|
+
country: import_v417.z.string().optional(),
|
|
2383
2462
|
/**
|
|
2384
2463
|
* City name (free text, e.g., 'Minneapolis')
|
|
2385
2464
|
*/
|
|
2386
|
-
city:
|
|
2465
|
+
city: import_v417.z.string().optional(),
|
|
2387
2466
|
/**
|
|
2388
2467
|
* Region name (free text, e.g., 'Minnesota')
|
|
2389
2468
|
*/
|
|
2390
|
-
region:
|
|
2469
|
+
region: import_v417.z.string().optional(),
|
|
2391
2470
|
/**
|
|
2392
2471
|
* IANA timezone (e.g., 'America/Chicago')
|
|
2393
2472
|
*/
|
|
2394
|
-
timezone:
|
|
2473
|
+
timezone: import_v417.z.string().optional()
|
|
2395
2474
|
}).optional()
|
|
2396
2475
|
});
|
|
2397
|
-
var webSearchPreview = (0,
|
|
2476
|
+
var webSearchPreview = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2398
2477
|
id: "openai.web_search_preview",
|
|
2399
2478
|
name: "web_search_preview",
|
|
2400
|
-
inputSchema:
|
|
2401
|
-
action:
|
|
2402
|
-
|
|
2403
|
-
type:
|
|
2404
|
-
query:
|
|
2479
|
+
inputSchema: import_v417.z.object({
|
|
2480
|
+
action: import_v417.z.discriminatedUnion("type", [
|
|
2481
|
+
import_v417.z.object({
|
|
2482
|
+
type: import_v417.z.literal("search"),
|
|
2483
|
+
query: import_v417.z.string().nullish()
|
|
2405
2484
|
}),
|
|
2406
|
-
|
|
2407
|
-
type:
|
|
2408
|
-
url:
|
|
2485
|
+
import_v417.z.object({
|
|
2486
|
+
type: import_v417.z.literal("open_page"),
|
|
2487
|
+
url: import_v417.z.string()
|
|
2409
2488
|
}),
|
|
2410
|
-
|
|
2411
|
-
type:
|
|
2412
|
-
url:
|
|
2413
|
-
pattern:
|
|
2489
|
+
import_v417.z.object({
|
|
2490
|
+
type: import_v417.z.literal("find"),
|
|
2491
|
+
url: import_v417.z.string(),
|
|
2492
|
+
pattern: import_v417.z.string()
|
|
2414
2493
|
})
|
|
2415
2494
|
]).nullish()
|
|
2416
2495
|
})
|
|
2417
2496
|
});
|
|
2418
2497
|
|
|
2419
2498
|
// src/tool/image-generation.ts
|
|
2420
|
-
var
|
|
2421
|
-
var
|
|
2422
|
-
var imageGenerationArgsSchema =
|
|
2423
|
-
background:
|
|
2424
|
-
inputFidelity:
|
|
2425
|
-
inputImageMask:
|
|
2426
|
-
fileId:
|
|
2427
|
-
imageUrl:
|
|
2499
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2500
|
+
var import_v418 = require("zod/v4");
|
|
2501
|
+
var imageGenerationArgsSchema = import_v418.z.object({
|
|
2502
|
+
background: import_v418.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
2503
|
+
inputFidelity: import_v418.z.enum(["low", "high"]).optional(),
|
|
2504
|
+
inputImageMask: import_v418.z.object({
|
|
2505
|
+
fileId: import_v418.z.string().optional(),
|
|
2506
|
+
imageUrl: import_v418.z.string().optional()
|
|
2428
2507
|
}).optional(),
|
|
2429
|
-
model:
|
|
2430
|
-
moderation:
|
|
2431
|
-
outputCompression:
|
|
2432
|
-
outputFormat:
|
|
2433
|
-
|
|
2434
|
-
|
|
2508
|
+
model: import_v418.z.string().optional(),
|
|
2509
|
+
moderation: import_v418.z.enum(["auto"]).optional(),
|
|
2510
|
+
outputCompression: import_v418.z.number().int().min(0).max(100).optional(),
|
|
2511
|
+
outputFormat: import_v418.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
2512
|
+
partialImages: import_v418.z.number().int().min(0).max(3).optional(),
|
|
2513
|
+
quality: import_v418.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
2514
|
+
size: import_v418.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
2435
2515
|
}).strict();
|
|
2436
|
-
var imageGenerationOutputSchema =
|
|
2437
|
-
result:
|
|
2516
|
+
var imageGenerationOutputSchema = import_v418.z.object({
|
|
2517
|
+
result: import_v418.z.string()
|
|
2438
2518
|
});
|
|
2439
|
-
var imageGenerationToolFactory = (0,
|
|
2519
|
+
var imageGenerationToolFactory = (0, import_provider_utils15.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2440
2520
|
id: "openai.image_generation",
|
|
2441
2521
|
name: "image_generation",
|
|
2442
|
-
inputSchema:
|
|
2522
|
+
inputSchema: import_v418.z.object({}),
|
|
2443
2523
|
outputSchema: imageGenerationOutputSchema
|
|
2444
2524
|
});
|
|
2525
|
+
var imageGeneration = (args = {}) => {
|
|
2526
|
+
return imageGenerationToolFactory(args);
|
|
2527
|
+
};
|
|
2445
2528
|
|
|
2446
2529
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2447
2530
|
function prepareResponsesTools({
|
|
@@ -2482,6 +2565,12 @@ function prepareResponsesTools({
|
|
|
2482
2565
|
});
|
|
2483
2566
|
break;
|
|
2484
2567
|
}
|
|
2568
|
+
case "openai.local_shell": {
|
|
2569
|
+
openaiTools.push({
|
|
2570
|
+
type: "local_shell"
|
|
2571
|
+
});
|
|
2572
|
+
break;
|
|
2573
|
+
}
|
|
2485
2574
|
case "openai.web_search_preview": {
|
|
2486
2575
|
const args = webSearchPreviewArgsSchema.parse(tool.args);
|
|
2487
2576
|
openaiTools.push({
|
|
@@ -2520,11 +2609,12 @@ function prepareResponsesTools({
|
|
|
2520
2609
|
image_url: args.inputImageMask.imageUrl
|
|
2521
2610
|
} : void 0,
|
|
2522
2611
|
model: args.model,
|
|
2523
|
-
size: args.size,
|
|
2524
|
-
quality: args.quality,
|
|
2525
2612
|
moderation: args.moderation,
|
|
2613
|
+
partial_images: args.partialImages,
|
|
2614
|
+
quality: args.quality,
|
|
2615
|
+
output_compression: args.outputCompression,
|
|
2526
2616
|
output_format: args.outputFormat,
|
|
2527
|
-
|
|
2617
|
+
size: args.size
|
|
2528
2618
|
});
|
|
2529
2619
|
break;
|
|
2530
2620
|
}
|
|
@@ -2561,73 +2651,86 @@ function prepareResponsesTools({
|
|
|
2561
2651
|
}
|
|
2562
2652
|
|
|
2563
2653
|
// src/responses/openai-responses-language-model.ts
|
|
2564
|
-
var webSearchCallItem =
|
|
2565
|
-
type:
|
|
2566
|
-
id:
|
|
2567
|
-
status:
|
|
2568
|
-
action:
|
|
2569
|
-
|
|
2570
|
-
type:
|
|
2571
|
-
query:
|
|
2654
|
+
var webSearchCallItem = import_v419.z.object({
|
|
2655
|
+
type: import_v419.z.literal("web_search_call"),
|
|
2656
|
+
id: import_v419.z.string(),
|
|
2657
|
+
status: import_v419.z.string(),
|
|
2658
|
+
action: import_v419.z.discriminatedUnion("type", [
|
|
2659
|
+
import_v419.z.object({
|
|
2660
|
+
type: import_v419.z.literal("search"),
|
|
2661
|
+
query: import_v419.z.string().nullish()
|
|
2572
2662
|
}),
|
|
2573
|
-
|
|
2574
|
-
type:
|
|
2575
|
-
url:
|
|
2663
|
+
import_v419.z.object({
|
|
2664
|
+
type: import_v419.z.literal("open_page"),
|
|
2665
|
+
url: import_v419.z.string()
|
|
2576
2666
|
}),
|
|
2577
|
-
|
|
2578
|
-
type:
|
|
2579
|
-
url:
|
|
2580
|
-
pattern:
|
|
2667
|
+
import_v419.z.object({
|
|
2668
|
+
type: import_v419.z.literal("find"),
|
|
2669
|
+
url: import_v419.z.string(),
|
|
2670
|
+
pattern: import_v419.z.string()
|
|
2581
2671
|
})
|
|
2582
2672
|
]).nullish()
|
|
2583
2673
|
});
|
|
2584
|
-
var fileSearchCallItem =
|
|
2585
|
-
type:
|
|
2586
|
-
id:
|
|
2587
|
-
queries:
|
|
2588
|
-
results:
|
|
2589
|
-
|
|
2590
|
-
attributes:
|
|
2591
|
-
file_id:
|
|
2592
|
-
filename:
|
|
2593
|
-
score:
|
|
2594
|
-
text:
|
|
2674
|
+
var fileSearchCallItem = import_v419.z.object({
|
|
2675
|
+
type: import_v419.z.literal("file_search_call"),
|
|
2676
|
+
id: import_v419.z.string(),
|
|
2677
|
+
queries: import_v419.z.array(import_v419.z.string()),
|
|
2678
|
+
results: import_v419.z.array(
|
|
2679
|
+
import_v419.z.object({
|
|
2680
|
+
attributes: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()),
|
|
2681
|
+
file_id: import_v419.z.string(),
|
|
2682
|
+
filename: import_v419.z.string(),
|
|
2683
|
+
score: import_v419.z.number(),
|
|
2684
|
+
text: import_v419.z.string()
|
|
2595
2685
|
})
|
|
2596
2686
|
).nullish()
|
|
2597
2687
|
});
|
|
2598
|
-
var codeInterpreterCallItem =
|
|
2599
|
-
type:
|
|
2600
|
-
id:
|
|
2601
|
-
code:
|
|
2602
|
-
container_id:
|
|
2603
|
-
outputs:
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2688
|
+
var codeInterpreterCallItem = import_v419.z.object({
|
|
2689
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
2690
|
+
id: import_v419.z.string(),
|
|
2691
|
+
code: import_v419.z.string().nullable(),
|
|
2692
|
+
container_id: import_v419.z.string(),
|
|
2693
|
+
outputs: import_v419.z.array(
|
|
2694
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2695
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
2696
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
2607
2697
|
])
|
|
2608
2698
|
).nullable()
|
|
2609
2699
|
});
|
|
2610
|
-
var
|
|
2611
|
-
type:
|
|
2612
|
-
id:
|
|
2613
|
-
|
|
2700
|
+
var localShellCallItem = import_v419.z.object({
|
|
2701
|
+
type: import_v419.z.literal("local_shell_call"),
|
|
2702
|
+
id: import_v419.z.string(),
|
|
2703
|
+
call_id: import_v419.z.string(),
|
|
2704
|
+
action: import_v419.z.object({
|
|
2705
|
+
type: import_v419.z.literal("exec"),
|
|
2706
|
+
command: import_v419.z.array(import_v419.z.string()),
|
|
2707
|
+
timeout_ms: import_v419.z.number().optional(),
|
|
2708
|
+
user: import_v419.z.string().optional(),
|
|
2709
|
+
working_directory: import_v419.z.string().optional(),
|
|
2710
|
+
env: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional()
|
|
2711
|
+
})
|
|
2712
|
+
});
|
|
2713
|
+
var imageGenerationCallItem = import_v419.z.object({
|
|
2714
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
2715
|
+
id: import_v419.z.string(),
|
|
2716
|
+
result: import_v419.z.string()
|
|
2614
2717
|
});
|
|
2615
2718
|
var TOP_LOGPROBS_MAX = 20;
|
|
2616
|
-
var LOGPROBS_SCHEMA =
|
|
2617
|
-
|
|
2618
|
-
token:
|
|
2619
|
-
logprob:
|
|
2620
|
-
top_logprobs:
|
|
2621
|
-
|
|
2622
|
-
token:
|
|
2623
|
-
logprob:
|
|
2719
|
+
var LOGPROBS_SCHEMA = import_v419.z.array(
|
|
2720
|
+
import_v419.z.object({
|
|
2721
|
+
token: import_v419.z.string(),
|
|
2722
|
+
logprob: import_v419.z.number(),
|
|
2723
|
+
top_logprobs: import_v419.z.array(
|
|
2724
|
+
import_v419.z.object({
|
|
2725
|
+
token: import_v419.z.string(),
|
|
2726
|
+
logprob: import_v419.z.number()
|
|
2624
2727
|
})
|
|
2625
2728
|
)
|
|
2626
2729
|
})
|
|
2627
2730
|
);
|
|
2628
2731
|
var OpenAIResponsesLanguageModel = class {
|
|
2629
2732
|
constructor(modelId, config) {
|
|
2630
|
-
this.specificationVersion = "
|
|
2733
|
+
this.specificationVersion = "v3";
|
|
2631
2734
|
this.supportedUrls = {
|
|
2632
2735
|
"image/*": [/^https?:\/\/.*$/],
|
|
2633
2736
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -2677,7 +2780,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2677
2780
|
if (stopSequences != null) {
|
|
2678
2781
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
2679
2782
|
}
|
|
2680
|
-
const openaiOptions = await (0,
|
|
2783
|
+
const openaiOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2681
2784
|
provider: "openai",
|
|
2682
2785
|
providerOptions,
|
|
2683
2786
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -2686,7 +2789,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2686
2789
|
prompt,
|
|
2687
2790
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
2688
2791
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
2689
|
-
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
|
|
2792
|
+
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
2793
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
2690
2794
|
});
|
|
2691
2795
|
warnings.push(...inputWarnings);
|
|
2692
2796
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
@@ -2845,51 +2949,51 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2845
2949
|
responseHeaders,
|
|
2846
2950
|
value: response,
|
|
2847
2951
|
rawValue: rawResponse
|
|
2848
|
-
} = await (0,
|
|
2952
|
+
} = await (0, import_provider_utils16.postJsonToApi)({
|
|
2849
2953
|
url,
|
|
2850
|
-
headers: (0,
|
|
2954
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
2851
2955
|
body,
|
|
2852
2956
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2853
|
-
successfulResponseHandler: (0,
|
|
2854
|
-
|
|
2855
|
-
id:
|
|
2856
|
-
created_at:
|
|
2857
|
-
error:
|
|
2858
|
-
code:
|
|
2859
|
-
message:
|
|
2957
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
2958
|
+
import_v419.z.object({
|
|
2959
|
+
id: import_v419.z.string(),
|
|
2960
|
+
created_at: import_v419.z.number(),
|
|
2961
|
+
error: import_v419.z.object({
|
|
2962
|
+
code: import_v419.z.string(),
|
|
2963
|
+
message: import_v419.z.string()
|
|
2860
2964
|
}).nullish(),
|
|
2861
|
-
model:
|
|
2862
|
-
output:
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
type:
|
|
2866
|
-
role:
|
|
2867
|
-
id:
|
|
2868
|
-
content:
|
|
2869
|
-
|
|
2870
|
-
type:
|
|
2871
|
-
text:
|
|
2965
|
+
model: import_v419.z.string(),
|
|
2966
|
+
output: import_v419.z.array(
|
|
2967
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2968
|
+
import_v419.z.object({
|
|
2969
|
+
type: import_v419.z.literal("message"),
|
|
2970
|
+
role: import_v419.z.literal("assistant"),
|
|
2971
|
+
id: import_v419.z.string(),
|
|
2972
|
+
content: import_v419.z.array(
|
|
2973
|
+
import_v419.z.object({
|
|
2974
|
+
type: import_v419.z.literal("output_text"),
|
|
2975
|
+
text: import_v419.z.string(),
|
|
2872
2976
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2873
|
-
annotations:
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
type:
|
|
2877
|
-
start_index:
|
|
2878
|
-
end_index:
|
|
2879
|
-
url:
|
|
2880
|
-
title:
|
|
2977
|
+
annotations: import_v419.z.array(
|
|
2978
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2979
|
+
import_v419.z.object({
|
|
2980
|
+
type: import_v419.z.literal("url_citation"),
|
|
2981
|
+
start_index: import_v419.z.number(),
|
|
2982
|
+
end_index: import_v419.z.number(),
|
|
2983
|
+
url: import_v419.z.string(),
|
|
2984
|
+
title: import_v419.z.string()
|
|
2881
2985
|
}),
|
|
2882
|
-
|
|
2883
|
-
type:
|
|
2884
|
-
file_id:
|
|
2885
|
-
filename:
|
|
2886
|
-
index:
|
|
2887
|
-
start_index:
|
|
2888
|
-
end_index:
|
|
2889
|
-
quote:
|
|
2986
|
+
import_v419.z.object({
|
|
2987
|
+
type: import_v419.z.literal("file_citation"),
|
|
2988
|
+
file_id: import_v419.z.string(),
|
|
2989
|
+
filename: import_v419.z.string().nullish(),
|
|
2990
|
+
index: import_v419.z.number().nullish(),
|
|
2991
|
+
start_index: import_v419.z.number().nullish(),
|
|
2992
|
+
end_index: import_v419.z.number().nullish(),
|
|
2993
|
+
quote: import_v419.z.string().nullish()
|
|
2890
2994
|
}),
|
|
2891
|
-
|
|
2892
|
-
type:
|
|
2995
|
+
import_v419.z.object({
|
|
2996
|
+
type: import_v419.z.literal("container_file_citation")
|
|
2893
2997
|
})
|
|
2894
2998
|
])
|
|
2895
2999
|
)
|
|
@@ -2900,33 +3004,34 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2900
3004
|
fileSearchCallItem,
|
|
2901
3005
|
codeInterpreterCallItem,
|
|
2902
3006
|
imageGenerationCallItem,
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
3007
|
+
localShellCallItem,
|
|
3008
|
+
import_v419.z.object({
|
|
3009
|
+
type: import_v419.z.literal("function_call"),
|
|
3010
|
+
call_id: import_v419.z.string(),
|
|
3011
|
+
name: import_v419.z.string(),
|
|
3012
|
+
arguments: import_v419.z.string(),
|
|
3013
|
+
id: import_v419.z.string()
|
|
2909
3014
|
}),
|
|
2910
|
-
|
|
2911
|
-
type:
|
|
2912
|
-
id:
|
|
2913
|
-
status:
|
|
3015
|
+
import_v419.z.object({
|
|
3016
|
+
type: import_v419.z.literal("computer_call"),
|
|
3017
|
+
id: import_v419.z.string(),
|
|
3018
|
+
status: import_v419.z.string().optional()
|
|
2914
3019
|
}),
|
|
2915
|
-
|
|
2916
|
-
type:
|
|
2917
|
-
id:
|
|
2918
|
-
encrypted_content:
|
|
2919
|
-
summary:
|
|
2920
|
-
|
|
2921
|
-
type:
|
|
2922
|
-
text:
|
|
3020
|
+
import_v419.z.object({
|
|
3021
|
+
type: import_v419.z.literal("reasoning"),
|
|
3022
|
+
id: import_v419.z.string(),
|
|
3023
|
+
encrypted_content: import_v419.z.string().nullish(),
|
|
3024
|
+
summary: import_v419.z.array(
|
|
3025
|
+
import_v419.z.object({
|
|
3026
|
+
type: import_v419.z.literal("summary_text"),
|
|
3027
|
+
text: import_v419.z.string()
|
|
2923
3028
|
})
|
|
2924
3029
|
)
|
|
2925
3030
|
})
|
|
2926
3031
|
])
|
|
2927
3032
|
),
|
|
2928
|
-
service_tier:
|
|
2929
|
-
incomplete_details:
|
|
3033
|
+
service_tier: import_v419.z.string().nullish(),
|
|
3034
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
2930
3035
|
usage: usageSchema2
|
|
2931
3036
|
})
|
|
2932
3037
|
),
|
|
@@ -2986,6 +3091,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2986
3091
|
});
|
|
2987
3092
|
break;
|
|
2988
3093
|
}
|
|
3094
|
+
case "local_shell_call": {
|
|
3095
|
+
content.push({
|
|
3096
|
+
type: "tool-call",
|
|
3097
|
+
toolCallId: part.call_id,
|
|
3098
|
+
toolName: "local_shell",
|
|
3099
|
+
input: JSON.stringify({ action: part.action }),
|
|
3100
|
+
providerMetadata: {
|
|
3101
|
+
openai: {
|
|
3102
|
+
itemId: part.id
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
});
|
|
3106
|
+
break;
|
|
3107
|
+
}
|
|
2989
3108
|
case "message": {
|
|
2990
3109
|
for (const contentPart of part.content) {
|
|
2991
3110
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -3005,7 +3124,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3005
3124
|
content.push({
|
|
3006
3125
|
type: "source",
|
|
3007
3126
|
sourceType: "url",
|
|
3008
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
3127
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils16.generateId)(),
|
|
3009
3128
|
url: annotation.url,
|
|
3010
3129
|
title: annotation.title
|
|
3011
3130
|
});
|
|
@@ -3013,7 +3132,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3013
3132
|
content.push({
|
|
3014
3133
|
type: "source",
|
|
3015
3134
|
sourceType: "document",
|
|
3016
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
3135
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils16.generateId)(),
|
|
3017
3136
|
mediaType: "text/plain",
|
|
3018
3137
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3019
3138
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id
|
|
@@ -3165,18 +3284,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3165
3284
|
warnings,
|
|
3166
3285
|
webSearchToolName
|
|
3167
3286
|
} = await this.getArgs(options);
|
|
3168
|
-
const { responseHeaders, value: response } = await (0,
|
|
3287
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
|
|
3169
3288
|
url: this.config.url({
|
|
3170
3289
|
path: "/responses",
|
|
3171
3290
|
modelId: this.modelId
|
|
3172
3291
|
}),
|
|
3173
|
-
headers: (0,
|
|
3292
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
3174
3293
|
body: {
|
|
3175
3294
|
...body,
|
|
3176
3295
|
stream: true
|
|
3177
3296
|
},
|
|
3178
3297
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3179
|
-
successfulResponseHandler: (0,
|
|
3298
|
+
successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
|
|
3180
3299
|
openaiResponsesChunkSchema
|
|
3181
3300
|
),
|
|
3182
3301
|
abortSignal: options.abortSignal,
|
|
@@ -3243,6 +3362,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3243
3362
|
id: value.item.id,
|
|
3244
3363
|
toolName: "computer_use"
|
|
3245
3364
|
});
|
|
3365
|
+
} else if (value.item.type === "code_interpreter_call") {
|
|
3366
|
+
ongoingToolCalls[value.output_index] = {
|
|
3367
|
+
toolName: "code_interpreter",
|
|
3368
|
+
toolCallId: value.item.id,
|
|
3369
|
+
codeInterpreter: {
|
|
3370
|
+
containerId: value.item.container_id
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3373
|
+
controller.enqueue({
|
|
3374
|
+
type: "tool-input-start",
|
|
3375
|
+
id: value.item.id,
|
|
3376
|
+
toolName: "code_interpreter"
|
|
3377
|
+
});
|
|
3378
|
+
controller.enqueue({
|
|
3379
|
+
type: "tool-input-delta",
|
|
3380
|
+
id: value.item.id,
|
|
3381
|
+
delta: `{"containerId":"${value.item.container_id}","code":"`
|
|
3382
|
+
});
|
|
3246
3383
|
} else if (value.item.type === "file_search_call") {
|
|
3247
3384
|
controller.enqueue({
|
|
3248
3385
|
type: "tool-call",
|
|
@@ -3366,16 +3503,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3366
3503
|
providerExecuted: true
|
|
3367
3504
|
});
|
|
3368
3505
|
} else if (value.item.type === "code_interpreter_call") {
|
|
3369
|
-
|
|
3370
|
-
type: "tool-call",
|
|
3371
|
-
toolCallId: value.item.id,
|
|
3372
|
-
toolName: "code_interpreter",
|
|
3373
|
-
input: JSON.stringify({
|
|
3374
|
-
code: value.item.code,
|
|
3375
|
-
containerId: value.item.container_id
|
|
3376
|
-
}),
|
|
3377
|
-
providerExecuted: true
|
|
3378
|
-
});
|
|
3506
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3379
3507
|
controller.enqueue({
|
|
3380
3508
|
type: "tool-result",
|
|
3381
3509
|
toolCallId: value.item.id,
|
|
@@ -3395,6 +3523,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3395
3523
|
},
|
|
3396
3524
|
providerExecuted: true
|
|
3397
3525
|
});
|
|
3526
|
+
} else if (value.item.type === "local_shell_call") {
|
|
3527
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3528
|
+
controller.enqueue({
|
|
3529
|
+
type: "tool-call",
|
|
3530
|
+
toolCallId: value.item.call_id,
|
|
3531
|
+
toolName: "local_shell",
|
|
3532
|
+
input: JSON.stringify({
|
|
3533
|
+
action: {
|
|
3534
|
+
type: "exec",
|
|
3535
|
+
command: value.item.action.command,
|
|
3536
|
+
timeoutMs: value.item.action.timeout_ms,
|
|
3537
|
+
user: value.item.action.user,
|
|
3538
|
+
workingDirectory: value.item.action.working_directory,
|
|
3539
|
+
env: value.item.action.env
|
|
3540
|
+
}
|
|
3541
|
+
}),
|
|
3542
|
+
providerMetadata: {
|
|
3543
|
+
openai: { itemId: value.item.id }
|
|
3544
|
+
}
|
|
3545
|
+
});
|
|
3398
3546
|
} else if (value.item.type === "message") {
|
|
3399
3547
|
controller.enqueue({
|
|
3400
3548
|
type: "text-end",
|
|
@@ -3425,6 +3573,51 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3425
3573
|
delta: value.delta
|
|
3426
3574
|
});
|
|
3427
3575
|
}
|
|
3576
|
+
} else if (isResponseImageGenerationCallPartialImageChunk(value)) {
|
|
3577
|
+
controller.enqueue({
|
|
3578
|
+
type: "tool-result",
|
|
3579
|
+
toolCallId: value.item_id,
|
|
3580
|
+
toolName: "image_generation",
|
|
3581
|
+
result: {
|
|
3582
|
+
result: value.partial_image_b64
|
|
3583
|
+
},
|
|
3584
|
+
providerExecuted: true,
|
|
3585
|
+
preliminary: true
|
|
3586
|
+
});
|
|
3587
|
+
} else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
|
|
3588
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3589
|
+
if (toolCall != null) {
|
|
3590
|
+
controller.enqueue({
|
|
3591
|
+
type: "tool-input-delta",
|
|
3592
|
+
id: toolCall.toolCallId,
|
|
3593
|
+
// The delta is code, which is embedding in a JSON string.
|
|
3594
|
+
// To escape it, we use JSON.stringify and slice to remove the outer quotes.
|
|
3595
|
+
delta: JSON.stringify(value.delta).slice(1, -1)
|
|
3596
|
+
});
|
|
3597
|
+
}
|
|
3598
|
+
} else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
|
|
3599
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3600
|
+
if (toolCall != null) {
|
|
3601
|
+
controller.enqueue({
|
|
3602
|
+
type: "tool-input-delta",
|
|
3603
|
+
id: toolCall.toolCallId,
|
|
3604
|
+
delta: '"}'
|
|
3605
|
+
});
|
|
3606
|
+
controller.enqueue({
|
|
3607
|
+
type: "tool-input-end",
|
|
3608
|
+
id: toolCall.toolCallId
|
|
3609
|
+
});
|
|
3610
|
+
controller.enqueue({
|
|
3611
|
+
type: "tool-call",
|
|
3612
|
+
toolCallId: toolCall.toolCallId,
|
|
3613
|
+
toolName: "code_interpreter",
|
|
3614
|
+
input: JSON.stringify({
|
|
3615
|
+
code: value.code,
|
|
3616
|
+
containerId: toolCall.codeInterpreter.containerId
|
|
3617
|
+
}),
|
|
3618
|
+
providerExecuted: true
|
|
3619
|
+
});
|
|
3620
|
+
}
|
|
3428
3621
|
} else if (isResponseCreatedChunk(value)) {
|
|
3429
3622
|
responseId = value.response.id;
|
|
3430
3623
|
controller.enqueue({
|
|
@@ -3487,7 +3680,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3487
3680
|
controller.enqueue({
|
|
3488
3681
|
type: "source",
|
|
3489
3682
|
sourceType: "url",
|
|
3490
|
-
id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0,
|
|
3683
|
+
id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils16.generateId)(),
|
|
3491
3684
|
url: value.annotation.url,
|
|
3492
3685
|
title: value.annotation.title
|
|
3493
3686
|
});
|
|
@@ -3495,7 +3688,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3495
3688
|
controller.enqueue({
|
|
3496
3689
|
type: "source",
|
|
3497
3690
|
sourceType: "document",
|
|
3498
|
-
id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0,
|
|
3691
|
+
id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils16.generateId)(),
|
|
3499
3692
|
mediaType: "text/plain",
|
|
3500
3693
|
title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
|
|
3501
3694
|
filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
|
|
@@ -3531,166 +3724,201 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3531
3724
|
};
|
|
3532
3725
|
}
|
|
3533
3726
|
};
|
|
3534
|
-
var usageSchema2 =
|
|
3535
|
-
input_tokens:
|
|
3536
|
-
input_tokens_details:
|
|
3537
|
-
output_tokens:
|
|
3538
|
-
output_tokens_details:
|
|
3727
|
+
var usageSchema2 = import_v419.z.object({
|
|
3728
|
+
input_tokens: import_v419.z.number(),
|
|
3729
|
+
input_tokens_details: import_v419.z.object({ cached_tokens: import_v419.z.number().nullish() }).nullish(),
|
|
3730
|
+
output_tokens: import_v419.z.number(),
|
|
3731
|
+
output_tokens_details: import_v419.z.object({ reasoning_tokens: import_v419.z.number().nullish() }).nullish()
|
|
3539
3732
|
});
|
|
3540
|
-
var textDeltaChunkSchema =
|
|
3541
|
-
type:
|
|
3542
|
-
item_id:
|
|
3543
|
-
delta:
|
|
3733
|
+
var textDeltaChunkSchema = import_v419.z.object({
|
|
3734
|
+
type: import_v419.z.literal("response.output_text.delta"),
|
|
3735
|
+
item_id: import_v419.z.string(),
|
|
3736
|
+
delta: import_v419.z.string(),
|
|
3544
3737
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3545
3738
|
});
|
|
3546
|
-
var errorChunkSchema =
|
|
3547
|
-
type:
|
|
3548
|
-
code:
|
|
3549
|
-
message:
|
|
3550
|
-
param:
|
|
3551
|
-
sequence_number:
|
|
3739
|
+
var errorChunkSchema = import_v419.z.object({
|
|
3740
|
+
type: import_v419.z.literal("error"),
|
|
3741
|
+
code: import_v419.z.string(),
|
|
3742
|
+
message: import_v419.z.string(),
|
|
3743
|
+
param: import_v419.z.string().nullish(),
|
|
3744
|
+
sequence_number: import_v419.z.number()
|
|
3552
3745
|
});
|
|
3553
|
-
var responseFinishedChunkSchema =
|
|
3554
|
-
type:
|
|
3555
|
-
response:
|
|
3556
|
-
incomplete_details:
|
|
3746
|
+
var responseFinishedChunkSchema = import_v419.z.object({
|
|
3747
|
+
type: import_v419.z.enum(["response.completed", "response.incomplete"]),
|
|
3748
|
+
response: import_v419.z.object({
|
|
3749
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
3557
3750
|
usage: usageSchema2,
|
|
3558
|
-
service_tier:
|
|
3751
|
+
service_tier: import_v419.z.string().nullish()
|
|
3559
3752
|
})
|
|
3560
3753
|
});
|
|
3561
|
-
var responseCreatedChunkSchema =
|
|
3562
|
-
type:
|
|
3563
|
-
response:
|
|
3564
|
-
id:
|
|
3565
|
-
created_at:
|
|
3566
|
-
model:
|
|
3567
|
-
service_tier:
|
|
3754
|
+
var responseCreatedChunkSchema = import_v419.z.object({
|
|
3755
|
+
type: import_v419.z.literal("response.created"),
|
|
3756
|
+
response: import_v419.z.object({
|
|
3757
|
+
id: import_v419.z.string(),
|
|
3758
|
+
created_at: import_v419.z.number(),
|
|
3759
|
+
model: import_v419.z.string(),
|
|
3760
|
+
service_tier: import_v419.z.string().nullish()
|
|
3568
3761
|
})
|
|
3569
3762
|
});
|
|
3570
|
-
var responseOutputItemAddedSchema =
|
|
3571
|
-
type:
|
|
3572
|
-
output_index:
|
|
3573
|
-
item:
|
|
3574
|
-
|
|
3575
|
-
type:
|
|
3576
|
-
id:
|
|
3763
|
+
var responseOutputItemAddedSchema = import_v419.z.object({
|
|
3764
|
+
type: import_v419.z.literal("response.output_item.added"),
|
|
3765
|
+
output_index: import_v419.z.number(),
|
|
3766
|
+
item: import_v419.z.discriminatedUnion("type", [
|
|
3767
|
+
import_v419.z.object({
|
|
3768
|
+
type: import_v419.z.literal("message"),
|
|
3769
|
+
id: import_v419.z.string()
|
|
3577
3770
|
}),
|
|
3578
|
-
|
|
3579
|
-
type:
|
|
3580
|
-
id:
|
|
3581
|
-
encrypted_content:
|
|
3771
|
+
import_v419.z.object({
|
|
3772
|
+
type: import_v419.z.literal("reasoning"),
|
|
3773
|
+
id: import_v419.z.string(),
|
|
3774
|
+
encrypted_content: import_v419.z.string().nullish()
|
|
3582
3775
|
}),
|
|
3583
|
-
|
|
3584
|
-
type:
|
|
3585
|
-
id:
|
|
3586
|
-
call_id:
|
|
3587
|
-
name:
|
|
3588
|
-
arguments:
|
|
3776
|
+
import_v419.z.object({
|
|
3777
|
+
type: import_v419.z.literal("function_call"),
|
|
3778
|
+
id: import_v419.z.string(),
|
|
3779
|
+
call_id: import_v419.z.string(),
|
|
3780
|
+
name: import_v419.z.string(),
|
|
3781
|
+
arguments: import_v419.z.string()
|
|
3589
3782
|
}),
|
|
3590
|
-
|
|
3591
|
-
type:
|
|
3592
|
-
id:
|
|
3593
|
-
status:
|
|
3594
|
-
action:
|
|
3595
|
-
type:
|
|
3596
|
-
query:
|
|
3783
|
+
import_v419.z.object({
|
|
3784
|
+
type: import_v419.z.literal("web_search_call"),
|
|
3785
|
+
id: import_v419.z.string(),
|
|
3786
|
+
status: import_v419.z.string(),
|
|
3787
|
+
action: import_v419.z.object({
|
|
3788
|
+
type: import_v419.z.literal("search"),
|
|
3789
|
+
query: import_v419.z.string().optional()
|
|
3597
3790
|
}).nullish()
|
|
3598
3791
|
}),
|
|
3599
|
-
|
|
3600
|
-
type:
|
|
3601
|
-
id:
|
|
3602
|
-
status:
|
|
3792
|
+
import_v419.z.object({
|
|
3793
|
+
type: import_v419.z.literal("computer_call"),
|
|
3794
|
+
id: import_v419.z.string(),
|
|
3795
|
+
status: import_v419.z.string()
|
|
3796
|
+
}),
|
|
3797
|
+
import_v419.z.object({
|
|
3798
|
+
type: import_v419.z.literal("file_search_call"),
|
|
3799
|
+
id: import_v419.z.string()
|
|
3603
3800
|
}),
|
|
3604
|
-
|
|
3605
|
-
type:
|
|
3606
|
-
id:
|
|
3801
|
+
import_v419.z.object({
|
|
3802
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
3803
|
+
id: import_v419.z.string()
|
|
3607
3804
|
}),
|
|
3608
|
-
|
|
3609
|
-
type:
|
|
3610
|
-
id:
|
|
3805
|
+
import_v419.z.object({
|
|
3806
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
3807
|
+
id: import_v419.z.string(),
|
|
3808
|
+
container_id: import_v419.z.string(),
|
|
3809
|
+
code: import_v419.z.string().nullable(),
|
|
3810
|
+
outputs: import_v419.z.array(
|
|
3811
|
+
import_v419.z.discriminatedUnion("type", [
|
|
3812
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
3813
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
3814
|
+
])
|
|
3815
|
+
).nullable(),
|
|
3816
|
+
status: import_v419.z.string()
|
|
3611
3817
|
})
|
|
3612
3818
|
])
|
|
3613
3819
|
});
|
|
3614
|
-
var responseOutputItemDoneSchema =
|
|
3615
|
-
type:
|
|
3616
|
-
output_index:
|
|
3617
|
-
item:
|
|
3618
|
-
|
|
3619
|
-
type:
|
|
3620
|
-
id:
|
|
3820
|
+
var responseOutputItemDoneSchema = import_v419.z.object({
|
|
3821
|
+
type: import_v419.z.literal("response.output_item.done"),
|
|
3822
|
+
output_index: import_v419.z.number(),
|
|
3823
|
+
item: import_v419.z.discriminatedUnion("type", [
|
|
3824
|
+
import_v419.z.object({
|
|
3825
|
+
type: import_v419.z.literal("message"),
|
|
3826
|
+
id: import_v419.z.string()
|
|
3621
3827
|
}),
|
|
3622
|
-
|
|
3623
|
-
type:
|
|
3624
|
-
id:
|
|
3625
|
-
encrypted_content:
|
|
3828
|
+
import_v419.z.object({
|
|
3829
|
+
type: import_v419.z.literal("reasoning"),
|
|
3830
|
+
id: import_v419.z.string(),
|
|
3831
|
+
encrypted_content: import_v419.z.string().nullish()
|
|
3626
3832
|
}),
|
|
3627
|
-
|
|
3628
|
-
type:
|
|
3629
|
-
id:
|
|
3630
|
-
call_id:
|
|
3631
|
-
name:
|
|
3632
|
-
arguments:
|
|
3633
|
-
status:
|
|
3833
|
+
import_v419.z.object({
|
|
3834
|
+
type: import_v419.z.literal("function_call"),
|
|
3835
|
+
id: import_v419.z.string(),
|
|
3836
|
+
call_id: import_v419.z.string(),
|
|
3837
|
+
name: import_v419.z.string(),
|
|
3838
|
+
arguments: import_v419.z.string(),
|
|
3839
|
+
status: import_v419.z.literal("completed")
|
|
3634
3840
|
}),
|
|
3635
3841
|
codeInterpreterCallItem,
|
|
3636
3842
|
imageGenerationCallItem,
|
|
3637
3843
|
webSearchCallItem,
|
|
3638
3844
|
fileSearchCallItem,
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3845
|
+
localShellCallItem,
|
|
3846
|
+
import_v419.z.object({
|
|
3847
|
+
type: import_v419.z.literal("computer_call"),
|
|
3848
|
+
id: import_v419.z.string(),
|
|
3849
|
+
status: import_v419.z.literal("completed")
|
|
3643
3850
|
})
|
|
3644
3851
|
])
|
|
3645
3852
|
});
|
|
3646
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3647
|
-
type:
|
|
3648
|
-
item_id:
|
|
3649
|
-
output_index:
|
|
3650
|
-
delta:
|
|
3853
|
+
var responseFunctionCallArgumentsDeltaSchema = import_v419.z.object({
|
|
3854
|
+
type: import_v419.z.literal("response.function_call_arguments.delta"),
|
|
3855
|
+
item_id: import_v419.z.string(),
|
|
3856
|
+
output_index: import_v419.z.number(),
|
|
3857
|
+
delta: import_v419.z.string()
|
|
3858
|
+
});
|
|
3859
|
+
var responseImageGenerationCallPartialImageSchema = import_v419.z.object({
|
|
3860
|
+
type: import_v419.z.literal("response.image_generation_call.partial_image"),
|
|
3861
|
+
item_id: import_v419.z.string(),
|
|
3862
|
+
output_index: import_v419.z.number(),
|
|
3863
|
+
partial_image_b64: import_v419.z.string()
|
|
3651
3864
|
});
|
|
3652
|
-
var
|
|
3653
|
-
type:
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3865
|
+
var responseCodeInterpreterCallCodeDeltaSchema = import_v419.z.object({
|
|
3866
|
+
type: import_v419.z.literal("response.code_interpreter_call_code.delta"),
|
|
3867
|
+
item_id: import_v419.z.string(),
|
|
3868
|
+
output_index: import_v419.z.number(),
|
|
3869
|
+
delta: import_v419.z.string()
|
|
3870
|
+
});
|
|
3871
|
+
var responseCodeInterpreterCallCodeDoneSchema = import_v419.z.object({
|
|
3872
|
+
type: import_v419.z.literal("response.code_interpreter_call_code.done"),
|
|
3873
|
+
item_id: import_v419.z.string(),
|
|
3874
|
+
output_index: import_v419.z.number(),
|
|
3875
|
+
code: import_v419.z.string()
|
|
3876
|
+
});
|
|
3877
|
+
var responseAnnotationAddedSchema = import_v419.z.object({
|
|
3878
|
+
type: import_v419.z.literal("response.output_text.annotation.added"),
|
|
3879
|
+
annotation: import_v419.z.discriminatedUnion("type", [
|
|
3880
|
+
import_v419.z.object({
|
|
3881
|
+
type: import_v419.z.literal("url_citation"),
|
|
3882
|
+
url: import_v419.z.string(),
|
|
3883
|
+
title: import_v419.z.string()
|
|
3659
3884
|
}),
|
|
3660
|
-
|
|
3661
|
-
type:
|
|
3662
|
-
file_id:
|
|
3663
|
-
filename:
|
|
3664
|
-
index:
|
|
3665
|
-
start_index:
|
|
3666
|
-
end_index:
|
|
3667
|
-
quote:
|
|
3885
|
+
import_v419.z.object({
|
|
3886
|
+
type: import_v419.z.literal("file_citation"),
|
|
3887
|
+
file_id: import_v419.z.string(),
|
|
3888
|
+
filename: import_v419.z.string().nullish(),
|
|
3889
|
+
index: import_v419.z.number().nullish(),
|
|
3890
|
+
start_index: import_v419.z.number().nullish(),
|
|
3891
|
+
end_index: import_v419.z.number().nullish(),
|
|
3892
|
+
quote: import_v419.z.string().nullish()
|
|
3668
3893
|
})
|
|
3669
3894
|
])
|
|
3670
3895
|
});
|
|
3671
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3672
|
-
type:
|
|
3673
|
-
item_id:
|
|
3674
|
-
summary_index:
|
|
3896
|
+
var responseReasoningSummaryPartAddedSchema = import_v419.z.object({
|
|
3897
|
+
type: import_v419.z.literal("response.reasoning_summary_part.added"),
|
|
3898
|
+
item_id: import_v419.z.string(),
|
|
3899
|
+
summary_index: import_v419.z.number()
|
|
3675
3900
|
});
|
|
3676
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3677
|
-
type:
|
|
3678
|
-
item_id:
|
|
3679
|
-
summary_index:
|
|
3680
|
-
delta:
|
|
3901
|
+
var responseReasoningSummaryTextDeltaSchema = import_v419.z.object({
|
|
3902
|
+
type: import_v419.z.literal("response.reasoning_summary_text.delta"),
|
|
3903
|
+
item_id: import_v419.z.string(),
|
|
3904
|
+
summary_index: import_v419.z.number(),
|
|
3905
|
+
delta: import_v419.z.string()
|
|
3681
3906
|
});
|
|
3682
|
-
var openaiResponsesChunkSchema =
|
|
3907
|
+
var openaiResponsesChunkSchema = import_v419.z.union([
|
|
3683
3908
|
textDeltaChunkSchema,
|
|
3684
3909
|
responseFinishedChunkSchema,
|
|
3685
3910
|
responseCreatedChunkSchema,
|
|
3686
3911
|
responseOutputItemAddedSchema,
|
|
3687
3912
|
responseOutputItemDoneSchema,
|
|
3688
3913
|
responseFunctionCallArgumentsDeltaSchema,
|
|
3914
|
+
responseImageGenerationCallPartialImageSchema,
|
|
3915
|
+
responseCodeInterpreterCallCodeDeltaSchema,
|
|
3916
|
+
responseCodeInterpreterCallCodeDoneSchema,
|
|
3689
3917
|
responseAnnotationAddedSchema,
|
|
3690
3918
|
responseReasoningSummaryPartAddedSchema,
|
|
3691
3919
|
responseReasoningSummaryTextDeltaSchema,
|
|
3692
3920
|
errorChunkSchema,
|
|
3693
|
-
|
|
3921
|
+
import_v419.z.object({ type: import_v419.z.string() }).loose()
|
|
3694
3922
|
// fallback for unknown chunks
|
|
3695
3923
|
]);
|
|
3696
3924
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3711,6 +3939,15 @@ function isResponseCreatedChunk(chunk) {
|
|
|
3711
3939
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
3712
3940
|
return chunk.type === "response.function_call_arguments.delta";
|
|
3713
3941
|
}
|
|
3942
|
+
function isResponseImageGenerationCallPartialImageChunk(chunk) {
|
|
3943
|
+
return chunk.type === "response.image_generation_call.partial_image";
|
|
3944
|
+
}
|
|
3945
|
+
function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
|
|
3946
|
+
return chunk.type === "response.code_interpreter_call_code.delta";
|
|
3947
|
+
}
|
|
3948
|
+
function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
|
|
3949
|
+
return chunk.type === "response.code_interpreter_call_code.done";
|
|
3950
|
+
}
|
|
3714
3951
|
function isResponseOutputItemAddedChunk(chunk) {
|
|
3715
3952
|
return chunk.type === "response.output_item.added";
|
|
3716
3953
|
}
|
|
@@ -3763,15 +4000,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3763
4000
|
isReasoningModel: false
|
|
3764
4001
|
};
|
|
3765
4002
|
}
|
|
3766
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3767
|
-
include:
|
|
3768
|
-
|
|
4003
|
+
var openaiResponsesProviderOptionsSchema = import_v419.z.object({
|
|
4004
|
+
include: import_v419.z.array(
|
|
4005
|
+
import_v419.z.enum([
|
|
3769
4006
|
"reasoning.encrypted_content",
|
|
3770
4007
|
"file_search_call.results",
|
|
3771
4008
|
"message.output_text.logprobs"
|
|
3772
4009
|
])
|
|
3773
4010
|
).nullish(),
|
|
3774
|
-
instructions:
|
|
4011
|
+
instructions: import_v419.z.string().nullish(),
|
|
3775
4012
|
/**
|
|
3776
4013
|
* Return the log probabilities of the tokens.
|
|
3777
4014
|
*
|
|
@@ -3784,25 +4021,25 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3784
4021
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3785
4022
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3786
4023
|
*/
|
|
3787
|
-
logprobs:
|
|
4024
|
+
logprobs: import_v419.z.union([import_v419.z.boolean(), import_v419.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3788
4025
|
/**
|
|
3789
4026
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3790
4027
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3791
4028
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3792
4029
|
*/
|
|
3793
|
-
maxToolCalls:
|
|
3794
|
-
metadata:
|
|
3795
|
-
parallelToolCalls:
|
|
3796
|
-
previousResponseId:
|
|
3797
|
-
promptCacheKey:
|
|
3798
|
-
reasoningEffort:
|
|
3799
|
-
reasoningSummary:
|
|
3800
|
-
safetyIdentifier:
|
|
3801
|
-
serviceTier:
|
|
3802
|
-
store:
|
|
3803
|
-
strictJsonSchema:
|
|
3804
|
-
textVerbosity:
|
|
3805
|
-
user:
|
|
4030
|
+
maxToolCalls: import_v419.z.number().nullish(),
|
|
4031
|
+
metadata: import_v419.z.any().nullish(),
|
|
4032
|
+
parallelToolCalls: import_v419.z.boolean().nullish(),
|
|
4033
|
+
previousResponseId: import_v419.z.string().nullish(),
|
|
4034
|
+
promptCacheKey: import_v419.z.string().nullish(),
|
|
4035
|
+
reasoningEffort: import_v419.z.string().nullish(),
|
|
4036
|
+
reasoningSummary: import_v419.z.string().nullish(),
|
|
4037
|
+
safetyIdentifier: import_v419.z.string().nullish(),
|
|
4038
|
+
serviceTier: import_v419.z.enum(["auto", "flex", "priority"]).nullish(),
|
|
4039
|
+
store: import_v419.z.boolean().nullish(),
|
|
4040
|
+
strictJsonSchema: import_v419.z.boolean().nullish(),
|
|
4041
|
+
textVerbosity: import_v419.z.enum(["low", "medium", "high"]).nullish(),
|
|
4042
|
+
user: import_v419.z.string().nullish()
|
|
3806
4043
|
});
|
|
3807
4044
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3808
4045
|
0 && (module.exports = {
|
|
@@ -3813,11 +4050,22 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3813
4050
|
OpenAIResponsesLanguageModel,
|
|
3814
4051
|
OpenAISpeechModel,
|
|
3815
4052
|
OpenAITranscriptionModel,
|
|
4053
|
+
codeInterpreter,
|
|
4054
|
+
codeInterpreterArgsSchema,
|
|
4055
|
+
codeInterpreterInputSchema,
|
|
4056
|
+
codeInterpreterOutputSchema,
|
|
4057
|
+
codeInterpreterToolFactory,
|
|
4058
|
+
fileSearch,
|
|
4059
|
+
fileSearchArgsSchema,
|
|
4060
|
+
fileSearchOutputSchema,
|
|
3816
4061
|
hasDefaultResponseFormat,
|
|
4062
|
+
imageGeneration,
|
|
4063
|
+
imageGenerationArgsSchema,
|
|
4064
|
+
imageGenerationOutputSchema,
|
|
3817
4065
|
modelMaxImagesPerCall,
|
|
3818
4066
|
openAITranscriptionProviderOptions,
|
|
4067
|
+
openaiChatLanguageModelOptions,
|
|
3819
4068
|
openaiCompletionProviderOptions,
|
|
3820
|
-
openaiEmbeddingProviderOptions
|
|
3821
|
-
openaiProviderOptions
|
|
4069
|
+
openaiEmbeddingProviderOptions
|
|
3822
4070
|
});
|
|
3823
4071
|
//# sourceMappingURL=index.js.map
|