@ai-sdk/openai 2.1.0-beta.1 → 2.1.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/dist/index.d.mts +67 -14
- package/dist/index.d.ts +67 -14
- package/dist/index.js +616 -399
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +586 -368
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +333 -23
- package/dist/internal/index.d.ts +333 -23
- package/dist/internal/index.js +632 -407
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +600 -386
- 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,206 @@ 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
|
-
quality:
|
|
2434
|
-
size:
|
|
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
|
+
quality: import_v418.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
2513
|
+
size: import_v418.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
2435
2514
|
}).strict();
|
|
2436
|
-
var imageGenerationOutputSchema =
|
|
2437
|
-
result:
|
|
2515
|
+
var imageGenerationOutputSchema = import_v418.z.object({
|
|
2516
|
+
result: import_v418.z.string()
|
|
2438
2517
|
});
|
|
2439
|
-
var imageGenerationToolFactory = (0,
|
|
2518
|
+
var imageGenerationToolFactory = (0, import_provider_utils15.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2440
2519
|
id: "openai.image_generation",
|
|
2441
2520
|
name: "image_generation",
|
|
2442
|
-
inputSchema:
|
|
2521
|
+
inputSchema: import_v418.z.object({}),
|
|
2443
2522
|
outputSchema: imageGenerationOutputSchema
|
|
2444
2523
|
});
|
|
2524
|
+
var imageGeneration = (args = {}) => {
|
|
2525
|
+
return imageGenerationToolFactory(args);
|
|
2526
|
+
};
|
|
2445
2527
|
|
|
2446
2528
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2447
2529
|
function prepareResponsesTools({
|
|
@@ -2482,6 +2564,12 @@ function prepareResponsesTools({
|
|
|
2482
2564
|
});
|
|
2483
2565
|
break;
|
|
2484
2566
|
}
|
|
2567
|
+
case "openai.local_shell": {
|
|
2568
|
+
openaiTools.push({
|
|
2569
|
+
type: "local_shell"
|
|
2570
|
+
});
|
|
2571
|
+
break;
|
|
2572
|
+
}
|
|
2485
2573
|
case "openai.web_search_preview": {
|
|
2486
2574
|
const args = webSearchPreviewArgsSchema.parse(tool.args);
|
|
2487
2575
|
openaiTools.push({
|
|
@@ -2561,73 +2649,86 @@ function prepareResponsesTools({
|
|
|
2561
2649
|
}
|
|
2562
2650
|
|
|
2563
2651
|
// src/responses/openai-responses-language-model.ts
|
|
2564
|
-
var webSearchCallItem =
|
|
2565
|
-
type:
|
|
2566
|
-
id:
|
|
2567
|
-
status:
|
|
2568
|
-
action:
|
|
2569
|
-
|
|
2570
|
-
type:
|
|
2571
|
-
query:
|
|
2652
|
+
var webSearchCallItem = import_v419.z.object({
|
|
2653
|
+
type: import_v419.z.literal("web_search_call"),
|
|
2654
|
+
id: import_v419.z.string(),
|
|
2655
|
+
status: import_v419.z.string(),
|
|
2656
|
+
action: import_v419.z.discriminatedUnion("type", [
|
|
2657
|
+
import_v419.z.object({
|
|
2658
|
+
type: import_v419.z.literal("search"),
|
|
2659
|
+
query: import_v419.z.string().nullish()
|
|
2572
2660
|
}),
|
|
2573
|
-
|
|
2574
|
-
type:
|
|
2575
|
-
url:
|
|
2661
|
+
import_v419.z.object({
|
|
2662
|
+
type: import_v419.z.literal("open_page"),
|
|
2663
|
+
url: import_v419.z.string()
|
|
2576
2664
|
}),
|
|
2577
|
-
|
|
2578
|
-
type:
|
|
2579
|
-
url:
|
|
2580
|
-
pattern:
|
|
2665
|
+
import_v419.z.object({
|
|
2666
|
+
type: import_v419.z.literal("find"),
|
|
2667
|
+
url: import_v419.z.string(),
|
|
2668
|
+
pattern: import_v419.z.string()
|
|
2581
2669
|
})
|
|
2582
2670
|
]).nullish()
|
|
2583
2671
|
});
|
|
2584
|
-
var fileSearchCallItem =
|
|
2585
|
-
type:
|
|
2586
|
-
id:
|
|
2587
|
-
queries:
|
|
2588
|
-
results:
|
|
2589
|
-
|
|
2590
|
-
attributes:
|
|
2591
|
-
file_id:
|
|
2592
|
-
filename:
|
|
2593
|
-
score:
|
|
2594
|
-
text:
|
|
2672
|
+
var fileSearchCallItem = import_v419.z.object({
|
|
2673
|
+
type: import_v419.z.literal("file_search_call"),
|
|
2674
|
+
id: import_v419.z.string(),
|
|
2675
|
+
queries: import_v419.z.array(import_v419.z.string()),
|
|
2676
|
+
results: import_v419.z.array(
|
|
2677
|
+
import_v419.z.object({
|
|
2678
|
+
attributes: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()),
|
|
2679
|
+
file_id: import_v419.z.string(),
|
|
2680
|
+
filename: import_v419.z.string(),
|
|
2681
|
+
score: import_v419.z.number(),
|
|
2682
|
+
text: import_v419.z.string()
|
|
2595
2683
|
})
|
|
2596
2684
|
).nullish()
|
|
2597
2685
|
});
|
|
2598
|
-
var codeInterpreterCallItem =
|
|
2599
|
-
type:
|
|
2600
|
-
id:
|
|
2601
|
-
code:
|
|
2602
|
-
container_id:
|
|
2603
|
-
outputs:
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2686
|
+
var codeInterpreterCallItem = import_v419.z.object({
|
|
2687
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
2688
|
+
id: import_v419.z.string(),
|
|
2689
|
+
code: import_v419.z.string().nullable(),
|
|
2690
|
+
container_id: import_v419.z.string(),
|
|
2691
|
+
outputs: import_v419.z.array(
|
|
2692
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2693
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
2694
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
2607
2695
|
])
|
|
2608
2696
|
).nullable()
|
|
2609
2697
|
});
|
|
2610
|
-
var
|
|
2611
|
-
type:
|
|
2612
|
-
id:
|
|
2613
|
-
|
|
2698
|
+
var localShellCallItem = import_v419.z.object({
|
|
2699
|
+
type: import_v419.z.literal("local_shell_call"),
|
|
2700
|
+
id: import_v419.z.string(),
|
|
2701
|
+
call_id: import_v419.z.string(),
|
|
2702
|
+
action: import_v419.z.object({
|
|
2703
|
+
type: import_v419.z.literal("exec"),
|
|
2704
|
+
command: import_v419.z.array(import_v419.z.string()),
|
|
2705
|
+
timeout_ms: import_v419.z.number().optional(),
|
|
2706
|
+
user: import_v419.z.string().optional(),
|
|
2707
|
+
working_directory: import_v419.z.string().optional(),
|
|
2708
|
+
env: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional()
|
|
2709
|
+
})
|
|
2710
|
+
});
|
|
2711
|
+
var imageGenerationCallItem = import_v419.z.object({
|
|
2712
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
2713
|
+
id: import_v419.z.string(),
|
|
2714
|
+
result: import_v419.z.string()
|
|
2614
2715
|
});
|
|
2615
2716
|
var TOP_LOGPROBS_MAX = 20;
|
|
2616
|
-
var LOGPROBS_SCHEMA =
|
|
2617
|
-
|
|
2618
|
-
token:
|
|
2619
|
-
logprob:
|
|
2620
|
-
top_logprobs:
|
|
2621
|
-
|
|
2622
|
-
token:
|
|
2623
|
-
logprob:
|
|
2717
|
+
var LOGPROBS_SCHEMA = import_v419.z.array(
|
|
2718
|
+
import_v419.z.object({
|
|
2719
|
+
token: import_v419.z.string(),
|
|
2720
|
+
logprob: import_v419.z.number(),
|
|
2721
|
+
top_logprobs: import_v419.z.array(
|
|
2722
|
+
import_v419.z.object({
|
|
2723
|
+
token: import_v419.z.string(),
|
|
2724
|
+
logprob: import_v419.z.number()
|
|
2624
2725
|
})
|
|
2625
2726
|
)
|
|
2626
2727
|
})
|
|
2627
2728
|
);
|
|
2628
2729
|
var OpenAIResponsesLanguageModel = class {
|
|
2629
2730
|
constructor(modelId, config) {
|
|
2630
|
-
this.specificationVersion = "
|
|
2731
|
+
this.specificationVersion = "v3";
|
|
2631
2732
|
this.supportedUrls = {
|
|
2632
2733
|
"image/*": [/^https?:\/\/.*$/],
|
|
2633
2734
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -2677,7 +2778,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2677
2778
|
if (stopSequences != null) {
|
|
2678
2779
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
2679
2780
|
}
|
|
2680
|
-
const openaiOptions = await (0,
|
|
2781
|
+
const openaiOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2681
2782
|
provider: "openai",
|
|
2682
2783
|
providerOptions,
|
|
2683
2784
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -2686,7 +2787,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2686
2787
|
prompt,
|
|
2687
2788
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
2688
2789
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
2689
|
-
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
|
|
2790
|
+
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
2791
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
2690
2792
|
});
|
|
2691
2793
|
warnings.push(...inputWarnings);
|
|
2692
2794
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
@@ -2845,51 +2947,51 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2845
2947
|
responseHeaders,
|
|
2846
2948
|
value: response,
|
|
2847
2949
|
rawValue: rawResponse
|
|
2848
|
-
} = await (0,
|
|
2950
|
+
} = await (0, import_provider_utils16.postJsonToApi)({
|
|
2849
2951
|
url,
|
|
2850
|
-
headers: (0,
|
|
2952
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
2851
2953
|
body,
|
|
2852
2954
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2853
|
-
successfulResponseHandler: (0,
|
|
2854
|
-
|
|
2855
|
-
id:
|
|
2856
|
-
created_at:
|
|
2857
|
-
error:
|
|
2858
|
-
code:
|
|
2859
|
-
message:
|
|
2955
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
2956
|
+
import_v419.z.object({
|
|
2957
|
+
id: import_v419.z.string(),
|
|
2958
|
+
created_at: import_v419.z.number(),
|
|
2959
|
+
error: import_v419.z.object({
|
|
2960
|
+
code: import_v419.z.string(),
|
|
2961
|
+
message: import_v419.z.string()
|
|
2860
2962
|
}).nullish(),
|
|
2861
|
-
model:
|
|
2862
|
-
output:
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
type:
|
|
2866
|
-
role:
|
|
2867
|
-
id:
|
|
2868
|
-
content:
|
|
2869
|
-
|
|
2870
|
-
type:
|
|
2871
|
-
text:
|
|
2963
|
+
model: import_v419.z.string(),
|
|
2964
|
+
output: import_v419.z.array(
|
|
2965
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2966
|
+
import_v419.z.object({
|
|
2967
|
+
type: import_v419.z.literal("message"),
|
|
2968
|
+
role: import_v419.z.literal("assistant"),
|
|
2969
|
+
id: import_v419.z.string(),
|
|
2970
|
+
content: import_v419.z.array(
|
|
2971
|
+
import_v419.z.object({
|
|
2972
|
+
type: import_v419.z.literal("output_text"),
|
|
2973
|
+
text: import_v419.z.string(),
|
|
2872
2974
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2873
|
-
annotations:
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
type:
|
|
2877
|
-
start_index:
|
|
2878
|
-
end_index:
|
|
2879
|
-
url:
|
|
2880
|
-
title:
|
|
2975
|
+
annotations: import_v419.z.array(
|
|
2976
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2977
|
+
import_v419.z.object({
|
|
2978
|
+
type: import_v419.z.literal("url_citation"),
|
|
2979
|
+
start_index: import_v419.z.number(),
|
|
2980
|
+
end_index: import_v419.z.number(),
|
|
2981
|
+
url: import_v419.z.string(),
|
|
2982
|
+
title: import_v419.z.string()
|
|
2881
2983
|
}),
|
|
2882
|
-
|
|
2883
|
-
type:
|
|
2884
|
-
file_id:
|
|
2885
|
-
filename:
|
|
2886
|
-
index:
|
|
2887
|
-
start_index:
|
|
2888
|
-
end_index:
|
|
2889
|
-
quote:
|
|
2984
|
+
import_v419.z.object({
|
|
2985
|
+
type: import_v419.z.literal("file_citation"),
|
|
2986
|
+
file_id: import_v419.z.string(),
|
|
2987
|
+
filename: import_v419.z.string().nullish(),
|
|
2988
|
+
index: import_v419.z.number().nullish(),
|
|
2989
|
+
start_index: import_v419.z.number().nullish(),
|
|
2990
|
+
end_index: import_v419.z.number().nullish(),
|
|
2991
|
+
quote: import_v419.z.string().nullish()
|
|
2890
2992
|
}),
|
|
2891
|
-
|
|
2892
|
-
type:
|
|
2993
|
+
import_v419.z.object({
|
|
2994
|
+
type: import_v419.z.literal("container_file_citation")
|
|
2893
2995
|
})
|
|
2894
2996
|
])
|
|
2895
2997
|
)
|
|
@@ -2900,33 +3002,34 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2900
3002
|
fileSearchCallItem,
|
|
2901
3003
|
codeInterpreterCallItem,
|
|
2902
3004
|
imageGenerationCallItem,
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
3005
|
+
localShellCallItem,
|
|
3006
|
+
import_v419.z.object({
|
|
3007
|
+
type: import_v419.z.literal("function_call"),
|
|
3008
|
+
call_id: import_v419.z.string(),
|
|
3009
|
+
name: import_v419.z.string(),
|
|
3010
|
+
arguments: import_v419.z.string(),
|
|
3011
|
+
id: import_v419.z.string()
|
|
2909
3012
|
}),
|
|
2910
|
-
|
|
2911
|
-
type:
|
|
2912
|
-
id:
|
|
2913
|
-
status:
|
|
3013
|
+
import_v419.z.object({
|
|
3014
|
+
type: import_v419.z.literal("computer_call"),
|
|
3015
|
+
id: import_v419.z.string(),
|
|
3016
|
+
status: import_v419.z.string().optional()
|
|
2914
3017
|
}),
|
|
2915
|
-
|
|
2916
|
-
type:
|
|
2917
|
-
id:
|
|
2918
|
-
encrypted_content:
|
|
2919
|
-
summary:
|
|
2920
|
-
|
|
2921
|
-
type:
|
|
2922
|
-
text:
|
|
3018
|
+
import_v419.z.object({
|
|
3019
|
+
type: import_v419.z.literal("reasoning"),
|
|
3020
|
+
id: import_v419.z.string(),
|
|
3021
|
+
encrypted_content: import_v419.z.string().nullish(),
|
|
3022
|
+
summary: import_v419.z.array(
|
|
3023
|
+
import_v419.z.object({
|
|
3024
|
+
type: import_v419.z.literal("summary_text"),
|
|
3025
|
+
text: import_v419.z.string()
|
|
2923
3026
|
})
|
|
2924
3027
|
)
|
|
2925
3028
|
})
|
|
2926
3029
|
])
|
|
2927
3030
|
),
|
|
2928
|
-
service_tier:
|
|
2929
|
-
incomplete_details:
|
|
3031
|
+
service_tier: import_v419.z.string().nullish(),
|
|
3032
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
2930
3033
|
usage: usageSchema2
|
|
2931
3034
|
})
|
|
2932
3035
|
),
|
|
@@ -2986,6 +3089,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2986
3089
|
});
|
|
2987
3090
|
break;
|
|
2988
3091
|
}
|
|
3092
|
+
case "local_shell_call": {
|
|
3093
|
+
content.push({
|
|
3094
|
+
type: "tool-call",
|
|
3095
|
+
toolCallId: part.call_id,
|
|
3096
|
+
toolName: "local_shell",
|
|
3097
|
+
input: JSON.stringify({ action: part.action }),
|
|
3098
|
+
providerMetadata: {
|
|
3099
|
+
openai: {
|
|
3100
|
+
itemId: part.id
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
});
|
|
3104
|
+
break;
|
|
3105
|
+
}
|
|
2989
3106
|
case "message": {
|
|
2990
3107
|
for (const contentPart of part.content) {
|
|
2991
3108
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -3005,7 +3122,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3005
3122
|
content.push({
|
|
3006
3123
|
type: "source",
|
|
3007
3124
|
sourceType: "url",
|
|
3008
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
3125
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils16.generateId)(),
|
|
3009
3126
|
url: annotation.url,
|
|
3010
3127
|
title: annotation.title
|
|
3011
3128
|
});
|
|
@@ -3013,7 +3130,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3013
3130
|
content.push({
|
|
3014
3131
|
type: "source",
|
|
3015
3132
|
sourceType: "document",
|
|
3016
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
3133
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils16.generateId)(),
|
|
3017
3134
|
mediaType: "text/plain",
|
|
3018
3135
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3019
3136
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id
|
|
@@ -3165,18 +3282,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3165
3282
|
warnings,
|
|
3166
3283
|
webSearchToolName
|
|
3167
3284
|
} = await this.getArgs(options);
|
|
3168
|
-
const { responseHeaders, value: response } = await (0,
|
|
3285
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
|
|
3169
3286
|
url: this.config.url({
|
|
3170
3287
|
path: "/responses",
|
|
3171
3288
|
modelId: this.modelId
|
|
3172
3289
|
}),
|
|
3173
|
-
headers: (0,
|
|
3290
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
3174
3291
|
body: {
|
|
3175
3292
|
...body,
|
|
3176
3293
|
stream: true
|
|
3177
3294
|
},
|
|
3178
3295
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3179
|
-
successfulResponseHandler: (0,
|
|
3296
|
+
successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
|
|
3180
3297
|
openaiResponsesChunkSchema
|
|
3181
3298
|
),
|
|
3182
3299
|
abortSignal: options.abortSignal,
|
|
@@ -3243,6 +3360,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3243
3360
|
id: value.item.id,
|
|
3244
3361
|
toolName: "computer_use"
|
|
3245
3362
|
});
|
|
3363
|
+
} else if (value.item.type === "code_interpreter_call") {
|
|
3364
|
+
ongoingToolCalls[value.output_index] = {
|
|
3365
|
+
toolName: "code_interpreter",
|
|
3366
|
+
toolCallId: value.item.id,
|
|
3367
|
+
codeInterpreter: {
|
|
3368
|
+
containerId: value.item.container_id
|
|
3369
|
+
}
|
|
3370
|
+
};
|
|
3371
|
+
controller.enqueue({
|
|
3372
|
+
type: "tool-input-start",
|
|
3373
|
+
id: value.item.id,
|
|
3374
|
+
toolName: "code_interpreter"
|
|
3375
|
+
});
|
|
3376
|
+
controller.enqueue({
|
|
3377
|
+
type: "tool-input-delta",
|
|
3378
|
+
id: value.item.id,
|
|
3379
|
+
delta: `{"containerId":"${value.item.container_id}","code":"`
|
|
3380
|
+
});
|
|
3246
3381
|
} else if (value.item.type === "file_search_call") {
|
|
3247
3382
|
controller.enqueue({
|
|
3248
3383
|
type: "tool-call",
|
|
@@ -3366,16 +3501,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3366
3501
|
providerExecuted: true
|
|
3367
3502
|
});
|
|
3368
3503
|
} 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
|
-
});
|
|
3504
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3379
3505
|
controller.enqueue({
|
|
3380
3506
|
type: "tool-result",
|
|
3381
3507
|
toolCallId: value.item.id,
|
|
@@ -3395,6 +3521,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3395
3521
|
},
|
|
3396
3522
|
providerExecuted: true
|
|
3397
3523
|
});
|
|
3524
|
+
} else if (value.item.type === "local_shell_call") {
|
|
3525
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3526
|
+
controller.enqueue({
|
|
3527
|
+
type: "tool-call",
|
|
3528
|
+
toolCallId: value.item.call_id,
|
|
3529
|
+
toolName: "local_shell",
|
|
3530
|
+
input: JSON.stringify({
|
|
3531
|
+
action: {
|
|
3532
|
+
type: "exec",
|
|
3533
|
+
command: value.item.action.command,
|
|
3534
|
+
timeoutMs: value.item.action.timeout_ms,
|
|
3535
|
+
user: value.item.action.user,
|
|
3536
|
+
workingDirectory: value.item.action.working_directory,
|
|
3537
|
+
env: value.item.action.env
|
|
3538
|
+
}
|
|
3539
|
+
}),
|
|
3540
|
+
providerMetadata: {
|
|
3541
|
+
openai: { itemId: value.item.id }
|
|
3542
|
+
}
|
|
3543
|
+
});
|
|
3398
3544
|
} else if (value.item.type === "message") {
|
|
3399
3545
|
controller.enqueue({
|
|
3400
3546
|
type: "text-end",
|
|
@@ -3425,6 +3571,40 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3425
3571
|
delta: value.delta
|
|
3426
3572
|
});
|
|
3427
3573
|
}
|
|
3574
|
+
} else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
|
|
3575
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3576
|
+
if (toolCall != null) {
|
|
3577
|
+
controller.enqueue({
|
|
3578
|
+
type: "tool-input-delta",
|
|
3579
|
+
id: toolCall.toolCallId,
|
|
3580
|
+
// The delta is code, which is embedding in a JSON string.
|
|
3581
|
+
// To escape it, we use JSON.stringify and slice to remove the outer quotes.
|
|
3582
|
+
delta: JSON.stringify(value.delta).slice(1, -1)
|
|
3583
|
+
});
|
|
3584
|
+
}
|
|
3585
|
+
} else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
|
|
3586
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3587
|
+
if (toolCall != null) {
|
|
3588
|
+
controller.enqueue({
|
|
3589
|
+
type: "tool-input-delta",
|
|
3590
|
+
id: toolCall.toolCallId,
|
|
3591
|
+
delta: '"}'
|
|
3592
|
+
});
|
|
3593
|
+
controller.enqueue({
|
|
3594
|
+
type: "tool-input-end",
|
|
3595
|
+
id: toolCall.toolCallId
|
|
3596
|
+
});
|
|
3597
|
+
controller.enqueue({
|
|
3598
|
+
type: "tool-call",
|
|
3599
|
+
toolCallId: toolCall.toolCallId,
|
|
3600
|
+
toolName: "code_interpreter",
|
|
3601
|
+
input: JSON.stringify({
|
|
3602
|
+
code: value.code,
|
|
3603
|
+
containerId: toolCall.codeInterpreter.containerId
|
|
3604
|
+
}),
|
|
3605
|
+
providerExecuted: true
|
|
3606
|
+
});
|
|
3607
|
+
}
|
|
3428
3608
|
} else if (isResponseCreatedChunk(value)) {
|
|
3429
3609
|
responseId = value.response.id;
|
|
3430
3610
|
controller.enqueue({
|
|
@@ -3487,7 +3667,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3487
3667
|
controller.enqueue({
|
|
3488
3668
|
type: "source",
|
|
3489
3669
|
sourceType: "url",
|
|
3490
|
-
id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0,
|
|
3670
|
+
id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils16.generateId)(),
|
|
3491
3671
|
url: value.annotation.url,
|
|
3492
3672
|
title: value.annotation.title
|
|
3493
3673
|
});
|
|
@@ -3495,7 +3675,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3495
3675
|
controller.enqueue({
|
|
3496
3676
|
type: "source",
|
|
3497
3677
|
sourceType: "document",
|
|
3498
|
-
id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0,
|
|
3678
|
+
id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils16.generateId)(),
|
|
3499
3679
|
mediaType: "text/plain",
|
|
3500
3680
|
title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
|
|
3501
3681
|
filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
|
|
@@ -3531,166 +3711,194 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3531
3711
|
};
|
|
3532
3712
|
}
|
|
3533
3713
|
};
|
|
3534
|
-
var usageSchema2 =
|
|
3535
|
-
input_tokens:
|
|
3536
|
-
input_tokens_details:
|
|
3537
|
-
output_tokens:
|
|
3538
|
-
output_tokens_details:
|
|
3714
|
+
var usageSchema2 = import_v419.z.object({
|
|
3715
|
+
input_tokens: import_v419.z.number(),
|
|
3716
|
+
input_tokens_details: import_v419.z.object({ cached_tokens: import_v419.z.number().nullish() }).nullish(),
|
|
3717
|
+
output_tokens: import_v419.z.number(),
|
|
3718
|
+
output_tokens_details: import_v419.z.object({ reasoning_tokens: import_v419.z.number().nullish() }).nullish()
|
|
3539
3719
|
});
|
|
3540
|
-
var textDeltaChunkSchema =
|
|
3541
|
-
type:
|
|
3542
|
-
item_id:
|
|
3543
|
-
delta:
|
|
3720
|
+
var textDeltaChunkSchema = import_v419.z.object({
|
|
3721
|
+
type: import_v419.z.literal("response.output_text.delta"),
|
|
3722
|
+
item_id: import_v419.z.string(),
|
|
3723
|
+
delta: import_v419.z.string(),
|
|
3544
3724
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3545
3725
|
});
|
|
3546
|
-
var errorChunkSchema =
|
|
3547
|
-
type:
|
|
3548
|
-
code:
|
|
3549
|
-
message:
|
|
3550
|
-
param:
|
|
3551
|
-
sequence_number:
|
|
3726
|
+
var errorChunkSchema = import_v419.z.object({
|
|
3727
|
+
type: import_v419.z.literal("error"),
|
|
3728
|
+
code: import_v419.z.string(),
|
|
3729
|
+
message: import_v419.z.string(),
|
|
3730
|
+
param: import_v419.z.string().nullish(),
|
|
3731
|
+
sequence_number: import_v419.z.number()
|
|
3552
3732
|
});
|
|
3553
|
-
var responseFinishedChunkSchema =
|
|
3554
|
-
type:
|
|
3555
|
-
response:
|
|
3556
|
-
incomplete_details:
|
|
3733
|
+
var responseFinishedChunkSchema = import_v419.z.object({
|
|
3734
|
+
type: import_v419.z.enum(["response.completed", "response.incomplete"]),
|
|
3735
|
+
response: import_v419.z.object({
|
|
3736
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
3557
3737
|
usage: usageSchema2,
|
|
3558
|
-
service_tier:
|
|
3738
|
+
service_tier: import_v419.z.string().nullish()
|
|
3559
3739
|
})
|
|
3560
3740
|
});
|
|
3561
|
-
var responseCreatedChunkSchema =
|
|
3562
|
-
type:
|
|
3563
|
-
response:
|
|
3564
|
-
id:
|
|
3565
|
-
created_at:
|
|
3566
|
-
model:
|
|
3567
|
-
service_tier:
|
|
3741
|
+
var responseCreatedChunkSchema = import_v419.z.object({
|
|
3742
|
+
type: import_v419.z.literal("response.created"),
|
|
3743
|
+
response: import_v419.z.object({
|
|
3744
|
+
id: import_v419.z.string(),
|
|
3745
|
+
created_at: import_v419.z.number(),
|
|
3746
|
+
model: import_v419.z.string(),
|
|
3747
|
+
service_tier: import_v419.z.string().nullish()
|
|
3568
3748
|
})
|
|
3569
3749
|
});
|
|
3570
|
-
var responseOutputItemAddedSchema =
|
|
3571
|
-
type:
|
|
3572
|
-
output_index:
|
|
3573
|
-
item:
|
|
3574
|
-
|
|
3575
|
-
type:
|
|
3576
|
-
id:
|
|
3750
|
+
var responseOutputItemAddedSchema = import_v419.z.object({
|
|
3751
|
+
type: import_v419.z.literal("response.output_item.added"),
|
|
3752
|
+
output_index: import_v419.z.number(),
|
|
3753
|
+
item: import_v419.z.discriminatedUnion("type", [
|
|
3754
|
+
import_v419.z.object({
|
|
3755
|
+
type: import_v419.z.literal("message"),
|
|
3756
|
+
id: import_v419.z.string()
|
|
3577
3757
|
}),
|
|
3578
|
-
|
|
3579
|
-
type:
|
|
3580
|
-
id:
|
|
3581
|
-
encrypted_content:
|
|
3758
|
+
import_v419.z.object({
|
|
3759
|
+
type: import_v419.z.literal("reasoning"),
|
|
3760
|
+
id: import_v419.z.string(),
|
|
3761
|
+
encrypted_content: import_v419.z.string().nullish()
|
|
3582
3762
|
}),
|
|
3583
|
-
|
|
3584
|
-
type:
|
|
3585
|
-
id:
|
|
3586
|
-
call_id:
|
|
3587
|
-
name:
|
|
3588
|
-
arguments:
|
|
3763
|
+
import_v419.z.object({
|
|
3764
|
+
type: import_v419.z.literal("function_call"),
|
|
3765
|
+
id: import_v419.z.string(),
|
|
3766
|
+
call_id: import_v419.z.string(),
|
|
3767
|
+
name: import_v419.z.string(),
|
|
3768
|
+
arguments: import_v419.z.string()
|
|
3589
3769
|
}),
|
|
3590
|
-
|
|
3591
|
-
type:
|
|
3592
|
-
id:
|
|
3593
|
-
status:
|
|
3594
|
-
action:
|
|
3595
|
-
type:
|
|
3596
|
-
query:
|
|
3770
|
+
import_v419.z.object({
|
|
3771
|
+
type: import_v419.z.literal("web_search_call"),
|
|
3772
|
+
id: import_v419.z.string(),
|
|
3773
|
+
status: import_v419.z.string(),
|
|
3774
|
+
action: import_v419.z.object({
|
|
3775
|
+
type: import_v419.z.literal("search"),
|
|
3776
|
+
query: import_v419.z.string().optional()
|
|
3597
3777
|
}).nullish()
|
|
3598
3778
|
}),
|
|
3599
|
-
|
|
3600
|
-
type:
|
|
3601
|
-
id:
|
|
3602
|
-
status:
|
|
3779
|
+
import_v419.z.object({
|
|
3780
|
+
type: import_v419.z.literal("computer_call"),
|
|
3781
|
+
id: import_v419.z.string(),
|
|
3782
|
+
status: import_v419.z.string()
|
|
3603
3783
|
}),
|
|
3604
|
-
|
|
3605
|
-
type:
|
|
3606
|
-
id:
|
|
3784
|
+
import_v419.z.object({
|
|
3785
|
+
type: import_v419.z.literal("file_search_call"),
|
|
3786
|
+
id: import_v419.z.string()
|
|
3607
3787
|
}),
|
|
3608
|
-
|
|
3609
|
-
type:
|
|
3610
|
-
id:
|
|
3788
|
+
import_v419.z.object({
|
|
3789
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
3790
|
+
id: import_v419.z.string()
|
|
3791
|
+
}),
|
|
3792
|
+
import_v419.z.object({
|
|
3793
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
3794
|
+
id: import_v419.z.string(),
|
|
3795
|
+
container_id: import_v419.z.string(),
|
|
3796
|
+
code: import_v419.z.string().nullable(),
|
|
3797
|
+
outputs: import_v419.z.array(
|
|
3798
|
+
import_v419.z.discriminatedUnion("type", [
|
|
3799
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
3800
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
3801
|
+
])
|
|
3802
|
+
).nullable(),
|
|
3803
|
+
status: import_v419.z.string()
|
|
3611
3804
|
})
|
|
3612
3805
|
])
|
|
3613
3806
|
});
|
|
3614
|
-
var responseOutputItemDoneSchema =
|
|
3615
|
-
type:
|
|
3616
|
-
output_index:
|
|
3617
|
-
item:
|
|
3618
|
-
|
|
3619
|
-
type:
|
|
3620
|
-
id:
|
|
3807
|
+
var responseOutputItemDoneSchema = import_v419.z.object({
|
|
3808
|
+
type: import_v419.z.literal("response.output_item.done"),
|
|
3809
|
+
output_index: import_v419.z.number(),
|
|
3810
|
+
item: import_v419.z.discriminatedUnion("type", [
|
|
3811
|
+
import_v419.z.object({
|
|
3812
|
+
type: import_v419.z.literal("message"),
|
|
3813
|
+
id: import_v419.z.string()
|
|
3621
3814
|
}),
|
|
3622
|
-
|
|
3623
|
-
type:
|
|
3624
|
-
id:
|
|
3625
|
-
encrypted_content:
|
|
3815
|
+
import_v419.z.object({
|
|
3816
|
+
type: import_v419.z.literal("reasoning"),
|
|
3817
|
+
id: import_v419.z.string(),
|
|
3818
|
+
encrypted_content: import_v419.z.string().nullish()
|
|
3626
3819
|
}),
|
|
3627
|
-
|
|
3628
|
-
type:
|
|
3629
|
-
id:
|
|
3630
|
-
call_id:
|
|
3631
|
-
name:
|
|
3632
|
-
arguments:
|
|
3633
|
-
status:
|
|
3820
|
+
import_v419.z.object({
|
|
3821
|
+
type: import_v419.z.literal("function_call"),
|
|
3822
|
+
id: import_v419.z.string(),
|
|
3823
|
+
call_id: import_v419.z.string(),
|
|
3824
|
+
name: import_v419.z.string(),
|
|
3825
|
+
arguments: import_v419.z.string(),
|
|
3826
|
+
status: import_v419.z.literal("completed")
|
|
3634
3827
|
}),
|
|
3635
3828
|
codeInterpreterCallItem,
|
|
3636
3829
|
imageGenerationCallItem,
|
|
3637
3830
|
webSearchCallItem,
|
|
3638
3831
|
fileSearchCallItem,
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3832
|
+
localShellCallItem,
|
|
3833
|
+
import_v419.z.object({
|
|
3834
|
+
type: import_v419.z.literal("computer_call"),
|
|
3835
|
+
id: import_v419.z.string(),
|
|
3836
|
+
status: import_v419.z.literal("completed")
|
|
3643
3837
|
})
|
|
3644
3838
|
])
|
|
3645
3839
|
});
|
|
3646
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3647
|
-
type:
|
|
3648
|
-
item_id:
|
|
3649
|
-
output_index:
|
|
3650
|
-
delta:
|
|
3840
|
+
var responseFunctionCallArgumentsDeltaSchema = import_v419.z.object({
|
|
3841
|
+
type: import_v419.z.literal("response.function_call_arguments.delta"),
|
|
3842
|
+
item_id: import_v419.z.string(),
|
|
3843
|
+
output_index: import_v419.z.number(),
|
|
3844
|
+
delta: import_v419.z.string()
|
|
3845
|
+
});
|
|
3846
|
+
var responseCodeInterpreterCallCodeDeltaSchema = import_v419.z.object({
|
|
3847
|
+
type: import_v419.z.literal("response.code_interpreter_call_code.delta"),
|
|
3848
|
+
item_id: import_v419.z.string(),
|
|
3849
|
+
output_index: import_v419.z.number(),
|
|
3850
|
+
delta: import_v419.z.string()
|
|
3851
|
+
});
|
|
3852
|
+
var responseCodeInterpreterCallCodeDoneSchema = import_v419.z.object({
|
|
3853
|
+
type: import_v419.z.literal("response.code_interpreter_call_code.done"),
|
|
3854
|
+
item_id: import_v419.z.string(),
|
|
3855
|
+
output_index: import_v419.z.number(),
|
|
3856
|
+
code: import_v419.z.string()
|
|
3651
3857
|
});
|
|
3652
|
-
var responseAnnotationAddedSchema =
|
|
3653
|
-
type:
|
|
3654
|
-
annotation:
|
|
3655
|
-
|
|
3656
|
-
type:
|
|
3657
|
-
url:
|
|
3658
|
-
title:
|
|
3858
|
+
var responseAnnotationAddedSchema = import_v419.z.object({
|
|
3859
|
+
type: import_v419.z.literal("response.output_text.annotation.added"),
|
|
3860
|
+
annotation: import_v419.z.discriminatedUnion("type", [
|
|
3861
|
+
import_v419.z.object({
|
|
3862
|
+
type: import_v419.z.literal("url_citation"),
|
|
3863
|
+
url: import_v419.z.string(),
|
|
3864
|
+
title: import_v419.z.string()
|
|
3659
3865
|
}),
|
|
3660
|
-
|
|
3661
|
-
type:
|
|
3662
|
-
file_id:
|
|
3663
|
-
filename:
|
|
3664
|
-
index:
|
|
3665
|
-
start_index:
|
|
3666
|
-
end_index:
|
|
3667
|
-
quote:
|
|
3866
|
+
import_v419.z.object({
|
|
3867
|
+
type: import_v419.z.literal("file_citation"),
|
|
3868
|
+
file_id: import_v419.z.string(),
|
|
3869
|
+
filename: import_v419.z.string().nullish(),
|
|
3870
|
+
index: import_v419.z.number().nullish(),
|
|
3871
|
+
start_index: import_v419.z.number().nullish(),
|
|
3872
|
+
end_index: import_v419.z.number().nullish(),
|
|
3873
|
+
quote: import_v419.z.string().nullish()
|
|
3668
3874
|
})
|
|
3669
3875
|
])
|
|
3670
3876
|
});
|
|
3671
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3672
|
-
type:
|
|
3673
|
-
item_id:
|
|
3674
|
-
summary_index:
|
|
3877
|
+
var responseReasoningSummaryPartAddedSchema = import_v419.z.object({
|
|
3878
|
+
type: import_v419.z.literal("response.reasoning_summary_part.added"),
|
|
3879
|
+
item_id: import_v419.z.string(),
|
|
3880
|
+
summary_index: import_v419.z.number()
|
|
3675
3881
|
});
|
|
3676
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3677
|
-
type:
|
|
3678
|
-
item_id:
|
|
3679
|
-
summary_index:
|
|
3680
|
-
delta:
|
|
3882
|
+
var responseReasoningSummaryTextDeltaSchema = import_v419.z.object({
|
|
3883
|
+
type: import_v419.z.literal("response.reasoning_summary_text.delta"),
|
|
3884
|
+
item_id: import_v419.z.string(),
|
|
3885
|
+
summary_index: import_v419.z.number(),
|
|
3886
|
+
delta: import_v419.z.string()
|
|
3681
3887
|
});
|
|
3682
|
-
var openaiResponsesChunkSchema =
|
|
3888
|
+
var openaiResponsesChunkSchema = import_v419.z.union([
|
|
3683
3889
|
textDeltaChunkSchema,
|
|
3684
3890
|
responseFinishedChunkSchema,
|
|
3685
3891
|
responseCreatedChunkSchema,
|
|
3686
3892
|
responseOutputItemAddedSchema,
|
|
3687
3893
|
responseOutputItemDoneSchema,
|
|
3688
3894
|
responseFunctionCallArgumentsDeltaSchema,
|
|
3895
|
+
responseCodeInterpreterCallCodeDeltaSchema,
|
|
3896
|
+
responseCodeInterpreterCallCodeDoneSchema,
|
|
3689
3897
|
responseAnnotationAddedSchema,
|
|
3690
3898
|
responseReasoningSummaryPartAddedSchema,
|
|
3691
3899
|
responseReasoningSummaryTextDeltaSchema,
|
|
3692
3900
|
errorChunkSchema,
|
|
3693
|
-
|
|
3901
|
+
import_v419.z.object({ type: import_v419.z.string() }).loose()
|
|
3694
3902
|
// fallback for unknown chunks
|
|
3695
3903
|
]);
|
|
3696
3904
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3711,6 +3919,12 @@ function isResponseCreatedChunk(chunk) {
|
|
|
3711
3919
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
3712
3920
|
return chunk.type === "response.function_call_arguments.delta";
|
|
3713
3921
|
}
|
|
3922
|
+
function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
|
|
3923
|
+
return chunk.type === "response.code_interpreter_call_code.delta";
|
|
3924
|
+
}
|
|
3925
|
+
function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
|
|
3926
|
+
return chunk.type === "response.code_interpreter_call_code.done";
|
|
3927
|
+
}
|
|
3714
3928
|
function isResponseOutputItemAddedChunk(chunk) {
|
|
3715
3929
|
return chunk.type === "response.output_item.added";
|
|
3716
3930
|
}
|
|
@@ -3763,15 +3977,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3763
3977
|
isReasoningModel: false
|
|
3764
3978
|
};
|
|
3765
3979
|
}
|
|
3766
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3767
|
-
include:
|
|
3768
|
-
|
|
3980
|
+
var openaiResponsesProviderOptionsSchema = import_v419.z.object({
|
|
3981
|
+
include: import_v419.z.array(
|
|
3982
|
+
import_v419.z.enum([
|
|
3769
3983
|
"reasoning.encrypted_content",
|
|
3770
3984
|
"file_search_call.results",
|
|
3771
3985
|
"message.output_text.logprobs"
|
|
3772
3986
|
])
|
|
3773
3987
|
).nullish(),
|
|
3774
|
-
instructions:
|
|
3988
|
+
instructions: import_v419.z.string().nullish(),
|
|
3775
3989
|
/**
|
|
3776
3990
|
* Return the log probabilities of the tokens.
|
|
3777
3991
|
*
|
|
@@ -3784,25 +3998,25 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3784
3998
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3785
3999
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3786
4000
|
*/
|
|
3787
|
-
logprobs:
|
|
4001
|
+
logprobs: import_v419.z.union([import_v419.z.boolean(), import_v419.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3788
4002
|
/**
|
|
3789
4003
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3790
4004
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3791
4005
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3792
4006
|
*/
|
|
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:
|
|
4007
|
+
maxToolCalls: import_v419.z.number().nullish(),
|
|
4008
|
+
metadata: import_v419.z.any().nullish(),
|
|
4009
|
+
parallelToolCalls: import_v419.z.boolean().nullish(),
|
|
4010
|
+
previousResponseId: import_v419.z.string().nullish(),
|
|
4011
|
+
promptCacheKey: import_v419.z.string().nullish(),
|
|
4012
|
+
reasoningEffort: import_v419.z.string().nullish(),
|
|
4013
|
+
reasoningSummary: import_v419.z.string().nullish(),
|
|
4014
|
+
safetyIdentifier: import_v419.z.string().nullish(),
|
|
4015
|
+
serviceTier: import_v419.z.enum(["auto", "flex", "priority"]).nullish(),
|
|
4016
|
+
store: import_v419.z.boolean().nullish(),
|
|
4017
|
+
strictJsonSchema: import_v419.z.boolean().nullish(),
|
|
4018
|
+
textVerbosity: import_v419.z.enum(["low", "medium", "high"]).nullish(),
|
|
4019
|
+
user: import_v419.z.string().nullish()
|
|
3806
4020
|
});
|
|
3807
4021
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3808
4022
|
0 && (module.exports = {
|
|
@@ -3813,11 +4027,22 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3813
4027
|
OpenAIResponsesLanguageModel,
|
|
3814
4028
|
OpenAISpeechModel,
|
|
3815
4029
|
OpenAITranscriptionModel,
|
|
4030
|
+
codeInterpreter,
|
|
4031
|
+
codeInterpreterArgsSchema,
|
|
4032
|
+
codeInterpreterInputSchema,
|
|
4033
|
+
codeInterpreterOutputSchema,
|
|
4034
|
+
codeInterpreterToolFactory,
|
|
4035
|
+
fileSearch,
|
|
4036
|
+
fileSearchArgsSchema,
|
|
4037
|
+
fileSearchOutputSchema,
|
|
3816
4038
|
hasDefaultResponseFormat,
|
|
4039
|
+
imageGeneration,
|
|
4040
|
+
imageGenerationArgsSchema,
|
|
4041
|
+
imageGenerationOutputSchema,
|
|
3817
4042
|
modelMaxImagesPerCall,
|
|
3818
4043
|
openAITranscriptionProviderOptions,
|
|
4044
|
+
openaiChatLanguageModelOptions,
|
|
3819
4045
|
openaiCompletionProviderOptions,
|
|
3820
|
-
openaiEmbeddingProviderOptions
|
|
3821
|
-
openaiProviderOptions
|
|
4046
|
+
openaiEmbeddingProviderOptions
|
|
3822
4047
|
});
|
|
3823
4048
|
//# sourceMappingURL=index.js.map
|