@ai-sdk/openai 2.1.0-beta.0 → 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 +97 -0
- package/dist/index.d.mts +67 -14
- package/dist/index.d.ts +67 -14
- package/dist/index.js +617 -399
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +587 -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 +633 -407
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +601 -386
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -4
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,15 +2165,33 @@ 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
|
}
|
|
2194
|
+
// assistant tool result parts are from provider-executed tools:
|
|
2140
2195
|
case "tool-result": {
|
|
2141
2196
|
if (store) {
|
|
2142
2197
|
input.push({ type: "item_reference", id: part.toolCallId });
|
|
@@ -2149,33 +2204,47 @@ async function convertToOpenAIResponsesInput({
|
|
|
2149
2204
|
break;
|
|
2150
2205
|
}
|
|
2151
2206
|
case "reasoning": {
|
|
2152
|
-
const providerOptions = await (0,
|
|
2207
|
+
const providerOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
2153
2208
|
provider: "openai",
|
|
2154
2209
|
providerOptions: part.providerOptions,
|
|
2155
2210
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
2156
2211
|
});
|
|
2157
2212
|
const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
2158
2213
|
if (reasoningId != null) {
|
|
2159
|
-
const
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
if (existingReasoningMessage === void 0) {
|
|
2170
|
-
reasoningMessages[reasoningId] = {
|
|
2171
|
-
type: "reasoning",
|
|
2172
|
-
id: reasoningId,
|
|
2173
|
-
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2174
|
-
summary: summaryParts
|
|
2175
|
-
};
|
|
2176
|
-
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
|
+
}
|
|
2177
2224
|
} else {
|
|
2178
|
-
|
|
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
|
+
}
|
|
2179
2248
|
}
|
|
2180
2249
|
} else {
|
|
2181
2250
|
warnings.push({
|
|
@@ -2192,6 +2261,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2192
2261
|
case "tool": {
|
|
2193
2262
|
for (const part of content) {
|
|
2194
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
|
+
}
|
|
2195
2272
|
let contentValue;
|
|
2196
2273
|
switch (output.type) {
|
|
2197
2274
|
case "text":
|
|
@@ -2220,9 +2297,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2220
2297
|
}
|
|
2221
2298
|
return { input, warnings };
|
|
2222
2299
|
}
|
|
2223
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2224
|
-
itemId:
|
|
2225
|
-
reasoningEncryptedContent:
|
|
2300
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v413.z.object({
|
|
2301
|
+
itemId: import_v413.z.string().nullish(),
|
|
2302
|
+
reasoningEncryptedContent: import_v413.z.string().nullish()
|
|
2226
2303
|
});
|
|
2227
2304
|
|
|
2228
2305
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2247,200 +2324,206 @@ function mapOpenAIResponseFinishReason({
|
|
|
2247
2324
|
var import_provider7 = require("@ai-sdk/provider");
|
|
2248
2325
|
|
|
2249
2326
|
// src/tool/code-interpreter.ts
|
|
2250
|
-
var
|
|
2251
|
-
var
|
|
2252
|
-
var codeInterpreterInputSchema =
|
|
2253
|
-
code:
|
|
2254
|
-
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()
|
|
2255
2332
|
});
|
|
2256
|
-
var codeInterpreterOutputSchema =
|
|
2257
|
-
outputs:
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
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() })
|
|
2261
2338
|
])
|
|
2262
2339
|
).nullish()
|
|
2263
2340
|
});
|
|
2264
|
-
var codeInterpreterArgsSchema =
|
|
2265
|
-
container:
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
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()
|
|
2269
2346
|
})
|
|
2270
2347
|
]).optional()
|
|
2271
2348
|
});
|
|
2272
|
-
var codeInterpreterToolFactory = (0,
|
|
2349
|
+
var codeInterpreterToolFactory = (0, import_provider_utils11.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2273
2350
|
id: "openai.code_interpreter",
|
|
2274
2351
|
name: "code_interpreter",
|
|
2275
2352
|
inputSchema: codeInterpreterInputSchema,
|
|
2276
2353
|
outputSchema: codeInterpreterOutputSchema
|
|
2277
2354
|
});
|
|
2355
|
+
var codeInterpreter = (args = {}) => {
|
|
2356
|
+
return codeInterpreterToolFactory(args);
|
|
2357
|
+
};
|
|
2278
2358
|
|
|
2279
2359
|
// src/tool/file-search.ts
|
|
2280
|
-
var
|
|
2281
|
-
var
|
|
2282
|
-
var comparisonFilterSchema =
|
|
2283
|
-
key:
|
|
2284
|
-
type:
|
|
2285
|
-
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()])
|
|
2286
2366
|
});
|
|
2287
|
-
var compoundFilterSchema =
|
|
2288
|
-
type:
|
|
2289
|
-
filters:
|
|
2290
|
-
|
|
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)])
|
|
2291
2371
|
)
|
|
2292
2372
|
});
|
|
2293
|
-
var fileSearchArgsSchema =
|
|
2294
|
-
vectorStoreIds:
|
|
2295
|
-
maxNumResults:
|
|
2296
|
-
ranking:
|
|
2297
|
-
ranker:
|
|
2298
|
-
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()
|
|
2299
2379
|
}).optional(),
|
|
2300
|
-
filters:
|
|
2380
|
+
filters: import_v415.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2301
2381
|
});
|
|
2302
|
-
var fileSearchOutputSchema =
|
|
2303
|
-
queries:
|
|
2304
|
-
results:
|
|
2305
|
-
|
|
2306
|
-
attributes:
|
|
2307
|
-
fileId:
|
|
2308
|
-
filename:
|
|
2309
|
-
score:
|
|
2310
|
-
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()
|
|
2311
2391
|
})
|
|
2312
2392
|
).nullable()
|
|
2313
2393
|
});
|
|
2314
|
-
var fileSearch = (0,
|
|
2394
|
+
var fileSearch = (0, import_provider_utils12.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2315
2395
|
id: "openai.file_search",
|
|
2316
2396
|
name: "file_search",
|
|
2317
|
-
inputSchema:
|
|
2397
|
+
inputSchema: import_v415.z.object({}),
|
|
2318
2398
|
outputSchema: fileSearchOutputSchema
|
|
2319
2399
|
});
|
|
2320
2400
|
|
|
2321
2401
|
// src/tool/web-search.ts
|
|
2322
|
-
var
|
|
2323
|
-
var
|
|
2324
|
-
var webSearchArgsSchema =
|
|
2325
|
-
filters:
|
|
2326
|
-
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()
|
|
2327
2407
|
}).optional(),
|
|
2328
|
-
searchContextSize:
|
|
2329
|
-
userLocation:
|
|
2330
|
-
type:
|
|
2331
|
-
country:
|
|
2332
|
-
city:
|
|
2333
|
-
region:
|
|
2334
|
-
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()
|
|
2335
2415
|
}).optional()
|
|
2336
2416
|
});
|
|
2337
|
-
var webSearchToolFactory = (0,
|
|
2417
|
+
var webSearchToolFactory = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2338
2418
|
id: "openai.web_search",
|
|
2339
2419
|
name: "web_search",
|
|
2340
|
-
inputSchema:
|
|
2341
|
-
action:
|
|
2342
|
-
|
|
2343
|
-
type:
|
|
2344
|
-
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()
|
|
2345
2425
|
}),
|
|
2346
|
-
|
|
2347
|
-
type:
|
|
2348
|
-
url:
|
|
2426
|
+
import_v416.z.object({
|
|
2427
|
+
type: import_v416.z.literal("open_page"),
|
|
2428
|
+
url: import_v416.z.string()
|
|
2349
2429
|
}),
|
|
2350
|
-
|
|
2351
|
-
type:
|
|
2352
|
-
url:
|
|
2353
|
-
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()
|
|
2354
2434
|
})
|
|
2355
2435
|
]).nullish()
|
|
2356
2436
|
})
|
|
2357
2437
|
});
|
|
2358
2438
|
|
|
2359
2439
|
// src/tool/web-search-preview.ts
|
|
2360
|
-
var
|
|
2361
|
-
var
|
|
2362
|
-
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({
|
|
2363
2443
|
/**
|
|
2364
2444
|
* Search context size to use for the web search.
|
|
2365
2445
|
* - high: Most comprehensive context, highest cost, slower response
|
|
2366
2446
|
* - medium: Balanced context, cost, and latency (default)
|
|
2367
2447
|
* - low: Least context, lowest cost, fastest response
|
|
2368
2448
|
*/
|
|
2369
|
-
searchContextSize:
|
|
2449
|
+
searchContextSize: import_v417.z.enum(["low", "medium", "high"]).optional(),
|
|
2370
2450
|
/**
|
|
2371
2451
|
* User location information to provide geographically relevant search results.
|
|
2372
2452
|
*/
|
|
2373
|
-
userLocation:
|
|
2453
|
+
userLocation: import_v417.z.object({
|
|
2374
2454
|
/**
|
|
2375
2455
|
* Type of location (always 'approximate')
|
|
2376
2456
|
*/
|
|
2377
|
-
type:
|
|
2457
|
+
type: import_v417.z.literal("approximate"),
|
|
2378
2458
|
/**
|
|
2379
2459
|
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
2380
2460
|
*/
|
|
2381
|
-
country:
|
|
2461
|
+
country: import_v417.z.string().optional(),
|
|
2382
2462
|
/**
|
|
2383
2463
|
* City name (free text, e.g., 'Minneapolis')
|
|
2384
2464
|
*/
|
|
2385
|
-
city:
|
|
2465
|
+
city: import_v417.z.string().optional(),
|
|
2386
2466
|
/**
|
|
2387
2467
|
* Region name (free text, e.g., 'Minnesota')
|
|
2388
2468
|
*/
|
|
2389
|
-
region:
|
|
2469
|
+
region: import_v417.z.string().optional(),
|
|
2390
2470
|
/**
|
|
2391
2471
|
* IANA timezone (e.g., 'America/Chicago')
|
|
2392
2472
|
*/
|
|
2393
|
-
timezone:
|
|
2473
|
+
timezone: import_v417.z.string().optional()
|
|
2394
2474
|
}).optional()
|
|
2395
2475
|
});
|
|
2396
|
-
var webSearchPreview = (0,
|
|
2476
|
+
var webSearchPreview = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2397
2477
|
id: "openai.web_search_preview",
|
|
2398
2478
|
name: "web_search_preview",
|
|
2399
|
-
inputSchema:
|
|
2400
|
-
action:
|
|
2401
|
-
|
|
2402
|
-
type:
|
|
2403
|
-
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()
|
|
2404
2484
|
}),
|
|
2405
|
-
|
|
2406
|
-
type:
|
|
2407
|
-
url:
|
|
2485
|
+
import_v417.z.object({
|
|
2486
|
+
type: import_v417.z.literal("open_page"),
|
|
2487
|
+
url: import_v417.z.string()
|
|
2408
2488
|
}),
|
|
2409
|
-
|
|
2410
|
-
type:
|
|
2411
|
-
url:
|
|
2412
|
-
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()
|
|
2413
2493
|
})
|
|
2414
2494
|
]).nullish()
|
|
2415
2495
|
})
|
|
2416
2496
|
});
|
|
2417
2497
|
|
|
2418
2498
|
// src/tool/image-generation.ts
|
|
2419
|
-
var
|
|
2420
|
-
var
|
|
2421
|
-
var imageGenerationArgsSchema =
|
|
2422
|
-
background:
|
|
2423
|
-
inputFidelity:
|
|
2424
|
-
inputImageMask:
|
|
2425
|
-
fileId:
|
|
2426
|
-
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()
|
|
2427
2507
|
}).optional(),
|
|
2428
|
-
model:
|
|
2429
|
-
moderation:
|
|
2430
|
-
outputCompression:
|
|
2431
|
-
outputFormat:
|
|
2432
|
-
quality:
|
|
2433
|
-
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()
|
|
2434
2514
|
}).strict();
|
|
2435
|
-
var imageGenerationOutputSchema =
|
|
2436
|
-
result:
|
|
2515
|
+
var imageGenerationOutputSchema = import_v418.z.object({
|
|
2516
|
+
result: import_v418.z.string()
|
|
2437
2517
|
});
|
|
2438
|
-
var imageGenerationToolFactory = (0,
|
|
2518
|
+
var imageGenerationToolFactory = (0, import_provider_utils15.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2439
2519
|
id: "openai.image_generation",
|
|
2440
2520
|
name: "image_generation",
|
|
2441
|
-
inputSchema:
|
|
2521
|
+
inputSchema: import_v418.z.object({}),
|
|
2442
2522
|
outputSchema: imageGenerationOutputSchema
|
|
2443
2523
|
});
|
|
2524
|
+
var imageGeneration = (args = {}) => {
|
|
2525
|
+
return imageGenerationToolFactory(args);
|
|
2526
|
+
};
|
|
2444
2527
|
|
|
2445
2528
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2446
2529
|
function prepareResponsesTools({
|
|
@@ -2481,6 +2564,12 @@ function prepareResponsesTools({
|
|
|
2481
2564
|
});
|
|
2482
2565
|
break;
|
|
2483
2566
|
}
|
|
2567
|
+
case "openai.local_shell": {
|
|
2568
|
+
openaiTools.push({
|
|
2569
|
+
type: "local_shell"
|
|
2570
|
+
});
|
|
2571
|
+
break;
|
|
2572
|
+
}
|
|
2484
2573
|
case "openai.web_search_preview": {
|
|
2485
2574
|
const args = webSearchPreviewArgsSchema.parse(tool.args);
|
|
2486
2575
|
openaiTools.push({
|
|
@@ -2560,73 +2649,86 @@ function prepareResponsesTools({
|
|
|
2560
2649
|
}
|
|
2561
2650
|
|
|
2562
2651
|
// src/responses/openai-responses-language-model.ts
|
|
2563
|
-
var webSearchCallItem =
|
|
2564
|
-
type:
|
|
2565
|
-
id:
|
|
2566
|
-
status:
|
|
2567
|
-
action:
|
|
2568
|
-
|
|
2569
|
-
type:
|
|
2570
|
-
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()
|
|
2571
2660
|
}),
|
|
2572
|
-
|
|
2573
|
-
type:
|
|
2574
|
-
url:
|
|
2661
|
+
import_v419.z.object({
|
|
2662
|
+
type: import_v419.z.literal("open_page"),
|
|
2663
|
+
url: import_v419.z.string()
|
|
2575
2664
|
}),
|
|
2576
|
-
|
|
2577
|
-
type:
|
|
2578
|
-
url:
|
|
2579
|
-
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()
|
|
2580
2669
|
})
|
|
2581
2670
|
]).nullish()
|
|
2582
2671
|
});
|
|
2583
|
-
var fileSearchCallItem =
|
|
2584
|
-
type:
|
|
2585
|
-
id:
|
|
2586
|
-
queries:
|
|
2587
|
-
results:
|
|
2588
|
-
|
|
2589
|
-
attributes:
|
|
2590
|
-
file_id:
|
|
2591
|
-
filename:
|
|
2592
|
-
score:
|
|
2593
|
-
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()
|
|
2594
2683
|
})
|
|
2595
2684
|
).nullish()
|
|
2596
2685
|
});
|
|
2597
|
-
var codeInterpreterCallItem =
|
|
2598
|
-
type:
|
|
2599
|
-
id:
|
|
2600
|
-
code:
|
|
2601
|
-
container_id:
|
|
2602
|
-
outputs:
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
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() })
|
|
2606
2695
|
])
|
|
2607
2696
|
).nullable()
|
|
2608
2697
|
});
|
|
2609
|
-
var
|
|
2610
|
-
type:
|
|
2611
|
-
id:
|
|
2612
|
-
|
|
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()
|
|
2613
2715
|
});
|
|
2614
2716
|
var TOP_LOGPROBS_MAX = 20;
|
|
2615
|
-
var LOGPROBS_SCHEMA =
|
|
2616
|
-
|
|
2617
|
-
token:
|
|
2618
|
-
logprob:
|
|
2619
|
-
top_logprobs:
|
|
2620
|
-
|
|
2621
|
-
token:
|
|
2622
|
-
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()
|
|
2623
2725
|
})
|
|
2624
2726
|
)
|
|
2625
2727
|
})
|
|
2626
2728
|
);
|
|
2627
2729
|
var OpenAIResponsesLanguageModel = class {
|
|
2628
2730
|
constructor(modelId, config) {
|
|
2629
|
-
this.specificationVersion = "
|
|
2731
|
+
this.specificationVersion = "v3";
|
|
2630
2732
|
this.supportedUrls = {
|
|
2631
2733
|
"image/*": [/^https?:\/\/.*$/],
|
|
2632
2734
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -2676,7 +2778,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2676
2778
|
if (stopSequences != null) {
|
|
2677
2779
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
2678
2780
|
}
|
|
2679
|
-
const openaiOptions = await (0,
|
|
2781
|
+
const openaiOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2680
2782
|
provider: "openai",
|
|
2681
2783
|
providerOptions,
|
|
2682
2784
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -2685,7 +2787,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2685
2787
|
prompt,
|
|
2686
2788
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
2687
2789
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
2688
|
-
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")
|
|
2689
2792
|
});
|
|
2690
2793
|
warnings.push(...inputWarnings);
|
|
2691
2794
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
@@ -2844,51 +2947,51 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2844
2947
|
responseHeaders,
|
|
2845
2948
|
value: response,
|
|
2846
2949
|
rawValue: rawResponse
|
|
2847
|
-
} = await (0,
|
|
2950
|
+
} = await (0, import_provider_utils16.postJsonToApi)({
|
|
2848
2951
|
url,
|
|
2849
|
-
headers: (0,
|
|
2952
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
2850
2953
|
body,
|
|
2851
2954
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2852
|
-
successfulResponseHandler: (0,
|
|
2853
|
-
|
|
2854
|
-
id:
|
|
2855
|
-
created_at:
|
|
2856
|
-
error:
|
|
2857
|
-
code:
|
|
2858
|
-
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()
|
|
2859
2962
|
}).nullish(),
|
|
2860
|
-
model:
|
|
2861
|
-
output:
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
type:
|
|
2865
|
-
role:
|
|
2866
|
-
id:
|
|
2867
|
-
content:
|
|
2868
|
-
|
|
2869
|
-
type:
|
|
2870
|
-
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(),
|
|
2871
2974
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2872
|
-
annotations:
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
type:
|
|
2876
|
-
start_index:
|
|
2877
|
-
end_index:
|
|
2878
|
-
url:
|
|
2879
|
-
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()
|
|
2880
2983
|
}),
|
|
2881
|
-
|
|
2882
|
-
type:
|
|
2883
|
-
file_id:
|
|
2884
|
-
filename:
|
|
2885
|
-
index:
|
|
2886
|
-
start_index:
|
|
2887
|
-
end_index:
|
|
2888
|
-
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()
|
|
2889
2992
|
}),
|
|
2890
|
-
|
|
2891
|
-
type:
|
|
2993
|
+
import_v419.z.object({
|
|
2994
|
+
type: import_v419.z.literal("container_file_citation")
|
|
2892
2995
|
})
|
|
2893
2996
|
])
|
|
2894
2997
|
)
|
|
@@ -2899,33 +3002,34 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2899
3002
|
fileSearchCallItem,
|
|
2900
3003
|
codeInterpreterCallItem,
|
|
2901
3004
|
imageGenerationCallItem,
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
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()
|
|
2908
3012
|
}),
|
|
2909
|
-
|
|
2910
|
-
type:
|
|
2911
|
-
id:
|
|
2912
|
-
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()
|
|
2913
3017
|
}),
|
|
2914
|
-
|
|
2915
|
-
type:
|
|
2916
|
-
id:
|
|
2917
|
-
encrypted_content:
|
|
2918
|
-
summary:
|
|
2919
|
-
|
|
2920
|
-
type:
|
|
2921
|
-
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()
|
|
2922
3026
|
})
|
|
2923
3027
|
)
|
|
2924
3028
|
})
|
|
2925
3029
|
])
|
|
2926
3030
|
),
|
|
2927
|
-
service_tier:
|
|
2928
|
-
incomplete_details:
|
|
3031
|
+
service_tier: import_v419.z.string().nullish(),
|
|
3032
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
2929
3033
|
usage: usageSchema2
|
|
2930
3034
|
})
|
|
2931
3035
|
),
|
|
@@ -2985,6 +3089,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2985
3089
|
});
|
|
2986
3090
|
break;
|
|
2987
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
|
+
}
|
|
2988
3106
|
case "message": {
|
|
2989
3107
|
for (const contentPart of part.content) {
|
|
2990
3108
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -3004,7 +3122,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3004
3122
|
content.push({
|
|
3005
3123
|
type: "source",
|
|
3006
3124
|
sourceType: "url",
|
|
3007
|
-
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)(),
|
|
3008
3126
|
url: annotation.url,
|
|
3009
3127
|
title: annotation.title
|
|
3010
3128
|
});
|
|
@@ -3012,7 +3130,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3012
3130
|
content.push({
|
|
3013
3131
|
type: "source",
|
|
3014
3132
|
sourceType: "document",
|
|
3015
|
-
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)(),
|
|
3016
3134
|
mediaType: "text/plain",
|
|
3017
3135
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3018
3136
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id
|
|
@@ -3164,18 +3282,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3164
3282
|
warnings,
|
|
3165
3283
|
webSearchToolName
|
|
3166
3284
|
} = await this.getArgs(options);
|
|
3167
|
-
const { responseHeaders, value: response } = await (0,
|
|
3285
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
|
|
3168
3286
|
url: this.config.url({
|
|
3169
3287
|
path: "/responses",
|
|
3170
3288
|
modelId: this.modelId
|
|
3171
3289
|
}),
|
|
3172
|
-
headers: (0,
|
|
3290
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
3173
3291
|
body: {
|
|
3174
3292
|
...body,
|
|
3175
3293
|
stream: true
|
|
3176
3294
|
},
|
|
3177
3295
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3178
|
-
successfulResponseHandler: (0,
|
|
3296
|
+
successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
|
|
3179
3297
|
openaiResponsesChunkSchema
|
|
3180
3298
|
),
|
|
3181
3299
|
abortSignal: options.abortSignal,
|
|
@@ -3242,6 +3360,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3242
3360
|
id: value.item.id,
|
|
3243
3361
|
toolName: "computer_use"
|
|
3244
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
|
+
});
|
|
3245
3381
|
} else if (value.item.type === "file_search_call") {
|
|
3246
3382
|
controller.enqueue({
|
|
3247
3383
|
type: "tool-call",
|
|
@@ -3365,16 +3501,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3365
3501
|
providerExecuted: true
|
|
3366
3502
|
});
|
|
3367
3503
|
} else if (value.item.type === "code_interpreter_call") {
|
|
3368
|
-
|
|
3369
|
-
type: "tool-call",
|
|
3370
|
-
toolCallId: value.item.id,
|
|
3371
|
-
toolName: "code_interpreter",
|
|
3372
|
-
input: JSON.stringify({
|
|
3373
|
-
code: value.item.code,
|
|
3374
|
-
containerId: value.item.container_id
|
|
3375
|
-
}),
|
|
3376
|
-
providerExecuted: true
|
|
3377
|
-
});
|
|
3504
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3378
3505
|
controller.enqueue({
|
|
3379
3506
|
type: "tool-result",
|
|
3380
3507
|
toolCallId: value.item.id,
|
|
@@ -3394,6 +3521,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3394
3521
|
},
|
|
3395
3522
|
providerExecuted: true
|
|
3396
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
|
+
});
|
|
3397
3544
|
} else if (value.item.type === "message") {
|
|
3398
3545
|
controller.enqueue({
|
|
3399
3546
|
type: "text-end",
|
|
@@ -3424,6 +3571,40 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3424
3571
|
delta: value.delta
|
|
3425
3572
|
});
|
|
3426
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
|
+
}
|
|
3427
3608
|
} else if (isResponseCreatedChunk(value)) {
|
|
3428
3609
|
responseId = value.response.id;
|
|
3429
3610
|
controller.enqueue({
|
|
@@ -3486,7 +3667,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3486
3667
|
controller.enqueue({
|
|
3487
3668
|
type: "source",
|
|
3488
3669
|
sourceType: "url",
|
|
3489
|
-
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)(),
|
|
3490
3671
|
url: value.annotation.url,
|
|
3491
3672
|
title: value.annotation.title
|
|
3492
3673
|
});
|
|
@@ -3494,7 +3675,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3494
3675
|
controller.enqueue({
|
|
3495
3676
|
type: "source",
|
|
3496
3677
|
sourceType: "document",
|
|
3497
|
-
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)(),
|
|
3498
3679
|
mediaType: "text/plain",
|
|
3499
3680
|
title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
|
|
3500
3681
|
filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
|
|
@@ -3530,166 +3711,194 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3530
3711
|
};
|
|
3531
3712
|
}
|
|
3532
3713
|
};
|
|
3533
|
-
var usageSchema2 =
|
|
3534
|
-
input_tokens:
|
|
3535
|
-
input_tokens_details:
|
|
3536
|
-
output_tokens:
|
|
3537
|
-
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()
|
|
3538
3719
|
});
|
|
3539
|
-
var textDeltaChunkSchema =
|
|
3540
|
-
type:
|
|
3541
|
-
item_id:
|
|
3542
|
-
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(),
|
|
3543
3724
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3544
3725
|
});
|
|
3545
|
-
var errorChunkSchema =
|
|
3546
|
-
type:
|
|
3547
|
-
code:
|
|
3548
|
-
message:
|
|
3549
|
-
param:
|
|
3550
|
-
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()
|
|
3551
3732
|
});
|
|
3552
|
-
var responseFinishedChunkSchema =
|
|
3553
|
-
type:
|
|
3554
|
-
response:
|
|
3555
|
-
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(),
|
|
3556
3737
|
usage: usageSchema2,
|
|
3557
|
-
service_tier:
|
|
3738
|
+
service_tier: import_v419.z.string().nullish()
|
|
3558
3739
|
})
|
|
3559
3740
|
});
|
|
3560
|
-
var responseCreatedChunkSchema =
|
|
3561
|
-
type:
|
|
3562
|
-
response:
|
|
3563
|
-
id:
|
|
3564
|
-
created_at:
|
|
3565
|
-
model:
|
|
3566
|
-
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()
|
|
3567
3748
|
})
|
|
3568
3749
|
});
|
|
3569
|
-
var responseOutputItemAddedSchema =
|
|
3570
|
-
type:
|
|
3571
|
-
output_index:
|
|
3572
|
-
item:
|
|
3573
|
-
|
|
3574
|
-
type:
|
|
3575
|
-
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()
|
|
3576
3757
|
}),
|
|
3577
|
-
|
|
3578
|
-
type:
|
|
3579
|
-
id:
|
|
3580
|
-
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()
|
|
3581
3762
|
}),
|
|
3582
|
-
|
|
3583
|
-
type:
|
|
3584
|
-
id:
|
|
3585
|
-
call_id:
|
|
3586
|
-
name:
|
|
3587
|
-
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()
|
|
3588
3769
|
}),
|
|
3589
|
-
|
|
3590
|
-
type:
|
|
3591
|
-
id:
|
|
3592
|
-
status:
|
|
3593
|
-
action:
|
|
3594
|
-
type:
|
|
3595
|
-
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()
|
|
3596
3777
|
}).nullish()
|
|
3597
3778
|
}),
|
|
3598
|
-
|
|
3599
|
-
type:
|
|
3600
|
-
id:
|
|
3601
|
-
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()
|
|
3602
3783
|
}),
|
|
3603
|
-
|
|
3604
|
-
type:
|
|
3605
|
-
id:
|
|
3784
|
+
import_v419.z.object({
|
|
3785
|
+
type: import_v419.z.literal("file_search_call"),
|
|
3786
|
+
id: import_v419.z.string()
|
|
3606
3787
|
}),
|
|
3607
|
-
|
|
3608
|
-
type:
|
|
3609
|
-
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()
|
|
3610
3804
|
})
|
|
3611
3805
|
])
|
|
3612
3806
|
});
|
|
3613
|
-
var responseOutputItemDoneSchema =
|
|
3614
|
-
type:
|
|
3615
|
-
output_index:
|
|
3616
|
-
item:
|
|
3617
|
-
|
|
3618
|
-
type:
|
|
3619
|
-
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()
|
|
3620
3814
|
}),
|
|
3621
|
-
|
|
3622
|
-
type:
|
|
3623
|
-
id:
|
|
3624
|
-
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()
|
|
3625
3819
|
}),
|
|
3626
|
-
|
|
3627
|
-
type:
|
|
3628
|
-
id:
|
|
3629
|
-
call_id:
|
|
3630
|
-
name:
|
|
3631
|
-
arguments:
|
|
3632
|
-
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")
|
|
3633
3827
|
}),
|
|
3634
3828
|
codeInterpreterCallItem,
|
|
3635
3829
|
imageGenerationCallItem,
|
|
3636
3830
|
webSearchCallItem,
|
|
3637
3831
|
fileSearchCallItem,
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
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")
|
|
3642
3837
|
})
|
|
3643
3838
|
])
|
|
3644
3839
|
});
|
|
3645
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3646
|
-
type:
|
|
3647
|
-
item_id:
|
|
3648
|
-
output_index:
|
|
3649
|
-
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()
|
|
3650
3857
|
});
|
|
3651
|
-
var responseAnnotationAddedSchema =
|
|
3652
|
-
type:
|
|
3653
|
-
annotation:
|
|
3654
|
-
|
|
3655
|
-
type:
|
|
3656
|
-
url:
|
|
3657
|
-
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()
|
|
3658
3865
|
}),
|
|
3659
|
-
|
|
3660
|
-
type:
|
|
3661
|
-
file_id:
|
|
3662
|
-
filename:
|
|
3663
|
-
index:
|
|
3664
|
-
start_index:
|
|
3665
|
-
end_index:
|
|
3666
|
-
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()
|
|
3667
3874
|
})
|
|
3668
3875
|
])
|
|
3669
3876
|
});
|
|
3670
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3671
|
-
type:
|
|
3672
|
-
item_id:
|
|
3673
|
-
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()
|
|
3674
3881
|
});
|
|
3675
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3676
|
-
type:
|
|
3677
|
-
item_id:
|
|
3678
|
-
summary_index:
|
|
3679
|
-
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()
|
|
3680
3887
|
});
|
|
3681
|
-
var openaiResponsesChunkSchema =
|
|
3888
|
+
var openaiResponsesChunkSchema = import_v419.z.union([
|
|
3682
3889
|
textDeltaChunkSchema,
|
|
3683
3890
|
responseFinishedChunkSchema,
|
|
3684
3891
|
responseCreatedChunkSchema,
|
|
3685
3892
|
responseOutputItemAddedSchema,
|
|
3686
3893
|
responseOutputItemDoneSchema,
|
|
3687
3894
|
responseFunctionCallArgumentsDeltaSchema,
|
|
3895
|
+
responseCodeInterpreterCallCodeDeltaSchema,
|
|
3896
|
+
responseCodeInterpreterCallCodeDoneSchema,
|
|
3688
3897
|
responseAnnotationAddedSchema,
|
|
3689
3898
|
responseReasoningSummaryPartAddedSchema,
|
|
3690
3899
|
responseReasoningSummaryTextDeltaSchema,
|
|
3691
3900
|
errorChunkSchema,
|
|
3692
|
-
|
|
3901
|
+
import_v419.z.object({ type: import_v419.z.string() }).loose()
|
|
3693
3902
|
// fallback for unknown chunks
|
|
3694
3903
|
]);
|
|
3695
3904
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3710,6 +3919,12 @@ function isResponseCreatedChunk(chunk) {
|
|
|
3710
3919
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
3711
3920
|
return chunk.type === "response.function_call_arguments.delta";
|
|
3712
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
|
+
}
|
|
3713
3928
|
function isResponseOutputItemAddedChunk(chunk) {
|
|
3714
3929
|
return chunk.type === "response.output_item.added";
|
|
3715
3930
|
}
|
|
@@ -3762,15 +3977,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3762
3977
|
isReasoningModel: false
|
|
3763
3978
|
};
|
|
3764
3979
|
}
|
|
3765
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3766
|
-
include:
|
|
3767
|
-
|
|
3980
|
+
var openaiResponsesProviderOptionsSchema = import_v419.z.object({
|
|
3981
|
+
include: import_v419.z.array(
|
|
3982
|
+
import_v419.z.enum([
|
|
3768
3983
|
"reasoning.encrypted_content",
|
|
3769
3984
|
"file_search_call.results",
|
|
3770
3985
|
"message.output_text.logprobs"
|
|
3771
3986
|
])
|
|
3772
3987
|
).nullish(),
|
|
3773
|
-
instructions:
|
|
3988
|
+
instructions: import_v419.z.string().nullish(),
|
|
3774
3989
|
/**
|
|
3775
3990
|
* Return the log probabilities of the tokens.
|
|
3776
3991
|
*
|
|
@@ -3783,25 +3998,25 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3783
3998
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3784
3999
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3785
4000
|
*/
|
|
3786
|
-
logprobs:
|
|
4001
|
+
logprobs: import_v419.z.union([import_v419.z.boolean(), import_v419.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3787
4002
|
/**
|
|
3788
4003
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3789
4004
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3790
4005
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3791
4006
|
*/
|
|
3792
|
-
maxToolCalls:
|
|
3793
|
-
metadata:
|
|
3794
|
-
parallelToolCalls:
|
|
3795
|
-
previousResponseId:
|
|
3796
|
-
promptCacheKey:
|
|
3797
|
-
reasoningEffort:
|
|
3798
|
-
reasoningSummary:
|
|
3799
|
-
safetyIdentifier:
|
|
3800
|
-
serviceTier:
|
|
3801
|
-
store:
|
|
3802
|
-
strictJsonSchema:
|
|
3803
|
-
textVerbosity:
|
|
3804
|
-
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()
|
|
3805
4020
|
});
|
|
3806
4021
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3807
4022
|
0 && (module.exports = {
|
|
@@ -3812,11 +4027,22 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3812
4027
|
OpenAIResponsesLanguageModel,
|
|
3813
4028
|
OpenAISpeechModel,
|
|
3814
4029
|
OpenAITranscriptionModel,
|
|
4030
|
+
codeInterpreter,
|
|
4031
|
+
codeInterpreterArgsSchema,
|
|
4032
|
+
codeInterpreterInputSchema,
|
|
4033
|
+
codeInterpreterOutputSchema,
|
|
4034
|
+
codeInterpreterToolFactory,
|
|
4035
|
+
fileSearch,
|
|
4036
|
+
fileSearchArgsSchema,
|
|
4037
|
+
fileSearchOutputSchema,
|
|
3815
4038
|
hasDefaultResponseFormat,
|
|
4039
|
+
imageGeneration,
|
|
4040
|
+
imageGenerationArgsSchema,
|
|
4041
|
+
imageGenerationOutputSchema,
|
|
3816
4042
|
modelMaxImagesPerCall,
|
|
3817
4043
|
openAITranscriptionProviderOptions,
|
|
4044
|
+
openaiChatLanguageModelOptions,
|
|
3818
4045
|
openaiCompletionProviderOptions,
|
|
3819
|
-
openaiEmbeddingProviderOptions
|
|
3820
|
-
openaiProviderOptions
|
|
4046
|
+
openaiEmbeddingProviderOptions
|
|
3821
4047
|
});
|
|
3822
4048
|
//# sourceMappingURL=index.js.map
|