@zenning/openai 2.1.0 → 2.2.0
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 +108 -0
- package/dist/index.d.mts +86 -27
- package/dist/index.d.ts +86 -27
- package/dist/index.js +662 -417
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +638 -392
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +339 -24
- package/dist/internal/index.d.ts +339 -24
- package/dist/internal/index.js +667 -419
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +638 -401
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/internal/index.js
CHANGED
|
@@ -27,23 +27,34 @@ __export(index_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(index_exports);
|
|
38
49
|
|
|
39
50
|
// src/chat/openai-chat-language-model.ts
|
|
40
51
|
var import_provider3 = require("@zenning/provider");
|
|
41
|
-
var import_provider_utils3 = require("@
|
|
52
|
+
var import_provider_utils3 = require("@zenning/provider-utils");
|
|
42
53
|
var import_v43 = require("zod/v4");
|
|
43
54
|
|
|
44
55
|
// src/openai-error.ts
|
|
45
56
|
var import_v4 = require("zod/v4");
|
|
46
|
-
var import_provider_utils = require("@
|
|
57
|
+
var import_provider_utils = require("@zenning/provider-utils");
|
|
47
58
|
var openaiErrorDataSchema = import_v4.z.object({
|
|
48
59
|
error: import_v4.z.object({
|
|
49
60
|
message: import_v4.z.string(),
|
|
@@ -62,7 +73,7 @@ var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
|
|
|
62
73
|
|
|
63
74
|
// src/chat/convert-to-openai-chat-messages.ts
|
|
64
75
|
var import_provider = require("@zenning/provider");
|
|
65
|
-
var import_provider_utils2 = require("@
|
|
76
|
+
var import_provider_utils2 = require("@zenning/provider-utils");
|
|
66
77
|
function convertToOpenAIChatMessages({
|
|
67
78
|
prompt,
|
|
68
79
|
systemMessageMode = "system"
|
|
@@ -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) {
|
|
@@ -1077,7 +1088,7 @@ var reasoningModels = {
|
|
|
1077
1088
|
};
|
|
1078
1089
|
|
|
1079
1090
|
// src/completion/openai-completion-language-model.ts
|
|
1080
|
-
var import_provider_utils4 = require("@
|
|
1091
|
+
var import_provider_utils4 = require("@zenning/provider-utils");
|
|
1081
1092
|
var import_v45 = require("zod/v4");
|
|
1082
1093
|
|
|
1083
1094
|
// src/completion/convert-to-openai-completion-prompt.ts
|
|
@@ -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
|
};
|
|
@@ -1503,7 +1514,7 @@ var openaiCompletionChunkSchema = import_v45.z.union([
|
|
|
1503
1514
|
|
|
1504
1515
|
// src/embedding/openai-embedding-model.ts
|
|
1505
1516
|
var import_provider5 = require("@zenning/provider");
|
|
1506
|
-
var import_provider_utils5 = require("@
|
|
1517
|
+
var import_provider_utils5 = require("@zenning/provider-utils");
|
|
1507
1518
|
var import_v47 = require("zod/v4");
|
|
1508
1519
|
|
|
1509
1520
|
// src/embedding/openai-embedding-options.ts
|
|
@@ -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;
|
|
@@ -1590,7 +1601,7 @@ var openaiTextEmbeddingResponseSchema = import_v47.z.object({
|
|
|
1590
1601
|
});
|
|
1591
1602
|
|
|
1592
1603
|
// src/image/openai-image-model.ts
|
|
1593
|
-
var import_provider_utils6 = require("@
|
|
1604
|
+
var import_provider_utils6 = require("@zenning/provider-utils");
|
|
1594
1605
|
var import_v48 = require("zod/v4");
|
|
1595
1606
|
|
|
1596
1607
|
// src/image/openai-image-options.ts
|
|
@@ -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;
|
|
@@ -1686,7 +1697,7 @@ var openaiImageResponseSchema = import_v48.z.object({
|
|
|
1686
1697
|
});
|
|
1687
1698
|
|
|
1688
1699
|
// src/transcription/openai-transcription-model.ts
|
|
1689
|
-
var import_provider_utils7 = require("@
|
|
1700
|
+
var import_provider_utils7 = require("@zenning/provider-utils");
|
|
1690
1701
|
var import_v410 = require("zod/v4");
|
|
1691
1702
|
|
|
1692
1703
|
// src/transcription/openai-transcription-options.ts
|
|
@@ -1910,7 +1921,7 @@ var openaiTranscriptionResponseSchema = import_v410.z.object({
|
|
|
1910
1921
|
});
|
|
1911
1922
|
|
|
1912
1923
|
// src/speech/openai-speech-model.ts
|
|
1913
|
-
var import_provider_utils8 = require("@
|
|
1924
|
+
var import_provider_utils8 = require("@zenning/provider-utils");
|
|
1914
1925
|
var import_v411 = require("zod/v4");
|
|
1915
1926
|
var OpenAIProviderOptionsSchema = import_v411.z.object({
|
|
1916
1927
|
instructions: import_v411.z.string().nullish(),
|
|
@@ -2018,13 +2029,38 @@ var OpenAISpeechModel = class {
|
|
|
2018
2029
|
|
|
2019
2030
|
// src/responses/openai-responses-language-model.ts
|
|
2020
2031
|
var import_provider8 = require("@zenning/provider");
|
|
2021
|
-
var
|
|
2022
|
-
var
|
|
2032
|
+
var import_provider_utils16 = require("@zenning/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("@zenning/provider");
|
|
2026
|
-
var
|
|
2037
|
+
var import_provider_utils10 = require("@zenning/provider-utils");
|
|
2038
|
+
var import_v413 = require("zod/v4");
|
|
2039
|
+
|
|
2040
|
+
// src/tool/local-shell.ts
|
|
2041
|
+
var import_provider_utils9 = require("@zenning/provider-utils");
|
|
2027
2042
|
var import_v412 = require("zod/v4");
|
|
2043
|
+
var localShellInputSchema = import_v412.z.object({
|
|
2044
|
+
action: import_v412.z.object({
|
|
2045
|
+
type: import_v412.z.literal("exec"),
|
|
2046
|
+
command: import_v412.z.array(import_v412.z.string()),
|
|
2047
|
+
timeoutMs: import_v412.z.number().optional(),
|
|
2048
|
+
user: import_v412.z.string().optional(),
|
|
2049
|
+
workingDirectory: import_v412.z.string().optional(),
|
|
2050
|
+
env: import_v412.z.record(import_v412.z.string(), import_v412.z.string()).optional()
|
|
2051
|
+
})
|
|
2052
|
+
});
|
|
2053
|
+
var localShellOutputSchema = import_v412.z.object({
|
|
2054
|
+
output: import_v412.z.string()
|
|
2055
|
+
});
|
|
2056
|
+
var localShell = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2057
|
+
id: "openai.local_shell",
|
|
2058
|
+
name: "local_shell",
|
|
2059
|
+
inputSchema: localShellInputSchema,
|
|
2060
|
+
outputSchema: localShellOutputSchema
|
|
2061
|
+
});
|
|
2062
|
+
|
|
2063
|
+
// src/responses/convert-to-openai-responses-input.ts
|
|
2028
2064
|
function isFileId(data, prefixes) {
|
|
2029
2065
|
if (!prefixes) return false;
|
|
2030
2066
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2033,9 +2069,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2033
2069
|
prompt,
|
|
2034
2070
|
systemMessageMode,
|
|
2035
2071
|
fileIdPrefixes,
|
|
2036
|
-
store
|
|
2072
|
+
store,
|
|
2073
|
+
hasLocalShellTool = false
|
|
2037
2074
|
}) {
|
|
2038
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2075
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2039
2076
|
const input = [];
|
|
2040
2077
|
const warnings = [];
|
|
2041
2078
|
for (const { role, content } of prompt) {
|
|
@@ -2081,7 +2118,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2081
2118
|
return {
|
|
2082
2119
|
type: "input_image",
|
|
2083
2120
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2084
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2121
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils10.convertToBase64)(part.data)}`
|
|
2085
2122
|
},
|
|
2086
2123
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2087
2124
|
};
|
|
@@ -2096,7 +2133,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2096
2133
|
type: "input_file",
|
|
2097
2134
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2098
2135
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2099
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2136
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils10.convertToBase64)(part.data)}`
|
|
2100
2137
|
}
|
|
2101
2138
|
};
|
|
2102
2139
|
} else {
|
|
@@ -2128,12 +2165,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2128
2165
|
if (part.providerExecuted) {
|
|
2129
2166
|
break;
|
|
2130
2167
|
}
|
|
2168
|
+
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2169
|
+
const parsedInput = localShellInputSchema.parse(part.input);
|
|
2170
|
+
input.push({
|
|
2171
|
+
type: "local_shell_call",
|
|
2172
|
+
call_id: part.toolCallId,
|
|
2173
|
+
id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
|
|
2174
|
+
action: {
|
|
2175
|
+
type: "exec",
|
|
2176
|
+
command: parsedInput.action.command,
|
|
2177
|
+
timeout_ms: parsedInput.action.timeoutMs,
|
|
2178
|
+
user: parsedInput.action.user,
|
|
2179
|
+
working_directory: parsedInput.action.workingDirectory,
|
|
2180
|
+
env: parsedInput.action.env
|
|
2181
|
+
}
|
|
2182
|
+
});
|
|
2183
|
+
break;
|
|
2184
|
+
}
|
|
2131
2185
|
input.push({
|
|
2132
2186
|
type: "function_call",
|
|
2133
2187
|
call_id: part.toolCallId,
|
|
2134
2188
|
name: part.toolName,
|
|
2135
2189
|
arguments: JSON.stringify(part.input),
|
|
2136
|
-
id: (
|
|
2190
|
+
id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
|
|
2137
2191
|
});
|
|
2138
2192
|
break;
|
|
2139
2193
|
}
|
|
@@ -2150,33 +2204,47 @@ async function convertToOpenAIResponsesInput({
|
|
|
2150
2204
|
break;
|
|
2151
2205
|
}
|
|
2152
2206
|
case "reasoning": {
|
|
2153
|
-
const providerOptions = await (0,
|
|
2207
|
+
const providerOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
2154
2208
|
provider: "openai",
|
|
2155
2209
|
providerOptions: part.providerOptions,
|
|
2156
2210
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
2157
2211
|
});
|
|
2158
2212
|
const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
2159
2213
|
if (reasoningId != null) {
|
|
2160
|
-
const
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
if (existingReasoningMessage === void 0) {
|
|
2171
|
-
reasoningMessages[reasoningId] = {
|
|
2172
|
-
type: "reasoning",
|
|
2173
|
-
id: reasoningId,
|
|
2174
|
-
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2175
|
-
summary: summaryParts
|
|
2176
|
-
};
|
|
2177
|
-
input.push(reasoningMessages[reasoningId]);
|
|
2214
|
+
const reasoningMessage = reasoningMessages[reasoningId];
|
|
2215
|
+
if (store) {
|
|
2216
|
+
if (reasoningMessage === void 0) {
|
|
2217
|
+
input.push({ type: "item_reference", id: reasoningId });
|
|
2218
|
+
reasoningMessages[reasoningId] = {
|
|
2219
|
+
type: "reasoning",
|
|
2220
|
+
id: reasoningId,
|
|
2221
|
+
summary: []
|
|
2222
|
+
};
|
|
2223
|
+
}
|
|
2178
2224
|
} else {
|
|
2179
|
-
|
|
2225
|
+
const summaryParts = [];
|
|
2226
|
+
if (part.text.length > 0) {
|
|
2227
|
+
summaryParts.push({
|
|
2228
|
+
type: "summary_text",
|
|
2229
|
+
text: part.text
|
|
2230
|
+
});
|
|
2231
|
+
} else if (reasoningMessage !== void 0) {
|
|
2232
|
+
warnings.push({
|
|
2233
|
+
type: "other",
|
|
2234
|
+
message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
|
|
2235
|
+
});
|
|
2236
|
+
}
|
|
2237
|
+
if (reasoningMessage === void 0) {
|
|
2238
|
+
reasoningMessages[reasoningId] = {
|
|
2239
|
+
type: "reasoning",
|
|
2240
|
+
id: reasoningId,
|
|
2241
|
+
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2242
|
+
summary: summaryParts
|
|
2243
|
+
};
|
|
2244
|
+
input.push(reasoningMessages[reasoningId]);
|
|
2245
|
+
} else {
|
|
2246
|
+
reasoningMessage.summary.push(...summaryParts);
|
|
2247
|
+
}
|
|
2180
2248
|
}
|
|
2181
2249
|
} else {
|
|
2182
2250
|
warnings.push({
|
|
@@ -2193,6 +2261,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2193
2261
|
case "tool": {
|
|
2194
2262
|
for (const part of content) {
|
|
2195
2263
|
const output = part.output;
|
|
2264
|
+
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2265
|
+
input.push({
|
|
2266
|
+
type: "local_shell_call_output",
|
|
2267
|
+
call_id: part.toolCallId,
|
|
2268
|
+
output: localShellOutputSchema.parse(output.value).output
|
|
2269
|
+
});
|
|
2270
|
+
break;
|
|
2271
|
+
}
|
|
2196
2272
|
let contentValue;
|
|
2197
2273
|
switch (output.type) {
|
|
2198
2274
|
case "text":
|
|
@@ -2221,9 +2297,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2221
2297
|
}
|
|
2222
2298
|
return { input, warnings };
|
|
2223
2299
|
}
|
|
2224
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2225
|
-
itemId:
|
|
2226
|
-
reasoningEncryptedContent:
|
|
2300
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v413.z.object({
|
|
2301
|
+
itemId: import_v413.z.string().nullish(),
|
|
2302
|
+
reasoningEncryptedContent: import_v413.z.string().nullish()
|
|
2227
2303
|
});
|
|
2228
2304
|
|
|
2229
2305
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2248,200 +2324,207 @@ function mapOpenAIResponseFinishReason({
|
|
|
2248
2324
|
var import_provider7 = require("@zenning/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("@zenning/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("@zenning/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("@zenning/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("@zenning/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("@zenning/provider-utils");
|
|
2500
|
+
var import_v418 = require("zod/v4");
|
|
2501
|
+
var imageGenerationArgsSchema = import_v418.z.object({
|
|
2502
|
+
background: import_v418.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
2503
|
+
inputFidelity: import_v418.z.enum(["low", "high"]).optional(),
|
|
2504
|
+
inputImageMask: import_v418.z.object({
|
|
2505
|
+
fileId: import_v418.z.string().optional(),
|
|
2506
|
+
imageUrl: import_v418.z.string().optional()
|
|
2428
2507
|
}).optional(),
|
|
2429
|
-
model:
|
|
2430
|
-
moderation:
|
|
2431
|
-
outputCompression:
|
|
2432
|
-
outputFormat:
|
|
2433
|
-
|
|
2434
|
-
|
|
2508
|
+
model: import_v418.z.string().optional(),
|
|
2509
|
+
moderation: import_v418.z.enum(["auto"]).optional(),
|
|
2510
|
+
outputCompression: import_v418.z.number().int().min(0).max(100).optional(),
|
|
2511
|
+
outputFormat: import_v418.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
2512
|
+
partialImages: import_v418.z.number().int().min(0).max(3).optional(),
|
|
2513
|
+
quality: import_v418.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
2514
|
+
size: import_v418.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
2435
2515
|
}).strict();
|
|
2436
|
-
var imageGenerationOutputSchema =
|
|
2437
|
-
result:
|
|
2516
|
+
var imageGenerationOutputSchema = import_v418.z.object({
|
|
2517
|
+
result: import_v418.z.string()
|
|
2438
2518
|
});
|
|
2439
|
-
var imageGenerationToolFactory = (0,
|
|
2519
|
+
var imageGenerationToolFactory = (0, import_provider_utils15.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2440
2520
|
id: "openai.image_generation",
|
|
2441
2521
|
name: "image_generation",
|
|
2442
|
-
inputSchema:
|
|
2522
|
+
inputSchema: import_v418.z.object({}),
|
|
2443
2523
|
outputSchema: imageGenerationOutputSchema
|
|
2444
2524
|
});
|
|
2525
|
+
var imageGeneration = (args = {}) => {
|
|
2526
|
+
return imageGenerationToolFactory(args);
|
|
2527
|
+
};
|
|
2445
2528
|
|
|
2446
2529
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2447
2530
|
function prepareResponsesTools({
|
|
@@ -2482,6 +2565,12 @@ function prepareResponsesTools({
|
|
|
2482
2565
|
});
|
|
2483
2566
|
break;
|
|
2484
2567
|
}
|
|
2568
|
+
case "openai.local_shell": {
|
|
2569
|
+
openaiTools.push({
|
|
2570
|
+
type: "local_shell"
|
|
2571
|
+
});
|
|
2572
|
+
break;
|
|
2573
|
+
}
|
|
2485
2574
|
case "openai.web_search_preview": {
|
|
2486
2575
|
const args = webSearchPreviewArgsSchema.parse(tool.args);
|
|
2487
2576
|
openaiTools.push({
|
|
@@ -2520,11 +2609,12 @@ function prepareResponsesTools({
|
|
|
2520
2609
|
image_url: args.inputImageMask.imageUrl
|
|
2521
2610
|
} : void 0,
|
|
2522
2611
|
model: args.model,
|
|
2523
|
-
size: args.size,
|
|
2524
|
-
quality: args.quality,
|
|
2525
2612
|
moderation: args.moderation,
|
|
2613
|
+
partial_images: args.partialImages,
|
|
2614
|
+
quality: args.quality,
|
|
2615
|
+
output_compression: args.outputCompression,
|
|
2526
2616
|
output_format: args.outputFormat,
|
|
2527
|
-
|
|
2617
|
+
size: args.size
|
|
2528
2618
|
});
|
|
2529
2619
|
break;
|
|
2530
2620
|
}
|
|
@@ -2561,73 +2651,86 @@ function prepareResponsesTools({
|
|
|
2561
2651
|
}
|
|
2562
2652
|
|
|
2563
2653
|
// src/responses/openai-responses-language-model.ts
|
|
2564
|
-
var webSearchCallItem =
|
|
2565
|
-
type:
|
|
2566
|
-
id:
|
|
2567
|
-
status:
|
|
2568
|
-
action:
|
|
2569
|
-
|
|
2570
|
-
type:
|
|
2571
|
-
query:
|
|
2654
|
+
var webSearchCallItem = import_v419.z.object({
|
|
2655
|
+
type: import_v419.z.literal("web_search_call"),
|
|
2656
|
+
id: import_v419.z.string(),
|
|
2657
|
+
status: import_v419.z.string(),
|
|
2658
|
+
action: import_v419.z.discriminatedUnion("type", [
|
|
2659
|
+
import_v419.z.object({
|
|
2660
|
+
type: import_v419.z.literal("search"),
|
|
2661
|
+
query: import_v419.z.string().nullish()
|
|
2572
2662
|
}),
|
|
2573
|
-
|
|
2574
|
-
type:
|
|
2575
|
-
url:
|
|
2663
|
+
import_v419.z.object({
|
|
2664
|
+
type: import_v419.z.literal("open_page"),
|
|
2665
|
+
url: import_v419.z.string()
|
|
2576
2666
|
}),
|
|
2577
|
-
|
|
2578
|
-
type:
|
|
2579
|
-
url:
|
|
2580
|
-
pattern:
|
|
2667
|
+
import_v419.z.object({
|
|
2668
|
+
type: import_v419.z.literal("find"),
|
|
2669
|
+
url: import_v419.z.string(),
|
|
2670
|
+
pattern: import_v419.z.string()
|
|
2581
2671
|
})
|
|
2582
2672
|
]).nullish()
|
|
2583
2673
|
});
|
|
2584
|
-
var fileSearchCallItem =
|
|
2585
|
-
type:
|
|
2586
|
-
id:
|
|
2587
|
-
queries:
|
|
2588
|
-
results:
|
|
2589
|
-
|
|
2590
|
-
attributes:
|
|
2591
|
-
file_id:
|
|
2592
|
-
filename:
|
|
2593
|
-
score:
|
|
2594
|
-
text:
|
|
2674
|
+
var fileSearchCallItem = import_v419.z.object({
|
|
2675
|
+
type: import_v419.z.literal("file_search_call"),
|
|
2676
|
+
id: import_v419.z.string(),
|
|
2677
|
+
queries: import_v419.z.array(import_v419.z.string()),
|
|
2678
|
+
results: import_v419.z.array(
|
|
2679
|
+
import_v419.z.object({
|
|
2680
|
+
attributes: import_v419.z.record(import_v419.z.string(), import_v419.z.unknown()),
|
|
2681
|
+
file_id: import_v419.z.string(),
|
|
2682
|
+
filename: import_v419.z.string(),
|
|
2683
|
+
score: import_v419.z.number(),
|
|
2684
|
+
text: import_v419.z.string()
|
|
2595
2685
|
})
|
|
2596
2686
|
).nullish()
|
|
2597
2687
|
});
|
|
2598
|
-
var codeInterpreterCallItem =
|
|
2599
|
-
type:
|
|
2600
|
-
id:
|
|
2601
|
-
code:
|
|
2602
|
-
container_id:
|
|
2603
|
-
outputs:
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2688
|
+
var codeInterpreterCallItem = import_v419.z.object({
|
|
2689
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
2690
|
+
id: import_v419.z.string(),
|
|
2691
|
+
code: import_v419.z.string().nullable(),
|
|
2692
|
+
container_id: import_v419.z.string(),
|
|
2693
|
+
outputs: import_v419.z.array(
|
|
2694
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2695
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
2696
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
2607
2697
|
])
|
|
2608
2698
|
).nullable()
|
|
2609
2699
|
});
|
|
2610
|
-
var
|
|
2611
|
-
type:
|
|
2612
|
-
id:
|
|
2613
|
-
|
|
2700
|
+
var localShellCallItem = import_v419.z.object({
|
|
2701
|
+
type: import_v419.z.literal("local_shell_call"),
|
|
2702
|
+
id: import_v419.z.string(),
|
|
2703
|
+
call_id: import_v419.z.string(),
|
|
2704
|
+
action: import_v419.z.object({
|
|
2705
|
+
type: import_v419.z.literal("exec"),
|
|
2706
|
+
command: import_v419.z.array(import_v419.z.string()),
|
|
2707
|
+
timeout_ms: import_v419.z.number().optional(),
|
|
2708
|
+
user: import_v419.z.string().optional(),
|
|
2709
|
+
working_directory: import_v419.z.string().optional(),
|
|
2710
|
+
env: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional()
|
|
2711
|
+
})
|
|
2712
|
+
});
|
|
2713
|
+
var imageGenerationCallItem = import_v419.z.object({
|
|
2714
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
2715
|
+
id: import_v419.z.string(),
|
|
2716
|
+
result: import_v419.z.string()
|
|
2614
2717
|
});
|
|
2615
2718
|
var TOP_LOGPROBS_MAX = 20;
|
|
2616
|
-
var LOGPROBS_SCHEMA =
|
|
2617
|
-
|
|
2618
|
-
token:
|
|
2619
|
-
logprob:
|
|
2620
|
-
top_logprobs:
|
|
2621
|
-
|
|
2622
|
-
token:
|
|
2623
|
-
logprob:
|
|
2719
|
+
var LOGPROBS_SCHEMA = import_v419.z.array(
|
|
2720
|
+
import_v419.z.object({
|
|
2721
|
+
token: import_v419.z.string(),
|
|
2722
|
+
logprob: import_v419.z.number(),
|
|
2723
|
+
top_logprobs: import_v419.z.array(
|
|
2724
|
+
import_v419.z.object({
|
|
2725
|
+
token: import_v419.z.string(),
|
|
2726
|
+
logprob: import_v419.z.number()
|
|
2624
2727
|
})
|
|
2625
2728
|
)
|
|
2626
2729
|
})
|
|
2627
2730
|
);
|
|
2628
2731
|
var OpenAIResponsesLanguageModel = class {
|
|
2629
2732
|
constructor(modelId, config) {
|
|
2630
|
-
this.specificationVersion = "
|
|
2733
|
+
this.specificationVersion = "v3";
|
|
2631
2734
|
this.supportedUrls = {
|
|
2632
2735
|
"image/*": [/^https?:\/\/.*$/],
|
|
2633
2736
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -2677,7 +2780,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2677
2780
|
if (stopSequences != null) {
|
|
2678
2781
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
2679
2782
|
}
|
|
2680
|
-
const openaiOptions = await (0,
|
|
2783
|
+
const openaiOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2681
2784
|
provider: "openai",
|
|
2682
2785
|
providerOptions,
|
|
2683
2786
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -2686,7 +2789,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2686
2789
|
prompt,
|
|
2687
2790
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
2688
2791
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
2689
|
-
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
|
|
2792
|
+
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
2793
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
2690
2794
|
});
|
|
2691
2795
|
warnings.push(...inputWarnings);
|
|
2692
2796
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
@@ -2845,51 +2949,51 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2845
2949
|
responseHeaders,
|
|
2846
2950
|
value: response,
|
|
2847
2951
|
rawValue: rawResponse
|
|
2848
|
-
} = await (0,
|
|
2952
|
+
} = await (0, import_provider_utils16.postJsonToApi)({
|
|
2849
2953
|
url,
|
|
2850
|
-
headers: (0,
|
|
2954
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
2851
2955
|
body,
|
|
2852
2956
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2853
|
-
successfulResponseHandler: (0,
|
|
2854
|
-
|
|
2855
|
-
id:
|
|
2856
|
-
created_at:
|
|
2857
|
-
error:
|
|
2858
|
-
code:
|
|
2859
|
-
message:
|
|
2957
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
2958
|
+
import_v419.z.object({
|
|
2959
|
+
id: import_v419.z.string(),
|
|
2960
|
+
created_at: import_v419.z.number(),
|
|
2961
|
+
error: import_v419.z.object({
|
|
2962
|
+
code: import_v419.z.string(),
|
|
2963
|
+
message: import_v419.z.string()
|
|
2860
2964
|
}).nullish(),
|
|
2861
|
-
model:
|
|
2862
|
-
output:
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
type:
|
|
2866
|
-
role:
|
|
2867
|
-
id:
|
|
2868
|
-
content:
|
|
2869
|
-
|
|
2870
|
-
type:
|
|
2871
|
-
text:
|
|
2965
|
+
model: import_v419.z.string(),
|
|
2966
|
+
output: import_v419.z.array(
|
|
2967
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2968
|
+
import_v419.z.object({
|
|
2969
|
+
type: import_v419.z.literal("message"),
|
|
2970
|
+
role: import_v419.z.literal("assistant"),
|
|
2971
|
+
id: import_v419.z.string(),
|
|
2972
|
+
content: import_v419.z.array(
|
|
2973
|
+
import_v419.z.object({
|
|
2974
|
+
type: import_v419.z.literal("output_text"),
|
|
2975
|
+
text: import_v419.z.string(),
|
|
2872
2976
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2873
|
-
annotations:
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
type:
|
|
2877
|
-
start_index:
|
|
2878
|
-
end_index:
|
|
2879
|
-
url:
|
|
2880
|
-
title:
|
|
2977
|
+
annotations: import_v419.z.array(
|
|
2978
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2979
|
+
import_v419.z.object({
|
|
2980
|
+
type: import_v419.z.literal("url_citation"),
|
|
2981
|
+
start_index: import_v419.z.number(),
|
|
2982
|
+
end_index: import_v419.z.number(),
|
|
2983
|
+
url: import_v419.z.string(),
|
|
2984
|
+
title: import_v419.z.string()
|
|
2881
2985
|
}),
|
|
2882
|
-
|
|
2883
|
-
type:
|
|
2884
|
-
file_id:
|
|
2885
|
-
filename:
|
|
2886
|
-
index:
|
|
2887
|
-
start_index:
|
|
2888
|
-
end_index:
|
|
2889
|
-
quote:
|
|
2986
|
+
import_v419.z.object({
|
|
2987
|
+
type: import_v419.z.literal("file_citation"),
|
|
2988
|
+
file_id: import_v419.z.string(),
|
|
2989
|
+
filename: import_v419.z.string().nullish(),
|
|
2990
|
+
index: import_v419.z.number().nullish(),
|
|
2991
|
+
start_index: import_v419.z.number().nullish(),
|
|
2992
|
+
end_index: import_v419.z.number().nullish(),
|
|
2993
|
+
quote: import_v419.z.string().nullish()
|
|
2890
2994
|
}),
|
|
2891
|
-
|
|
2892
|
-
type:
|
|
2995
|
+
import_v419.z.object({
|
|
2996
|
+
type: import_v419.z.literal("container_file_citation")
|
|
2893
2997
|
})
|
|
2894
2998
|
])
|
|
2895
2999
|
)
|
|
@@ -2900,33 +3004,34 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2900
3004
|
fileSearchCallItem,
|
|
2901
3005
|
codeInterpreterCallItem,
|
|
2902
3006
|
imageGenerationCallItem,
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
3007
|
+
localShellCallItem,
|
|
3008
|
+
import_v419.z.object({
|
|
3009
|
+
type: import_v419.z.literal("function_call"),
|
|
3010
|
+
call_id: import_v419.z.string(),
|
|
3011
|
+
name: import_v419.z.string(),
|
|
3012
|
+
arguments: import_v419.z.string(),
|
|
3013
|
+
id: import_v419.z.string()
|
|
2909
3014
|
}),
|
|
2910
|
-
|
|
2911
|
-
type:
|
|
2912
|
-
id:
|
|
2913
|
-
status:
|
|
3015
|
+
import_v419.z.object({
|
|
3016
|
+
type: import_v419.z.literal("computer_call"),
|
|
3017
|
+
id: import_v419.z.string(),
|
|
3018
|
+
status: import_v419.z.string().optional()
|
|
2914
3019
|
}),
|
|
2915
|
-
|
|
2916
|
-
type:
|
|
2917
|
-
id:
|
|
2918
|
-
encrypted_content:
|
|
2919
|
-
summary:
|
|
2920
|
-
|
|
2921
|
-
type:
|
|
2922
|
-
text:
|
|
3020
|
+
import_v419.z.object({
|
|
3021
|
+
type: import_v419.z.literal("reasoning"),
|
|
3022
|
+
id: import_v419.z.string(),
|
|
3023
|
+
encrypted_content: import_v419.z.string().nullish(),
|
|
3024
|
+
summary: import_v419.z.array(
|
|
3025
|
+
import_v419.z.object({
|
|
3026
|
+
type: import_v419.z.literal("summary_text"),
|
|
3027
|
+
text: import_v419.z.string()
|
|
2923
3028
|
})
|
|
2924
3029
|
)
|
|
2925
3030
|
})
|
|
2926
3031
|
])
|
|
2927
3032
|
),
|
|
2928
|
-
service_tier:
|
|
2929
|
-
incomplete_details:
|
|
3033
|
+
service_tier: import_v419.z.string().nullish(),
|
|
3034
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
2930
3035
|
usage: usageSchema2
|
|
2931
3036
|
})
|
|
2932
3037
|
),
|
|
@@ -2986,6 +3091,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2986
3091
|
});
|
|
2987
3092
|
break;
|
|
2988
3093
|
}
|
|
3094
|
+
case "local_shell_call": {
|
|
3095
|
+
content.push({
|
|
3096
|
+
type: "tool-call",
|
|
3097
|
+
toolCallId: part.call_id,
|
|
3098
|
+
toolName: "local_shell",
|
|
3099
|
+
input: JSON.stringify({ action: part.action }),
|
|
3100
|
+
providerMetadata: {
|
|
3101
|
+
openai: {
|
|
3102
|
+
itemId: part.id
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
});
|
|
3106
|
+
break;
|
|
3107
|
+
}
|
|
2989
3108
|
case "message": {
|
|
2990
3109
|
for (const contentPart of part.content) {
|
|
2991
3110
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -3005,7 +3124,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3005
3124
|
content.push({
|
|
3006
3125
|
type: "source",
|
|
3007
3126
|
sourceType: "url",
|
|
3008
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
3127
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils16.generateId)(),
|
|
3009
3128
|
url: annotation.url,
|
|
3010
3129
|
title: annotation.title
|
|
3011
3130
|
});
|
|
@@ -3013,7 +3132,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3013
3132
|
content.push({
|
|
3014
3133
|
type: "source",
|
|
3015
3134
|
sourceType: "document",
|
|
3016
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
3135
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils16.generateId)(),
|
|
3017
3136
|
mediaType: "text/plain",
|
|
3018
3137
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3019
3138
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
@@ -3168,18 +3287,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3168
3287
|
warnings,
|
|
3169
3288
|
webSearchToolName
|
|
3170
3289
|
} = await this.getArgs(options);
|
|
3171
|
-
const { responseHeaders, value: response } = await (0,
|
|
3290
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
|
|
3172
3291
|
url: this.config.url({
|
|
3173
3292
|
path: "/responses",
|
|
3174
3293
|
modelId: this.modelId
|
|
3175
3294
|
}),
|
|
3176
|
-
headers: (0,
|
|
3295
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
|
|
3177
3296
|
body: {
|
|
3178
3297
|
...body,
|
|
3179
3298
|
stream: true
|
|
3180
3299
|
},
|
|
3181
3300
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3182
|
-
successfulResponseHandler: (0,
|
|
3301
|
+
successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
|
|
3183
3302
|
openaiResponsesChunkSchema
|
|
3184
3303
|
),
|
|
3185
3304
|
abortSignal: options.abortSignal,
|
|
@@ -3246,6 +3365,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3246
3365
|
id: value.item.id,
|
|
3247
3366
|
toolName: "computer_use"
|
|
3248
3367
|
});
|
|
3368
|
+
} else if (value.item.type === "code_interpreter_call") {
|
|
3369
|
+
ongoingToolCalls[value.output_index] = {
|
|
3370
|
+
toolName: "code_interpreter",
|
|
3371
|
+
toolCallId: value.item.id,
|
|
3372
|
+
codeInterpreter: {
|
|
3373
|
+
containerId: value.item.container_id
|
|
3374
|
+
}
|
|
3375
|
+
};
|
|
3376
|
+
controller.enqueue({
|
|
3377
|
+
type: "tool-input-start",
|
|
3378
|
+
id: value.item.id,
|
|
3379
|
+
toolName: "code_interpreter"
|
|
3380
|
+
});
|
|
3381
|
+
controller.enqueue({
|
|
3382
|
+
type: "tool-input-delta",
|
|
3383
|
+
id: value.item.id,
|
|
3384
|
+
delta: `{"containerId":"${value.item.container_id}","code":"`
|
|
3385
|
+
});
|
|
3249
3386
|
} else if (value.item.type === "file_search_call") {
|
|
3250
3387
|
controller.enqueue({
|
|
3251
3388
|
type: "tool-call",
|
|
@@ -3369,16 +3506,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3369
3506
|
providerExecuted: true
|
|
3370
3507
|
});
|
|
3371
3508
|
} else if (value.item.type === "code_interpreter_call") {
|
|
3372
|
-
|
|
3373
|
-
type: "tool-call",
|
|
3374
|
-
toolCallId: value.item.id,
|
|
3375
|
-
toolName: "code_interpreter",
|
|
3376
|
-
input: JSON.stringify({
|
|
3377
|
-
code: value.item.code,
|
|
3378
|
-
containerId: value.item.container_id
|
|
3379
|
-
}),
|
|
3380
|
-
providerExecuted: true
|
|
3381
|
-
});
|
|
3509
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3382
3510
|
controller.enqueue({
|
|
3383
3511
|
type: "tool-result",
|
|
3384
3512
|
toolCallId: value.item.id,
|
|
@@ -3398,6 +3526,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3398
3526
|
},
|
|
3399
3527
|
providerExecuted: true
|
|
3400
3528
|
});
|
|
3529
|
+
} else if (value.item.type === "local_shell_call") {
|
|
3530
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3531
|
+
controller.enqueue({
|
|
3532
|
+
type: "tool-call",
|
|
3533
|
+
toolCallId: value.item.call_id,
|
|
3534
|
+
toolName: "local_shell",
|
|
3535
|
+
input: JSON.stringify({
|
|
3536
|
+
action: {
|
|
3537
|
+
type: "exec",
|
|
3538
|
+
command: value.item.action.command,
|
|
3539
|
+
timeoutMs: value.item.action.timeout_ms,
|
|
3540
|
+
user: value.item.action.user,
|
|
3541
|
+
workingDirectory: value.item.action.working_directory,
|
|
3542
|
+
env: value.item.action.env
|
|
3543
|
+
}
|
|
3544
|
+
}),
|
|
3545
|
+
providerMetadata: {
|
|
3546
|
+
openai: { itemId: value.item.id }
|
|
3547
|
+
}
|
|
3548
|
+
});
|
|
3401
3549
|
} else if (value.item.type === "message") {
|
|
3402
3550
|
controller.enqueue({
|
|
3403
3551
|
type: "text-end",
|
|
@@ -3428,6 +3576,51 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3428
3576
|
delta: value.delta
|
|
3429
3577
|
});
|
|
3430
3578
|
}
|
|
3579
|
+
} else if (isResponseImageGenerationCallPartialImageChunk(value)) {
|
|
3580
|
+
controller.enqueue({
|
|
3581
|
+
type: "tool-result",
|
|
3582
|
+
toolCallId: value.item_id,
|
|
3583
|
+
toolName: "image_generation",
|
|
3584
|
+
result: {
|
|
3585
|
+
result: value.partial_image_b64
|
|
3586
|
+
},
|
|
3587
|
+
providerExecuted: true,
|
|
3588
|
+
preliminary: true
|
|
3589
|
+
});
|
|
3590
|
+
} else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
|
|
3591
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3592
|
+
if (toolCall != null) {
|
|
3593
|
+
controller.enqueue({
|
|
3594
|
+
type: "tool-input-delta",
|
|
3595
|
+
id: toolCall.toolCallId,
|
|
3596
|
+
// The delta is code, which is embedding in a JSON string.
|
|
3597
|
+
// To escape it, we use JSON.stringify and slice to remove the outer quotes.
|
|
3598
|
+
delta: JSON.stringify(value.delta).slice(1, -1)
|
|
3599
|
+
});
|
|
3600
|
+
}
|
|
3601
|
+
} else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
|
|
3602
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3603
|
+
if (toolCall != null) {
|
|
3604
|
+
controller.enqueue({
|
|
3605
|
+
type: "tool-input-delta",
|
|
3606
|
+
id: toolCall.toolCallId,
|
|
3607
|
+
delta: '"}'
|
|
3608
|
+
});
|
|
3609
|
+
controller.enqueue({
|
|
3610
|
+
type: "tool-input-end",
|
|
3611
|
+
id: toolCall.toolCallId
|
|
3612
|
+
});
|
|
3613
|
+
controller.enqueue({
|
|
3614
|
+
type: "tool-call",
|
|
3615
|
+
toolCallId: toolCall.toolCallId,
|
|
3616
|
+
toolName: "code_interpreter",
|
|
3617
|
+
input: JSON.stringify({
|
|
3618
|
+
code: value.code,
|
|
3619
|
+
containerId: toolCall.codeInterpreter.containerId
|
|
3620
|
+
}),
|
|
3621
|
+
providerExecuted: true
|
|
3622
|
+
});
|
|
3623
|
+
}
|
|
3431
3624
|
} else if (isResponseCreatedChunk(value)) {
|
|
3432
3625
|
responseId = value.response.id;
|
|
3433
3626
|
controller.enqueue({
|
|
@@ -3490,7 +3683,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3490
3683
|
controller.enqueue({
|
|
3491
3684
|
type: "source",
|
|
3492
3685
|
sourceType: "url",
|
|
3493
|
-
id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0,
|
|
3686
|
+
id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils16.generateId)(),
|
|
3494
3687
|
url: value.annotation.url,
|
|
3495
3688
|
title: value.annotation.title
|
|
3496
3689
|
});
|
|
@@ -3498,7 +3691,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3498
3691
|
controller.enqueue({
|
|
3499
3692
|
type: "source",
|
|
3500
3693
|
sourceType: "document",
|
|
3501
|
-
id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0,
|
|
3694
|
+
id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils16.generateId)(),
|
|
3502
3695
|
mediaType: "text/plain",
|
|
3503
3696
|
title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
|
|
3504
3697
|
filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id,
|
|
@@ -3537,166 +3730,201 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3537
3730
|
};
|
|
3538
3731
|
}
|
|
3539
3732
|
};
|
|
3540
|
-
var usageSchema2 =
|
|
3541
|
-
input_tokens:
|
|
3542
|
-
input_tokens_details:
|
|
3543
|
-
output_tokens:
|
|
3544
|
-
output_tokens_details:
|
|
3733
|
+
var usageSchema2 = import_v419.z.object({
|
|
3734
|
+
input_tokens: import_v419.z.number(),
|
|
3735
|
+
input_tokens_details: import_v419.z.object({ cached_tokens: import_v419.z.number().nullish() }).nullish(),
|
|
3736
|
+
output_tokens: import_v419.z.number(),
|
|
3737
|
+
output_tokens_details: import_v419.z.object({ reasoning_tokens: import_v419.z.number().nullish() }).nullish()
|
|
3545
3738
|
});
|
|
3546
|
-
var textDeltaChunkSchema =
|
|
3547
|
-
type:
|
|
3548
|
-
item_id:
|
|
3549
|
-
delta:
|
|
3739
|
+
var textDeltaChunkSchema = import_v419.z.object({
|
|
3740
|
+
type: import_v419.z.literal("response.output_text.delta"),
|
|
3741
|
+
item_id: import_v419.z.string(),
|
|
3742
|
+
delta: import_v419.z.string(),
|
|
3550
3743
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3551
3744
|
});
|
|
3552
|
-
var errorChunkSchema =
|
|
3553
|
-
type:
|
|
3554
|
-
code:
|
|
3555
|
-
message:
|
|
3556
|
-
param:
|
|
3557
|
-
sequence_number:
|
|
3745
|
+
var errorChunkSchema = import_v419.z.object({
|
|
3746
|
+
type: import_v419.z.literal("error"),
|
|
3747
|
+
code: import_v419.z.string(),
|
|
3748
|
+
message: import_v419.z.string(),
|
|
3749
|
+
param: import_v419.z.string().nullish(),
|
|
3750
|
+
sequence_number: import_v419.z.number()
|
|
3558
3751
|
});
|
|
3559
|
-
var responseFinishedChunkSchema =
|
|
3560
|
-
type:
|
|
3561
|
-
response:
|
|
3562
|
-
incomplete_details:
|
|
3752
|
+
var responseFinishedChunkSchema = import_v419.z.object({
|
|
3753
|
+
type: import_v419.z.enum(["response.completed", "response.incomplete"]),
|
|
3754
|
+
response: import_v419.z.object({
|
|
3755
|
+
incomplete_details: import_v419.z.object({ reason: import_v419.z.string() }).nullish(),
|
|
3563
3756
|
usage: usageSchema2,
|
|
3564
|
-
service_tier:
|
|
3757
|
+
service_tier: import_v419.z.string().nullish()
|
|
3565
3758
|
})
|
|
3566
3759
|
});
|
|
3567
|
-
var responseCreatedChunkSchema =
|
|
3568
|
-
type:
|
|
3569
|
-
response:
|
|
3570
|
-
id:
|
|
3571
|
-
created_at:
|
|
3572
|
-
model:
|
|
3573
|
-
service_tier:
|
|
3760
|
+
var responseCreatedChunkSchema = import_v419.z.object({
|
|
3761
|
+
type: import_v419.z.literal("response.created"),
|
|
3762
|
+
response: import_v419.z.object({
|
|
3763
|
+
id: import_v419.z.string(),
|
|
3764
|
+
created_at: import_v419.z.number(),
|
|
3765
|
+
model: import_v419.z.string(),
|
|
3766
|
+
service_tier: import_v419.z.string().nullish()
|
|
3574
3767
|
})
|
|
3575
3768
|
});
|
|
3576
|
-
var responseOutputItemAddedSchema =
|
|
3577
|
-
type:
|
|
3578
|
-
output_index:
|
|
3579
|
-
item:
|
|
3580
|
-
|
|
3581
|
-
type:
|
|
3582
|
-
id:
|
|
3769
|
+
var responseOutputItemAddedSchema = import_v419.z.object({
|
|
3770
|
+
type: import_v419.z.literal("response.output_item.added"),
|
|
3771
|
+
output_index: import_v419.z.number(),
|
|
3772
|
+
item: import_v419.z.discriminatedUnion("type", [
|
|
3773
|
+
import_v419.z.object({
|
|
3774
|
+
type: import_v419.z.literal("message"),
|
|
3775
|
+
id: import_v419.z.string()
|
|
3583
3776
|
}),
|
|
3584
|
-
|
|
3585
|
-
type:
|
|
3586
|
-
id:
|
|
3587
|
-
encrypted_content:
|
|
3777
|
+
import_v419.z.object({
|
|
3778
|
+
type: import_v419.z.literal("reasoning"),
|
|
3779
|
+
id: import_v419.z.string(),
|
|
3780
|
+
encrypted_content: import_v419.z.string().nullish()
|
|
3588
3781
|
}),
|
|
3589
|
-
|
|
3590
|
-
type:
|
|
3591
|
-
id:
|
|
3592
|
-
call_id:
|
|
3593
|
-
name:
|
|
3594
|
-
arguments:
|
|
3782
|
+
import_v419.z.object({
|
|
3783
|
+
type: import_v419.z.literal("function_call"),
|
|
3784
|
+
id: import_v419.z.string(),
|
|
3785
|
+
call_id: import_v419.z.string(),
|
|
3786
|
+
name: import_v419.z.string(),
|
|
3787
|
+
arguments: import_v419.z.string()
|
|
3595
3788
|
}),
|
|
3596
|
-
|
|
3597
|
-
type:
|
|
3598
|
-
id:
|
|
3599
|
-
status:
|
|
3600
|
-
action:
|
|
3601
|
-
type:
|
|
3602
|
-
query:
|
|
3789
|
+
import_v419.z.object({
|
|
3790
|
+
type: import_v419.z.literal("web_search_call"),
|
|
3791
|
+
id: import_v419.z.string(),
|
|
3792
|
+
status: import_v419.z.string(),
|
|
3793
|
+
action: import_v419.z.object({
|
|
3794
|
+
type: import_v419.z.literal("search"),
|
|
3795
|
+
query: import_v419.z.string().optional()
|
|
3603
3796
|
}).nullish()
|
|
3604
3797
|
}),
|
|
3605
|
-
|
|
3606
|
-
type:
|
|
3607
|
-
id:
|
|
3608
|
-
status:
|
|
3798
|
+
import_v419.z.object({
|
|
3799
|
+
type: import_v419.z.literal("computer_call"),
|
|
3800
|
+
id: import_v419.z.string(),
|
|
3801
|
+
status: import_v419.z.string()
|
|
3609
3802
|
}),
|
|
3610
|
-
|
|
3611
|
-
type:
|
|
3612
|
-
id:
|
|
3803
|
+
import_v419.z.object({
|
|
3804
|
+
type: import_v419.z.literal("file_search_call"),
|
|
3805
|
+
id: import_v419.z.string()
|
|
3613
3806
|
}),
|
|
3614
|
-
|
|
3615
|
-
type:
|
|
3616
|
-
id:
|
|
3807
|
+
import_v419.z.object({
|
|
3808
|
+
type: import_v419.z.literal("image_generation_call"),
|
|
3809
|
+
id: import_v419.z.string()
|
|
3810
|
+
}),
|
|
3811
|
+
import_v419.z.object({
|
|
3812
|
+
type: import_v419.z.literal("code_interpreter_call"),
|
|
3813
|
+
id: import_v419.z.string(),
|
|
3814
|
+
container_id: import_v419.z.string(),
|
|
3815
|
+
code: import_v419.z.string().nullable(),
|
|
3816
|
+
outputs: import_v419.z.array(
|
|
3817
|
+
import_v419.z.discriminatedUnion("type", [
|
|
3818
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
3819
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
3820
|
+
])
|
|
3821
|
+
).nullable(),
|
|
3822
|
+
status: import_v419.z.string()
|
|
3617
3823
|
})
|
|
3618
3824
|
])
|
|
3619
3825
|
});
|
|
3620
|
-
var responseOutputItemDoneSchema =
|
|
3621
|
-
type:
|
|
3622
|
-
output_index:
|
|
3623
|
-
item:
|
|
3624
|
-
|
|
3625
|
-
type:
|
|
3626
|
-
id:
|
|
3826
|
+
var responseOutputItemDoneSchema = import_v419.z.object({
|
|
3827
|
+
type: import_v419.z.literal("response.output_item.done"),
|
|
3828
|
+
output_index: import_v419.z.number(),
|
|
3829
|
+
item: import_v419.z.discriminatedUnion("type", [
|
|
3830
|
+
import_v419.z.object({
|
|
3831
|
+
type: import_v419.z.literal("message"),
|
|
3832
|
+
id: import_v419.z.string()
|
|
3627
3833
|
}),
|
|
3628
|
-
|
|
3629
|
-
type:
|
|
3630
|
-
id:
|
|
3631
|
-
encrypted_content:
|
|
3834
|
+
import_v419.z.object({
|
|
3835
|
+
type: import_v419.z.literal("reasoning"),
|
|
3836
|
+
id: import_v419.z.string(),
|
|
3837
|
+
encrypted_content: import_v419.z.string().nullish()
|
|
3632
3838
|
}),
|
|
3633
|
-
|
|
3634
|
-
type:
|
|
3635
|
-
id:
|
|
3636
|
-
call_id:
|
|
3637
|
-
name:
|
|
3638
|
-
arguments:
|
|
3639
|
-
status:
|
|
3839
|
+
import_v419.z.object({
|
|
3840
|
+
type: import_v419.z.literal("function_call"),
|
|
3841
|
+
id: import_v419.z.string(),
|
|
3842
|
+
call_id: import_v419.z.string(),
|
|
3843
|
+
name: import_v419.z.string(),
|
|
3844
|
+
arguments: import_v419.z.string(),
|
|
3845
|
+
status: import_v419.z.literal("completed")
|
|
3640
3846
|
}),
|
|
3641
3847
|
codeInterpreterCallItem,
|
|
3642
3848
|
imageGenerationCallItem,
|
|
3643
3849
|
webSearchCallItem,
|
|
3644
3850
|
fileSearchCallItem,
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3851
|
+
localShellCallItem,
|
|
3852
|
+
import_v419.z.object({
|
|
3853
|
+
type: import_v419.z.literal("computer_call"),
|
|
3854
|
+
id: import_v419.z.string(),
|
|
3855
|
+
status: import_v419.z.literal("completed")
|
|
3649
3856
|
})
|
|
3650
3857
|
])
|
|
3651
3858
|
});
|
|
3652
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3653
|
-
type:
|
|
3654
|
-
item_id:
|
|
3655
|
-
output_index:
|
|
3656
|
-
delta:
|
|
3859
|
+
var responseFunctionCallArgumentsDeltaSchema = import_v419.z.object({
|
|
3860
|
+
type: import_v419.z.literal("response.function_call_arguments.delta"),
|
|
3861
|
+
item_id: import_v419.z.string(),
|
|
3862
|
+
output_index: import_v419.z.number(),
|
|
3863
|
+
delta: import_v419.z.string()
|
|
3864
|
+
});
|
|
3865
|
+
var responseImageGenerationCallPartialImageSchema = import_v419.z.object({
|
|
3866
|
+
type: import_v419.z.literal("response.image_generation_call.partial_image"),
|
|
3867
|
+
item_id: import_v419.z.string(),
|
|
3868
|
+
output_index: import_v419.z.number(),
|
|
3869
|
+
partial_image_b64: import_v419.z.string()
|
|
3657
3870
|
});
|
|
3658
|
-
var
|
|
3659
|
-
type:
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3871
|
+
var responseCodeInterpreterCallCodeDeltaSchema = import_v419.z.object({
|
|
3872
|
+
type: import_v419.z.literal("response.code_interpreter_call_code.delta"),
|
|
3873
|
+
item_id: import_v419.z.string(),
|
|
3874
|
+
output_index: import_v419.z.number(),
|
|
3875
|
+
delta: import_v419.z.string()
|
|
3876
|
+
});
|
|
3877
|
+
var responseCodeInterpreterCallCodeDoneSchema = import_v419.z.object({
|
|
3878
|
+
type: import_v419.z.literal("response.code_interpreter_call_code.done"),
|
|
3879
|
+
item_id: import_v419.z.string(),
|
|
3880
|
+
output_index: import_v419.z.number(),
|
|
3881
|
+
code: import_v419.z.string()
|
|
3882
|
+
});
|
|
3883
|
+
var responseAnnotationAddedSchema = import_v419.z.object({
|
|
3884
|
+
type: import_v419.z.literal("response.output_text.annotation.added"),
|
|
3885
|
+
annotation: import_v419.z.discriminatedUnion("type", [
|
|
3886
|
+
import_v419.z.object({
|
|
3887
|
+
type: import_v419.z.literal("url_citation"),
|
|
3888
|
+
url: import_v419.z.string(),
|
|
3889
|
+
title: import_v419.z.string()
|
|
3665
3890
|
}),
|
|
3666
|
-
|
|
3667
|
-
type:
|
|
3668
|
-
file_id:
|
|
3669
|
-
filename:
|
|
3670
|
-
index:
|
|
3671
|
-
start_index:
|
|
3672
|
-
end_index:
|
|
3673
|
-
quote:
|
|
3891
|
+
import_v419.z.object({
|
|
3892
|
+
type: import_v419.z.literal("file_citation"),
|
|
3893
|
+
file_id: import_v419.z.string(),
|
|
3894
|
+
filename: import_v419.z.string().nullish(),
|
|
3895
|
+
index: import_v419.z.number().nullish(),
|
|
3896
|
+
start_index: import_v419.z.number().nullish(),
|
|
3897
|
+
end_index: import_v419.z.number().nullish(),
|
|
3898
|
+
quote: import_v419.z.string().nullish()
|
|
3674
3899
|
})
|
|
3675
3900
|
])
|
|
3676
3901
|
});
|
|
3677
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3678
|
-
type:
|
|
3679
|
-
item_id:
|
|
3680
|
-
summary_index:
|
|
3902
|
+
var responseReasoningSummaryPartAddedSchema = import_v419.z.object({
|
|
3903
|
+
type: import_v419.z.literal("response.reasoning_summary_part.added"),
|
|
3904
|
+
item_id: import_v419.z.string(),
|
|
3905
|
+
summary_index: import_v419.z.number()
|
|
3681
3906
|
});
|
|
3682
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3683
|
-
type:
|
|
3684
|
-
item_id:
|
|
3685
|
-
summary_index:
|
|
3686
|
-
delta:
|
|
3907
|
+
var responseReasoningSummaryTextDeltaSchema = import_v419.z.object({
|
|
3908
|
+
type: import_v419.z.literal("response.reasoning_summary_text.delta"),
|
|
3909
|
+
item_id: import_v419.z.string(),
|
|
3910
|
+
summary_index: import_v419.z.number(),
|
|
3911
|
+
delta: import_v419.z.string()
|
|
3687
3912
|
});
|
|
3688
|
-
var openaiResponsesChunkSchema =
|
|
3913
|
+
var openaiResponsesChunkSchema = import_v419.z.union([
|
|
3689
3914
|
textDeltaChunkSchema,
|
|
3690
3915
|
responseFinishedChunkSchema,
|
|
3691
3916
|
responseCreatedChunkSchema,
|
|
3692
3917
|
responseOutputItemAddedSchema,
|
|
3693
3918
|
responseOutputItemDoneSchema,
|
|
3694
3919
|
responseFunctionCallArgumentsDeltaSchema,
|
|
3920
|
+
responseImageGenerationCallPartialImageSchema,
|
|
3921
|
+
responseCodeInterpreterCallCodeDeltaSchema,
|
|
3922
|
+
responseCodeInterpreterCallCodeDoneSchema,
|
|
3695
3923
|
responseAnnotationAddedSchema,
|
|
3696
3924
|
responseReasoningSummaryPartAddedSchema,
|
|
3697
3925
|
responseReasoningSummaryTextDeltaSchema,
|
|
3698
3926
|
errorChunkSchema,
|
|
3699
|
-
|
|
3927
|
+
import_v419.z.object({ type: import_v419.z.string() }).loose()
|
|
3700
3928
|
// fallback for unknown chunks
|
|
3701
3929
|
]);
|
|
3702
3930
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3717,6 +3945,15 @@ function isResponseCreatedChunk(chunk) {
|
|
|
3717
3945
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
3718
3946
|
return chunk.type === "response.function_call_arguments.delta";
|
|
3719
3947
|
}
|
|
3948
|
+
function isResponseImageGenerationCallPartialImageChunk(chunk) {
|
|
3949
|
+
return chunk.type === "response.image_generation_call.partial_image";
|
|
3950
|
+
}
|
|
3951
|
+
function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
|
|
3952
|
+
return chunk.type === "response.code_interpreter_call_code.delta";
|
|
3953
|
+
}
|
|
3954
|
+
function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
|
|
3955
|
+
return chunk.type === "response.code_interpreter_call_code.done";
|
|
3956
|
+
}
|
|
3720
3957
|
function isResponseOutputItemAddedChunk(chunk) {
|
|
3721
3958
|
return chunk.type === "response.output_item.added";
|
|
3722
3959
|
}
|
|
@@ -3769,15 +4006,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3769
4006
|
isReasoningModel: false
|
|
3770
4007
|
};
|
|
3771
4008
|
}
|
|
3772
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3773
|
-
include:
|
|
3774
|
-
|
|
4009
|
+
var openaiResponsesProviderOptionsSchema = import_v419.z.object({
|
|
4010
|
+
include: import_v419.z.array(
|
|
4011
|
+
import_v419.z.enum([
|
|
3775
4012
|
"reasoning.encrypted_content",
|
|
3776
4013
|
"file_search_call.results",
|
|
3777
4014
|
"message.output_text.logprobs"
|
|
3778
4015
|
])
|
|
3779
4016
|
).nullish(),
|
|
3780
|
-
instructions:
|
|
4017
|
+
instructions: import_v419.z.string().nullish(),
|
|
3781
4018
|
/**
|
|
3782
4019
|
* Return the log probabilities of the tokens.
|
|
3783
4020
|
*
|
|
@@ -3790,25 +4027,25 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3790
4027
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3791
4028
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3792
4029
|
*/
|
|
3793
|
-
logprobs:
|
|
4030
|
+
logprobs: import_v419.z.union([import_v419.z.boolean(), import_v419.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3794
4031
|
/**
|
|
3795
4032
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3796
4033
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3797
4034
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3798
4035
|
*/
|
|
3799
|
-
maxToolCalls:
|
|
3800
|
-
metadata:
|
|
3801
|
-
parallelToolCalls:
|
|
3802
|
-
previousResponseId:
|
|
3803
|
-
promptCacheKey:
|
|
3804
|
-
reasoningEffort:
|
|
3805
|
-
reasoningSummary:
|
|
3806
|
-
safetyIdentifier:
|
|
3807
|
-
serviceTier:
|
|
3808
|
-
store:
|
|
3809
|
-
strictJsonSchema:
|
|
3810
|
-
textVerbosity:
|
|
3811
|
-
user:
|
|
4036
|
+
maxToolCalls: import_v419.z.number().nullish(),
|
|
4037
|
+
metadata: import_v419.z.any().nullish(),
|
|
4038
|
+
parallelToolCalls: import_v419.z.boolean().nullish(),
|
|
4039
|
+
previousResponseId: import_v419.z.string().nullish(),
|
|
4040
|
+
promptCacheKey: import_v419.z.string().nullish(),
|
|
4041
|
+
reasoningEffort: import_v419.z.string().nullish(),
|
|
4042
|
+
reasoningSummary: import_v419.z.string().nullish(),
|
|
4043
|
+
safetyIdentifier: import_v419.z.string().nullish(),
|
|
4044
|
+
serviceTier: import_v419.z.enum(["auto", "flex", "priority"]).nullish(),
|
|
4045
|
+
store: import_v419.z.boolean().nullish(),
|
|
4046
|
+
strictJsonSchema: import_v419.z.boolean().nullish(),
|
|
4047
|
+
textVerbosity: import_v419.z.enum(["low", "medium", "high"]).nullish(),
|
|
4048
|
+
user: import_v419.z.string().nullish()
|
|
3812
4049
|
});
|
|
3813
4050
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3814
4051
|
0 && (module.exports = {
|
|
@@ -3819,11 +4056,22 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
|
|
|
3819
4056
|
OpenAIResponsesLanguageModel,
|
|
3820
4057
|
OpenAISpeechModel,
|
|
3821
4058
|
OpenAITranscriptionModel,
|
|
4059
|
+
codeInterpreter,
|
|
4060
|
+
codeInterpreterArgsSchema,
|
|
4061
|
+
codeInterpreterInputSchema,
|
|
4062
|
+
codeInterpreterOutputSchema,
|
|
4063
|
+
codeInterpreterToolFactory,
|
|
4064
|
+
fileSearch,
|
|
4065
|
+
fileSearchArgsSchema,
|
|
4066
|
+
fileSearchOutputSchema,
|
|
3822
4067
|
hasDefaultResponseFormat,
|
|
4068
|
+
imageGeneration,
|
|
4069
|
+
imageGenerationArgsSchema,
|
|
4070
|
+
imageGenerationOutputSchema,
|
|
3823
4071
|
modelMaxImagesPerCall,
|
|
3824
4072
|
openAITranscriptionProviderOptions,
|
|
4073
|
+
openaiChatLanguageModelOptions,
|
|
3825
4074
|
openaiCompletionProviderOptions,
|
|
3826
|
-
openaiEmbeddingProviderOptions
|
|
3827
|
-
openaiProviderOptions
|
|
4075
|
+
openaiEmbeddingProviderOptions
|
|
3828
4076
|
});
|
|
3829
4077
|
//# sourceMappingURL=index.js.map
|