@ai-sdk/openai 4.0.0-beta.2 → 4.0.0-beta.21
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 +234 -22
- package/README.md +2 -0
- package/dist/index.d.mts +134 -35
- package/dist/index.d.ts +134 -35
- package/dist/index.js +1700 -1139
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1697 -1117
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +107 -41
- package/dist/internal/index.d.ts +107 -41
- package/dist/internal/index.js +1380 -939
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1371 -917
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +274 -9
- package/package.json +3 -5
- package/src/chat/convert-openai-chat-usage.ts +2 -2
- package/src/chat/convert-to-openai-chat-messages.ts +26 -15
- package/src/chat/map-openai-finish-reason.ts +2 -2
- package/src/chat/openai-chat-language-model.ts +32 -24
- package/src/chat/openai-chat-options.ts +5 -0
- package/src/chat/openai-chat-prepare-tools.ts +6 -6
- package/src/completion/convert-openai-completion-usage.ts +2 -2
- package/src/completion/convert-to-openai-completion-prompt.ts +2 -2
- package/src/completion/map-openai-finish-reason.ts +2 -2
- package/src/completion/openai-completion-language-model.ts +20 -20
- package/src/embedding/openai-embedding-model.ts +5 -5
- package/src/files/openai-files-api.ts +17 -0
- package/src/files/openai-files-options.ts +18 -0
- package/src/files/openai-files.ts +102 -0
- package/src/image/openai-image-model.ts +9 -9
- package/src/index.ts +2 -0
- package/src/openai-config.ts +5 -5
- package/src/openai-language-model-capabilities.ts +3 -2
- package/src/openai-provider.ts +39 -21
- package/src/openai-tools.ts +12 -1
- package/src/responses/convert-openai-responses-usage.ts +2 -2
- package/src/responses/convert-to-openai-responses-input.ts +188 -14
- package/src/responses/map-openai-responses-finish-reason.ts +2 -2
- package/src/responses/openai-responses-api.ts +136 -2
- package/src/responses/openai-responses-language-model.ts +233 -37
- package/src/responses/openai-responses-options.ts +24 -2
- package/src/responses/openai-responses-prepare-tools.ts +34 -9
- package/src/responses/openai-responses-provider-metadata.ts +10 -0
- package/src/speech/openai-speech-model.ts +7 -7
- package/src/tool/custom.ts +0 -6
- package/src/tool/tool-search.ts +98 -0
- package/src/transcription/openai-transcription-model.ts +8 -8
package/dist/index.js
CHANGED
|
@@ -18,16 +18,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
VERSION: () => VERSION,
|
|
24
24
|
createOpenAI: () => createOpenAI,
|
|
25
25
|
openai: () => openai
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
29
29
|
// src/openai-provider.ts
|
|
30
|
-
var
|
|
30
|
+
var import_provider_utils38 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/chat/openai-chat-language-model.ts
|
|
33
33
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -55,9 +55,9 @@ var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
|
|
|
55
55
|
// src/openai-language-model-capabilities.ts
|
|
56
56
|
function getOpenAILanguageModelCapabilities(modelId) {
|
|
57
57
|
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
58
|
-
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5
|
|
58
|
+
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") && !modelId.startsWith("gpt-5.4-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
59
59
|
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
60
|
-
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.4");
|
|
60
|
+
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
|
|
61
61
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
62
62
|
return {
|
|
63
63
|
supportsFlexProcessing,
|
|
@@ -159,13 +159,23 @@ function convertToOpenAIChatMessages({
|
|
|
159
159
|
return { type: "text", text: part.text };
|
|
160
160
|
}
|
|
161
161
|
case "file": {
|
|
162
|
+
if ((0, import_provider_utils2.isProviderReference)(part.data)) {
|
|
163
|
+
return {
|
|
164
|
+
type: "file",
|
|
165
|
+
file: {
|
|
166
|
+
file_id: (0, import_provider_utils2.resolveProviderReference)({
|
|
167
|
+
reference: part.data,
|
|
168
|
+
provider: "openai"
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
162
173
|
if (part.mediaType.startsWith("image/")) {
|
|
163
174
|
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
164
175
|
return {
|
|
165
176
|
type: "image_url",
|
|
166
177
|
image_url: {
|
|
167
178
|
url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`,
|
|
168
|
-
// OpenAI specific extension: image detail
|
|
169
179
|
detail: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.imageDetail
|
|
170
180
|
}
|
|
171
181
|
};
|
|
@@ -209,7 +219,7 @@ function convertToOpenAIChatMessages({
|
|
|
209
219
|
}
|
|
210
220
|
return {
|
|
211
221
|
type: "file",
|
|
212
|
-
file:
|
|
222
|
+
file: {
|
|
213
223
|
filename: (_c = part.filename) != null ? _c : `part-${index}.pdf`,
|
|
214
224
|
file_data: `data:application/pdf;base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`
|
|
215
225
|
}
|
|
@@ -648,7 +658,7 @@ function prepareChatTools({
|
|
|
648
658
|
// src/chat/openai-chat-language-model.ts
|
|
649
659
|
var OpenAIChatLanguageModel = class {
|
|
650
660
|
constructor(modelId, config) {
|
|
651
|
-
this.specificationVersion = "
|
|
661
|
+
this.specificationVersion = "v4";
|
|
652
662
|
this.supportedUrls = {
|
|
653
663
|
"image/*": [/^https?:\/\/.*$/]
|
|
654
664
|
};
|
|
@@ -671,9 +681,10 @@ var OpenAIChatLanguageModel = class {
|
|
|
671
681
|
seed,
|
|
672
682
|
tools,
|
|
673
683
|
toolChoice,
|
|
684
|
+
reasoning,
|
|
674
685
|
providerOptions
|
|
675
686
|
}) {
|
|
676
|
-
var _a, _b, _c, _d, _e;
|
|
687
|
+
var _a, _b, _c, _d, _e, _f;
|
|
677
688
|
const warnings = [];
|
|
678
689
|
const openaiOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
|
|
679
690
|
provider: "openai",
|
|
@@ -681,18 +692,19 @@ var OpenAIChatLanguageModel = class {
|
|
|
681
692
|
schema: openaiLanguageModelChatOptions
|
|
682
693
|
})) != null ? _a : {};
|
|
683
694
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
684
|
-
const
|
|
695
|
+
const resolvedReasoningEffort = (_b = openaiOptions.reasoningEffort) != null ? _b : (0, import_provider_utils5.isCustomReasoning)(reasoning) ? reasoning : void 0;
|
|
696
|
+
const isReasoningModel = (_c = openaiOptions.forceReasoning) != null ? _c : modelCapabilities.isReasoningModel;
|
|
685
697
|
if (topK != null) {
|
|
686
698
|
warnings.push({ type: "unsupported", feature: "topK" });
|
|
687
699
|
}
|
|
688
700
|
const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages(
|
|
689
701
|
{
|
|
690
702
|
prompt,
|
|
691
|
-
systemMessageMode: (
|
|
703
|
+
systemMessageMode: (_d = openaiOptions.systemMessageMode) != null ? _d : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode
|
|
692
704
|
}
|
|
693
705
|
);
|
|
694
706
|
warnings.push(...messageWarnings);
|
|
695
|
-
const strictJsonSchema = (
|
|
707
|
+
const strictJsonSchema = (_e = openaiOptions.strictJsonSchema) != null ? _e : true;
|
|
696
708
|
const baseArgs = {
|
|
697
709
|
// model id:
|
|
698
710
|
model: this.modelId,
|
|
@@ -713,7 +725,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
713
725
|
json_schema: {
|
|
714
726
|
schema: responseFormat.schema,
|
|
715
727
|
strict: strictJsonSchema,
|
|
716
|
-
name: (
|
|
728
|
+
name: (_f = responseFormat.name) != null ? _f : "response",
|
|
717
729
|
description: responseFormat.description
|
|
718
730
|
}
|
|
719
731
|
} : { type: "json_object" } : void 0,
|
|
@@ -726,7 +738,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
726
738
|
store: openaiOptions.store,
|
|
727
739
|
metadata: openaiOptions.metadata,
|
|
728
740
|
prediction: openaiOptions.prediction,
|
|
729
|
-
reasoning_effort:
|
|
741
|
+
reasoning_effort: resolvedReasoningEffort,
|
|
730
742
|
service_tier: openaiOptions.serviceTier,
|
|
731
743
|
prompt_cache_key: openaiOptions.promptCacheKey,
|
|
732
744
|
prompt_cache_retention: openaiOptions.promptCacheRetention,
|
|
@@ -735,7 +747,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
735
747
|
messages
|
|
736
748
|
};
|
|
737
749
|
if (isReasoningModel) {
|
|
738
|
-
if (
|
|
750
|
+
if (resolvedReasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
|
|
739
751
|
if (baseArgs.temperature != null) {
|
|
740
752
|
baseArgs.temperature = void 0;
|
|
741
753
|
warnings.push({
|
|
@@ -1383,7 +1395,7 @@ var openaiLanguageModelCompletionOptions = (0, import_provider_utils7.lazySchema
|
|
|
1383
1395
|
// src/completion/openai-completion-language-model.ts
|
|
1384
1396
|
var OpenAICompletionLanguageModel = class {
|
|
1385
1397
|
constructor(modelId, config) {
|
|
1386
|
-
this.specificationVersion = "
|
|
1398
|
+
this.specificationVersion = "v4";
|
|
1387
1399
|
this.supportedUrls = {
|
|
1388
1400
|
// No URLs are supported for completion models.
|
|
1389
1401
|
};
|
|
@@ -1648,7 +1660,7 @@ var openaiTextEmbeddingResponseSchema = (0, import_provider_utils10.lazySchema)(
|
|
|
1648
1660
|
// src/embedding/openai-embedding-model.ts
|
|
1649
1661
|
var OpenAIEmbeddingModel = class {
|
|
1650
1662
|
constructor(modelId, config) {
|
|
1651
|
-
this.specificationVersion = "
|
|
1663
|
+
this.specificationVersion = "v4";
|
|
1652
1664
|
this.maxEmbeddingsPerCall = 2048;
|
|
1653
1665
|
this.supportsParallelCalls = true;
|
|
1654
1666
|
this.modelId = modelId;
|
|
@@ -1710,33 +1722,135 @@ var OpenAIEmbeddingModel = class {
|
|
|
1710
1722
|
}
|
|
1711
1723
|
};
|
|
1712
1724
|
|
|
1713
|
-
// src/
|
|
1714
|
-
var
|
|
1725
|
+
// src/files/openai-files.ts
|
|
1726
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
1715
1727
|
|
|
1716
|
-
// src/
|
|
1728
|
+
// src/files/openai-files-api.ts
|
|
1717
1729
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
1718
1730
|
var import_v48 = require("zod/v4");
|
|
1719
|
-
var
|
|
1731
|
+
var openaiFilesResponseSchema = (0, import_provider_utils12.lazySchema)(
|
|
1720
1732
|
() => (0, import_provider_utils12.zodSchema)(
|
|
1721
1733
|
import_v48.z.object({
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1734
|
+
id: import_v48.z.string(),
|
|
1735
|
+
object: import_v48.z.string().nullish(),
|
|
1736
|
+
bytes: import_v48.z.number().nullish(),
|
|
1737
|
+
created_at: import_v48.z.number().nullish(),
|
|
1738
|
+
filename: import_v48.z.string().nullish(),
|
|
1739
|
+
purpose: import_v48.z.string().nullish(),
|
|
1740
|
+
status: import_v48.z.string().nullish(),
|
|
1741
|
+
expires_at: import_v48.z.number().nullish()
|
|
1742
|
+
})
|
|
1743
|
+
)
|
|
1744
|
+
);
|
|
1745
|
+
|
|
1746
|
+
// src/files/openai-files-options.ts
|
|
1747
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
1748
|
+
var import_v49 = require("zod/v4");
|
|
1749
|
+
var openaiFilesOptionsSchema = (0, import_provider_utils13.lazySchema)(
|
|
1750
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1751
|
+
import_v49.z.object({
|
|
1752
|
+
/*
|
|
1753
|
+
* Required by the OpenAI API, but optional here because
|
|
1754
|
+
* the SDK defaults to "assistants" — by far the most common
|
|
1755
|
+
* purpose when uploading files in this context.
|
|
1756
|
+
*/
|
|
1757
|
+
purpose: import_v49.z.string().optional(),
|
|
1758
|
+
expiresAfter: import_v49.z.number().optional()
|
|
1759
|
+
})
|
|
1760
|
+
)
|
|
1761
|
+
);
|
|
1762
|
+
|
|
1763
|
+
// src/files/openai-files.ts
|
|
1764
|
+
var OpenAIFiles = class {
|
|
1765
|
+
constructor(config) {
|
|
1766
|
+
this.config = config;
|
|
1767
|
+
this.specificationVersion = "v4";
|
|
1768
|
+
}
|
|
1769
|
+
get provider() {
|
|
1770
|
+
return this.config.provider;
|
|
1771
|
+
}
|
|
1772
|
+
async uploadFile({
|
|
1773
|
+
data,
|
|
1774
|
+
mediaType,
|
|
1775
|
+
filename,
|
|
1776
|
+
providerOptions
|
|
1777
|
+
}) {
|
|
1778
|
+
var _a, _b, _c;
|
|
1779
|
+
const openaiOptions = await (0, import_provider_utils14.parseProviderOptions)({
|
|
1780
|
+
provider: "openai",
|
|
1781
|
+
providerOptions,
|
|
1782
|
+
schema: openaiFilesOptionsSchema
|
|
1783
|
+
});
|
|
1784
|
+
const fileBytes = data instanceof Uint8Array ? data : (0, import_provider_utils14.convertBase64ToUint8Array)(data);
|
|
1785
|
+
const blob = new Blob([fileBytes], {
|
|
1786
|
+
type: mediaType
|
|
1787
|
+
});
|
|
1788
|
+
const formData = new FormData();
|
|
1789
|
+
if (filename != null) {
|
|
1790
|
+
formData.append("file", blob, filename);
|
|
1791
|
+
} else {
|
|
1792
|
+
formData.append("file", blob);
|
|
1793
|
+
}
|
|
1794
|
+
formData.append("purpose", (_a = openaiOptions == null ? void 0 : openaiOptions.purpose) != null ? _a : "assistants");
|
|
1795
|
+
if ((openaiOptions == null ? void 0 : openaiOptions.expiresAfter) != null) {
|
|
1796
|
+
formData.append("expires_after", String(openaiOptions.expiresAfter));
|
|
1797
|
+
}
|
|
1798
|
+
const { value: response } = await (0, import_provider_utils14.postFormDataToApi)({
|
|
1799
|
+
url: `${this.config.baseURL}/files`,
|
|
1800
|
+
headers: (0, import_provider_utils14.combineHeaders)(this.config.headers()),
|
|
1801
|
+
formData,
|
|
1802
|
+
failedResponseHandler: openaiFailedResponseHandler,
|
|
1803
|
+
successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
|
|
1804
|
+
openaiFilesResponseSchema
|
|
1805
|
+
),
|
|
1806
|
+
fetch: this.config.fetch
|
|
1807
|
+
});
|
|
1808
|
+
return {
|
|
1809
|
+
warnings: [],
|
|
1810
|
+
providerReference: { openai: response.id },
|
|
1811
|
+
...((_b = response.filename) != null ? _b : filename) ? { filename: (_c = response.filename) != null ? _c : filename } : {},
|
|
1812
|
+
...mediaType != null ? { mediaType } : {},
|
|
1813
|
+
providerMetadata: {
|
|
1814
|
+
openai: {
|
|
1815
|
+
...response.filename != null ? { filename: response.filename } : {},
|
|
1816
|
+
...response.purpose != null ? { purpose: response.purpose } : {},
|
|
1817
|
+
...response.bytes != null ? { bytes: response.bytes } : {},
|
|
1818
|
+
...response.created_at != null ? { createdAt: response.created_at } : {},
|
|
1819
|
+
...response.status != null ? { status: response.status } : {},
|
|
1820
|
+
...response.expires_at != null ? { expiresAt: response.expires_at } : {}
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
|
|
1827
|
+
// src/image/openai-image-model.ts
|
|
1828
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
1829
|
+
|
|
1830
|
+
// src/image/openai-image-api.ts
|
|
1831
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
1832
|
+
var import_v410 = require("zod/v4");
|
|
1833
|
+
var openaiImageResponseSchema = (0, import_provider_utils15.lazySchema)(
|
|
1834
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1835
|
+
import_v410.z.object({
|
|
1836
|
+
created: import_v410.z.number().nullish(),
|
|
1837
|
+
data: import_v410.z.array(
|
|
1838
|
+
import_v410.z.object({
|
|
1839
|
+
b64_json: import_v410.z.string(),
|
|
1840
|
+
revised_prompt: import_v410.z.string().nullish()
|
|
1727
1841
|
})
|
|
1728
1842
|
),
|
|
1729
|
-
background:
|
|
1730
|
-
output_format:
|
|
1731
|
-
size:
|
|
1732
|
-
quality:
|
|
1733
|
-
usage:
|
|
1734
|
-
input_tokens:
|
|
1735
|
-
output_tokens:
|
|
1736
|
-
total_tokens:
|
|
1737
|
-
input_tokens_details:
|
|
1738
|
-
image_tokens:
|
|
1739
|
-
text_tokens:
|
|
1843
|
+
background: import_v410.z.string().nullish(),
|
|
1844
|
+
output_format: import_v410.z.string().nullish(),
|
|
1845
|
+
size: import_v410.z.string().nullish(),
|
|
1846
|
+
quality: import_v410.z.string().nullish(),
|
|
1847
|
+
usage: import_v410.z.object({
|
|
1848
|
+
input_tokens: import_v410.z.number().nullish(),
|
|
1849
|
+
output_tokens: import_v410.z.number().nullish(),
|
|
1850
|
+
total_tokens: import_v410.z.number().nullish(),
|
|
1851
|
+
input_tokens_details: import_v410.z.object({
|
|
1852
|
+
image_tokens: import_v410.z.number().nullish(),
|
|
1853
|
+
text_tokens: import_v410.z.number().nullish()
|
|
1740
1854
|
}).nullish()
|
|
1741
1855
|
}).nullish()
|
|
1742
1856
|
})
|
|
@@ -1769,7 +1883,7 @@ var OpenAIImageModel = class {
|
|
|
1769
1883
|
constructor(modelId, config) {
|
|
1770
1884
|
this.modelId = modelId;
|
|
1771
1885
|
this.config = config;
|
|
1772
|
-
this.specificationVersion = "
|
|
1886
|
+
this.specificationVersion = "v4";
|
|
1773
1887
|
}
|
|
1774
1888
|
get maxImagesPerCall() {
|
|
1775
1889
|
var _a;
|
|
@@ -1804,13 +1918,13 @@ var OpenAIImageModel = class {
|
|
|
1804
1918
|
}
|
|
1805
1919
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1806
1920
|
if (files != null) {
|
|
1807
|
-
const { value: response2, responseHeaders: responseHeaders2 } = await (0,
|
|
1921
|
+
const { value: response2, responseHeaders: responseHeaders2 } = await (0, import_provider_utils16.postFormDataToApi)({
|
|
1808
1922
|
url: this.config.url({
|
|
1809
1923
|
path: "/images/edits",
|
|
1810
1924
|
modelId: this.modelId
|
|
1811
1925
|
}),
|
|
1812
|
-
headers: (0,
|
|
1813
|
-
formData: (0,
|
|
1926
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), headers),
|
|
1927
|
+
formData: (0, import_provider_utils16.convertToFormData)({
|
|
1814
1928
|
model: this.modelId,
|
|
1815
1929
|
prompt,
|
|
1816
1930
|
image: await Promise.all(
|
|
@@ -1819,12 +1933,12 @@ var OpenAIImageModel = class {
|
|
|
1819
1933
|
[
|
|
1820
1934
|
file.data instanceof Uint8Array ? new Blob([file.data], {
|
|
1821
1935
|
type: file.mediaType
|
|
1822
|
-
}) : new Blob([(0,
|
|
1936
|
+
}) : new Blob([(0, import_provider_utils16.convertBase64ToUint8Array)(file.data)], {
|
|
1823
1937
|
type: file.mediaType
|
|
1824
1938
|
})
|
|
1825
1939
|
],
|
|
1826
1940
|
{ type: file.mediaType }
|
|
1827
|
-
) : (0,
|
|
1941
|
+
) : (0, import_provider_utils16.downloadBlob)(file.url)
|
|
1828
1942
|
)
|
|
1829
1943
|
),
|
|
1830
1944
|
mask: mask != null ? await fileToBlob(mask) : void 0,
|
|
@@ -1833,7 +1947,7 @@ var OpenAIImageModel = class {
|
|
|
1833
1947
|
...(_d = providerOptions.openai) != null ? _d : {}
|
|
1834
1948
|
}),
|
|
1835
1949
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
1836
|
-
successfulResponseHandler: (0,
|
|
1950
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
1837
1951
|
openaiImageResponseSchema
|
|
1838
1952
|
),
|
|
1839
1953
|
abortSignal,
|
|
@@ -1874,12 +1988,12 @@ var OpenAIImageModel = class {
|
|
|
1874
1988
|
}
|
|
1875
1989
|
};
|
|
1876
1990
|
}
|
|
1877
|
-
const { value: response, responseHeaders } = await (0,
|
|
1991
|
+
const { value: response, responseHeaders } = await (0, import_provider_utils16.postJsonToApi)({
|
|
1878
1992
|
url: this.config.url({
|
|
1879
1993
|
path: "/images/generations",
|
|
1880
1994
|
modelId: this.modelId
|
|
1881
1995
|
}),
|
|
1882
|
-
headers: (0,
|
|
1996
|
+
headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), headers),
|
|
1883
1997
|
body: {
|
|
1884
1998
|
model: this.modelId,
|
|
1885
1999
|
prompt,
|
|
@@ -1889,7 +2003,7 @@ var OpenAIImageModel = class {
|
|
|
1889
2003
|
...!hasDefaultResponseFormat(this.modelId) ? { response_format: "b64_json" } : {}
|
|
1890
2004
|
},
|
|
1891
2005
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
1892
|
-
successfulResponseHandler: (0,
|
|
2006
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
1893
2007
|
openaiImageResponseSchema
|
|
1894
2008
|
),
|
|
1895
2009
|
abortSignal,
|
|
@@ -1951,48 +2065,48 @@ function distributeTokenDetails(details, index, total) {
|
|
|
1951
2065
|
async function fileToBlob(file) {
|
|
1952
2066
|
if (!file) return void 0;
|
|
1953
2067
|
if (file.type === "url") {
|
|
1954
|
-
return (0,
|
|
2068
|
+
return (0, import_provider_utils16.downloadBlob)(file.url);
|
|
1955
2069
|
}
|
|
1956
|
-
const data = file.data instanceof Uint8Array ? file.data : (0,
|
|
2070
|
+
const data = file.data instanceof Uint8Array ? file.data : (0, import_provider_utils16.convertBase64ToUint8Array)(file.data);
|
|
1957
2071
|
return new Blob([data], { type: file.mediaType });
|
|
1958
2072
|
}
|
|
1959
2073
|
|
|
1960
2074
|
// src/tool/apply-patch.ts
|
|
1961
|
-
var
|
|
1962
|
-
var
|
|
1963
|
-
var applyPatchInputSchema = (0,
|
|
1964
|
-
() => (0,
|
|
1965
|
-
|
|
1966
|
-
callId:
|
|
1967
|
-
operation:
|
|
1968
|
-
|
|
1969
|
-
type:
|
|
1970
|
-
path:
|
|
1971
|
-
diff:
|
|
2075
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
2076
|
+
var import_v411 = require("zod/v4");
|
|
2077
|
+
var applyPatchInputSchema = (0, import_provider_utils17.lazySchema)(
|
|
2078
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
2079
|
+
import_v411.z.object({
|
|
2080
|
+
callId: import_v411.z.string(),
|
|
2081
|
+
operation: import_v411.z.discriminatedUnion("type", [
|
|
2082
|
+
import_v411.z.object({
|
|
2083
|
+
type: import_v411.z.literal("create_file"),
|
|
2084
|
+
path: import_v411.z.string(),
|
|
2085
|
+
diff: import_v411.z.string()
|
|
1972
2086
|
}),
|
|
1973
|
-
|
|
1974
|
-
type:
|
|
1975
|
-
path:
|
|
2087
|
+
import_v411.z.object({
|
|
2088
|
+
type: import_v411.z.literal("delete_file"),
|
|
2089
|
+
path: import_v411.z.string()
|
|
1976
2090
|
}),
|
|
1977
|
-
|
|
1978
|
-
type:
|
|
1979
|
-
path:
|
|
1980
|
-
diff:
|
|
2091
|
+
import_v411.z.object({
|
|
2092
|
+
type: import_v411.z.literal("update_file"),
|
|
2093
|
+
path: import_v411.z.string(),
|
|
2094
|
+
diff: import_v411.z.string()
|
|
1981
2095
|
})
|
|
1982
2096
|
])
|
|
1983
2097
|
})
|
|
1984
2098
|
)
|
|
1985
2099
|
);
|
|
1986
|
-
var applyPatchOutputSchema = (0,
|
|
1987
|
-
() => (0,
|
|
1988
|
-
|
|
1989
|
-
status:
|
|
1990
|
-
output:
|
|
2100
|
+
var applyPatchOutputSchema = (0, import_provider_utils17.lazySchema)(
|
|
2101
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
2102
|
+
import_v411.z.object({
|
|
2103
|
+
status: import_v411.z.enum(["completed", "failed"]),
|
|
2104
|
+
output: import_v411.z.string().optional()
|
|
1991
2105
|
})
|
|
1992
2106
|
)
|
|
1993
2107
|
);
|
|
1994
|
-
var applyPatchArgsSchema = (0,
|
|
1995
|
-
var applyPatchToolFactory = (0,
|
|
2108
|
+
var applyPatchArgsSchema = (0, import_provider_utils17.lazySchema)(() => (0, import_provider_utils17.zodSchema)(import_v411.z.object({})));
|
|
2109
|
+
var applyPatchToolFactory = (0, import_provider_utils17.createProviderToolFactoryWithOutputSchema)({
|
|
1996
2110
|
id: "openai.apply_patch",
|
|
1997
2111
|
inputSchema: applyPatchInputSchema,
|
|
1998
2112
|
outputSchema: applyPatchOutputSchema
|
|
@@ -2000,41 +2114,41 @@ var applyPatchToolFactory = (0, import_provider_utils14.createProviderToolFactor
|
|
|
2000
2114
|
var applyPatch = applyPatchToolFactory;
|
|
2001
2115
|
|
|
2002
2116
|
// src/tool/code-interpreter.ts
|
|
2003
|
-
var
|
|
2004
|
-
var
|
|
2005
|
-
var codeInterpreterInputSchema = (0,
|
|
2006
|
-
() => (0,
|
|
2007
|
-
|
|
2008
|
-
code:
|
|
2009
|
-
containerId:
|
|
2117
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
2118
|
+
var import_v412 = require("zod/v4");
|
|
2119
|
+
var codeInterpreterInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2120
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2121
|
+
import_v412.z.object({
|
|
2122
|
+
code: import_v412.z.string().nullish(),
|
|
2123
|
+
containerId: import_v412.z.string()
|
|
2010
2124
|
})
|
|
2011
2125
|
)
|
|
2012
2126
|
);
|
|
2013
|
-
var codeInterpreterOutputSchema = (0,
|
|
2014
|
-
() => (0,
|
|
2015
|
-
|
|
2016
|
-
outputs:
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2127
|
+
var codeInterpreterOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2128
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2129
|
+
import_v412.z.object({
|
|
2130
|
+
outputs: import_v412.z.array(
|
|
2131
|
+
import_v412.z.discriminatedUnion("type", [
|
|
2132
|
+
import_v412.z.object({ type: import_v412.z.literal("logs"), logs: import_v412.z.string() }),
|
|
2133
|
+
import_v412.z.object({ type: import_v412.z.literal("image"), url: import_v412.z.string() })
|
|
2020
2134
|
])
|
|
2021
2135
|
).nullish()
|
|
2022
2136
|
})
|
|
2023
2137
|
)
|
|
2024
2138
|
);
|
|
2025
|
-
var codeInterpreterArgsSchema = (0,
|
|
2026
|
-
() => (0,
|
|
2027
|
-
|
|
2028
|
-
container:
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
fileIds:
|
|
2139
|
+
var codeInterpreterArgsSchema = (0, import_provider_utils18.lazySchema)(
|
|
2140
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2141
|
+
import_v412.z.object({
|
|
2142
|
+
container: import_v412.z.union([
|
|
2143
|
+
import_v412.z.string(),
|
|
2144
|
+
import_v412.z.object({
|
|
2145
|
+
fileIds: import_v412.z.array(import_v412.z.string()).optional()
|
|
2032
2146
|
})
|
|
2033
2147
|
]).optional()
|
|
2034
2148
|
})
|
|
2035
2149
|
)
|
|
2036
2150
|
);
|
|
2037
|
-
var codeInterpreterToolFactory = (0,
|
|
2151
|
+
var codeInterpreterToolFactory = (0, import_provider_utils18.createProviderToolFactoryWithOutputSchema)({
|
|
2038
2152
|
id: "openai.code_interpreter",
|
|
2039
2153
|
inputSchema: codeInterpreterInputSchema,
|
|
2040
2154
|
outputSchema: codeInterpreterOutputSchema
|
|
@@ -2044,109 +2158,108 @@ var codeInterpreter = (args = {}) => {
|
|
|
2044
2158
|
};
|
|
2045
2159
|
|
|
2046
2160
|
// src/tool/custom.ts
|
|
2047
|
-
var
|
|
2048
|
-
var
|
|
2049
|
-
var customArgsSchema = (0,
|
|
2050
|
-
() => (0,
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
definition: import_v411.z.string()
|
|
2161
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
2162
|
+
var import_v413 = require("zod/v4");
|
|
2163
|
+
var customArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
2164
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
2165
|
+
import_v413.z.object({
|
|
2166
|
+
description: import_v413.z.string().optional(),
|
|
2167
|
+
format: import_v413.z.union([
|
|
2168
|
+
import_v413.z.object({
|
|
2169
|
+
type: import_v413.z.literal("grammar"),
|
|
2170
|
+
syntax: import_v413.z.enum(["regex", "lark"]),
|
|
2171
|
+
definition: import_v413.z.string()
|
|
2059
2172
|
}),
|
|
2060
|
-
|
|
2061
|
-
type:
|
|
2173
|
+
import_v413.z.object({
|
|
2174
|
+
type: import_v413.z.literal("text")
|
|
2062
2175
|
})
|
|
2063
2176
|
]).optional()
|
|
2064
2177
|
})
|
|
2065
2178
|
)
|
|
2066
2179
|
);
|
|
2067
|
-
var customInputSchema = (0,
|
|
2068
|
-
var customToolFactory = (0,
|
|
2180
|
+
var customInputSchema = (0, import_provider_utils19.lazySchema)(() => (0, import_provider_utils19.zodSchema)(import_v413.z.string()));
|
|
2181
|
+
var customToolFactory = (0, import_provider_utils19.createProviderToolFactory)({
|
|
2069
2182
|
id: "openai.custom",
|
|
2070
2183
|
inputSchema: customInputSchema
|
|
2071
2184
|
});
|
|
2072
2185
|
var customTool = (args) => customToolFactory(args);
|
|
2073
2186
|
|
|
2074
2187
|
// src/tool/file-search.ts
|
|
2075
|
-
var
|
|
2076
|
-
var
|
|
2077
|
-
var comparisonFilterSchema =
|
|
2078
|
-
key:
|
|
2079
|
-
type:
|
|
2080
|
-
value:
|
|
2188
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2189
|
+
var import_v414 = require("zod/v4");
|
|
2190
|
+
var comparisonFilterSchema = import_v414.z.object({
|
|
2191
|
+
key: import_v414.z.string(),
|
|
2192
|
+
type: import_v414.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
2193
|
+
value: import_v414.z.union([import_v414.z.string(), import_v414.z.number(), import_v414.z.boolean(), import_v414.z.array(import_v414.z.string())])
|
|
2081
2194
|
});
|
|
2082
|
-
var compoundFilterSchema =
|
|
2083
|
-
type:
|
|
2084
|
-
filters:
|
|
2085
|
-
|
|
2195
|
+
var compoundFilterSchema = import_v414.z.object({
|
|
2196
|
+
type: import_v414.z.enum(["and", "or"]),
|
|
2197
|
+
filters: import_v414.z.array(
|
|
2198
|
+
import_v414.z.union([comparisonFilterSchema, import_v414.z.lazy(() => compoundFilterSchema)])
|
|
2086
2199
|
)
|
|
2087
2200
|
});
|
|
2088
|
-
var fileSearchArgsSchema = (0,
|
|
2089
|
-
() => (0,
|
|
2090
|
-
|
|
2091
|
-
vectorStoreIds:
|
|
2092
|
-
maxNumResults:
|
|
2093
|
-
ranking:
|
|
2094
|
-
ranker:
|
|
2095
|
-
scoreThreshold:
|
|
2201
|
+
var fileSearchArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
2202
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2203
|
+
import_v414.z.object({
|
|
2204
|
+
vectorStoreIds: import_v414.z.array(import_v414.z.string()),
|
|
2205
|
+
maxNumResults: import_v414.z.number().optional(),
|
|
2206
|
+
ranking: import_v414.z.object({
|
|
2207
|
+
ranker: import_v414.z.string().optional(),
|
|
2208
|
+
scoreThreshold: import_v414.z.number().optional()
|
|
2096
2209
|
}).optional(),
|
|
2097
|
-
filters:
|
|
2210
|
+
filters: import_v414.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2098
2211
|
})
|
|
2099
2212
|
)
|
|
2100
2213
|
);
|
|
2101
|
-
var fileSearchOutputSchema = (0,
|
|
2102
|
-
() => (0,
|
|
2103
|
-
|
|
2104
|
-
queries:
|
|
2105
|
-
results:
|
|
2106
|
-
|
|
2107
|
-
attributes:
|
|
2108
|
-
fileId:
|
|
2109
|
-
filename:
|
|
2110
|
-
score:
|
|
2111
|
-
text:
|
|
2214
|
+
var fileSearchOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2215
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2216
|
+
import_v414.z.object({
|
|
2217
|
+
queries: import_v414.z.array(import_v414.z.string()),
|
|
2218
|
+
results: import_v414.z.array(
|
|
2219
|
+
import_v414.z.object({
|
|
2220
|
+
attributes: import_v414.z.record(import_v414.z.string(), import_v414.z.unknown()),
|
|
2221
|
+
fileId: import_v414.z.string(),
|
|
2222
|
+
filename: import_v414.z.string(),
|
|
2223
|
+
score: import_v414.z.number(),
|
|
2224
|
+
text: import_v414.z.string()
|
|
2112
2225
|
})
|
|
2113
2226
|
).nullable()
|
|
2114
2227
|
})
|
|
2115
2228
|
)
|
|
2116
2229
|
);
|
|
2117
|
-
var fileSearch = (0,
|
|
2230
|
+
var fileSearch = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
|
|
2118
2231
|
id: "openai.file_search",
|
|
2119
|
-
inputSchema:
|
|
2232
|
+
inputSchema: import_v414.z.object({}),
|
|
2120
2233
|
outputSchema: fileSearchOutputSchema
|
|
2121
2234
|
});
|
|
2122
2235
|
|
|
2123
2236
|
// src/tool/image-generation.ts
|
|
2124
|
-
var
|
|
2125
|
-
var
|
|
2126
|
-
var imageGenerationArgsSchema = (0,
|
|
2127
|
-
() => (0,
|
|
2128
|
-
|
|
2129
|
-
background:
|
|
2130
|
-
inputFidelity:
|
|
2131
|
-
inputImageMask:
|
|
2132
|
-
fileId:
|
|
2133
|
-
imageUrl:
|
|
2237
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2238
|
+
var import_v415 = require("zod/v4");
|
|
2239
|
+
var imageGenerationArgsSchema = (0, import_provider_utils21.lazySchema)(
|
|
2240
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2241
|
+
import_v415.z.object({
|
|
2242
|
+
background: import_v415.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
2243
|
+
inputFidelity: import_v415.z.enum(["low", "high"]).optional(),
|
|
2244
|
+
inputImageMask: import_v415.z.object({
|
|
2245
|
+
fileId: import_v415.z.string().optional(),
|
|
2246
|
+
imageUrl: import_v415.z.string().optional()
|
|
2134
2247
|
}).optional(),
|
|
2135
|
-
model:
|
|
2136
|
-
moderation:
|
|
2137
|
-
outputCompression:
|
|
2138
|
-
outputFormat:
|
|
2139
|
-
partialImages:
|
|
2140
|
-
quality:
|
|
2141
|
-
size:
|
|
2248
|
+
model: import_v415.z.string().optional(),
|
|
2249
|
+
moderation: import_v415.z.enum(["auto"]).optional(),
|
|
2250
|
+
outputCompression: import_v415.z.number().int().min(0).max(100).optional(),
|
|
2251
|
+
outputFormat: import_v415.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
2252
|
+
partialImages: import_v415.z.number().int().min(0).max(3).optional(),
|
|
2253
|
+
quality: import_v415.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
2254
|
+
size: import_v415.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
2142
2255
|
}).strict()
|
|
2143
2256
|
)
|
|
2144
2257
|
);
|
|
2145
|
-
var imageGenerationInputSchema = (0,
|
|
2146
|
-
var imageGenerationOutputSchema = (0,
|
|
2147
|
-
() => (0,
|
|
2258
|
+
var imageGenerationInputSchema = (0, import_provider_utils21.lazySchema)(() => (0, import_provider_utils21.zodSchema)(import_v415.z.object({})));
|
|
2259
|
+
var imageGenerationOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2260
|
+
() => (0, import_provider_utils21.zodSchema)(import_v415.z.object({ result: import_v415.z.string() }))
|
|
2148
2261
|
);
|
|
2149
|
-
var imageGenerationToolFactory = (0,
|
|
2262
|
+
var imageGenerationToolFactory = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
|
|
2150
2263
|
id: "openai.image_generation",
|
|
2151
2264
|
inputSchema: imageGenerationInputSchema,
|
|
2152
2265
|
outputSchema: imageGenerationOutputSchema
|
|
@@ -2156,115 +2269,115 @@ var imageGeneration = (args = {}) => {
|
|
|
2156
2269
|
};
|
|
2157
2270
|
|
|
2158
2271
|
// src/tool/local-shell.ts
|
|
2159
|
-
var
|
|
2160
|
-
var
|
|
2161
|
-
var localShellInputSchema = (0,
|
|
2162
|
-
() => (0,
|
|
2163
|
-
|
|
2164
|
-
action:
|
|
2165
|
-
type:
|
|
2166
|
-
command:
|
|
2167
|
-
timeoutMs:
|
|
2168
|
-
user:
|
|
2169
|
-
workingDirectory:
|
|
2170
|
-
env:
|
|
2272
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2273
|
+
var import_v416 = require("zod/v4");
|
|
2274
|
+
var localShellInputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2275
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2276
|
+
import_v416.z.object({
|
|
2277
|
+
action: import_v416.z.object({
|
|
2278
|
+
type: import_v416.z.literal("exec"),
|
|
2279
|
+
command: import_v416.z.array(import_v416.z.string()),
|
|
2280
|
+
timeoutMs: import_v416.z.number().optional(),
|
|
2281
|
+
user: import_v416.z.string().optional(),
|
|
2282
|
+
workingDirectory: import_v416.z.string().optional(),
|
|
2283
|
+
env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
|
|
2171
2284
|
})
|
|
2172
2285
|
})
|
|
2173
2286
|
)
|
|
2174
2287
|
);
|
|
2175
|
-
var localShellOutputSchema = (0,
|
|
2176
|
-
() => (0,
|
|
2288
|
+
var localShellOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2289
|
+
() => (0, import_provider_utils22.zodSchema)(import_v416.z.object({ output: import_v416.z.string() }))
|
|
2177
2290
|
);
|
|
2178
|
-
var localShell = (0,
|
|
2291
|
+
var localShell = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
|
|
2179
2292
|
id: "openai.local_shell",
|
|
2180
2293
|
inputSchema: localShellInputSchema,
|
|
2181
2294
|
outputSchema: localShellOutputSchema
|
|
2182
2295
|
});
|
|
2183
2296
|
|
|
2184
2297
|
// src/tool/shell.ts
|
|
2185
|
-
var
|
|
2186
|
-
var
|
|
2187
|
-
var shellInputSchema = (0,
|
|
2188
|
-
() => (0,
|
|
2189
|
-
|
|
2190
|
-
action:
|
|
2191
|
-
commands:
|
|
2192
|
-
timeoutMs:
|
|
2193
|
-
maxOutputLength:
|
|
2298
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2299
|
+
var import_v417 = require("zod/v4");
|
|
2300
|
+
var shellInputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2301
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2302
|
+
import_v417.z.object({
|
|
2303
|
+
action: import_v417.z.object({
|
|
2304
|
+
commands: import_v417.z.array(import_v417.z.string()),
|
|
2305
|
+
timeoutMs: import_v417.z.number().optional(),
|
|
2306
|
+
maxOutputLength: import_v417.z.number().optional()
|
|
2194
2307
|
})
|
|
2195
2308
|
})
|
|
2196
2309
|
)
|
|
2197
2310
|
);
|
|
2198
|
-
var shellOutputSchema = (0,
|
|
2199
|
-
() => (0,
|
|
2200
|
-
|
|
2201
|
-
output:
|
|
2202
|
-
|
|
2203
|
-
stdout:
|
|
2204
|
-
stderr:
|
|
2205
|
-
outcome:
|
|
2206
|
-
|
|
2207
|
-
|
|
2311
|
+
var shellOutputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2312
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2313
|
+
import_v417.z.object({
|
|
2314
|
+
output: import_v417.z.array(
|
|
2315
|
+
import_v417.z.object({
|
|
2316
|
+
stdout: import_v417.z.string(),
|
|
2317
|
+
stderr: import_v417.z.string(),
|
|
2318
|
+
outcome: import_v417.z.discriminatedUnion("type", [
|
|
2319
|
+
import_v417.z.object({ type: import_v417.z.literal("timeout") }),
|
|
2320
|
+
import_v417.z.object({ type: import_v417.z.literal("exit"), exitCode: import_v417.z.number() })
|
|
2208
2321
|
])
|
|
2209
2322
|
})
|
|
2210
2323
|
)
|
|
2211
2324
|
})
|
|
2212
2325
|
)
|
|
2213
2326
|
);
|
|
2214
|
-
var shellSkillsSchema =
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
type:
|
|
2218
|
-
skillId:
|
|
2219
|
-
version:
|
|
2327
|
+
var shellSkillsSchema = import_v417.z.array(
|
|
2328
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2329
|
+
import_v417.z.object({
|
|
2330
|
+
type: import_v417.z.literal("skillReference"),
|
|
2331
|
+
skillId: import_v417.z.string(),
|
|
2332
|
+
version: import_v417.z.string().optional()
|
|
2220
2333
|
}),
|
|
2221
|
-
|
|
2222
|
-
type:
|
|
2223
|
-
name:
|
|
2224
|
-
description:
|
|
2225
|
-
source:
|
|
2226
|
-
type:
|
|
2227
|
-
mediaType:
|
|
2228
|
-
data:
|
|
2334
|
+
import_v417.z.object({
|
|
2335
|
+
type: import_v417.z.literal("inline"),
|
|
2336
|
+
name: import_v417.z.string(),
|
|
2337
|
+
description: import_v417.z.string(),
|
|
2338
|
+
source: import_v417.z.object({
|
|
2339
|
+
type: import_v417.z.literal("base64"),
|
|
2340
|
+
mediaType: import_v417.z.literal("application/zip"),
|
|
2341
|
+
data: import_v417.z.string()
|
|
2229
2342
|
})
|
|
2230
2343
|
})
|
|
2231
2344
|
])
|
|
2232
2345
|
).optional();
|
|
2233
|
-
var shellArgsSchema = (0,
|
|
2234
|
-
() => (0,
|
|
2235
|
-
|
|
2236
|
-
environment:
|
|
2237
|
-
|
|
2238
|
-
type:
|
|
2239
|
-
fileIds:
|
|
2240
|
-
memoryLimit:
|
|
2241
|
-
networkPolicy:
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
type:
|
|
2245
|
-
allowedDomains:
|
|
2246
|
-
domainSecrets:
|
|
2247
|
-
|
|
2248
|
-
domain:
|
|
2249
|
-
name:
|
|
2250
|
-
value:
|
|
2346
|
+
var shellArgsSchema = (0, import_provider_utils23.lazySchema)(
|
|
2347
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2348
|
+
import_v417.z.object({
|
|
2349
|
+
environment: import_v417.z.union([
|
|
2350
|
+
import_v417.z.object({
|
|
2351
|
+
type: import_v417.z.literal("containerAuto"),
|
|
2352
|
+
fileIds: import_v417.z.array(import_v417.z.string()).optional(),
|
|
2353
|
+
memoryLimit: import_v417.z.enum(["1g", "4g", "16g", "64g"]).optional(),
|
|
2354
|
+
networkPolicy: import_v417.z.discriminatedUnion("type", [
|
|
2355
|
+
import_v417.z.object({ type: import_v417.z.literal("disabled") }),
|
|
2356
|
+
import_v417.z.object({
|
|
2357
|
+
type: import_v417.z.literal("allowlist"),
|
|
2358
|
+
allowedDomains: import_v417.z.array(import_v417.z.string()),
|
|
2359
|
+
domainSecrets: import_v417.z.array(
|
|
2360
|
+
import_v417.z.object({
|
|
2361
|
+
domain: import_v417.z.string(),
|
|
2362
|
+
name: import_v417.z.string(),
|
|
2363
|
+
value: import_v417.z.string()
|
|
2251
2364
|
})
|
|
2252
2365
|
).optional()
|
|
2253
2366
|
})
|
|
2254
2367
|
]).optional(),
|
|
2255
2368
|
skills: shellSkillsSchema
|
|
2256
2369
|
}),
|
|
2257
|
-
|
|
2258
|
-
type:
|
|
2259
|
-
containerId:
|
|
2370
|
+
import_v417.z.object({
|
|
2371
|
+
type: import_v417.z.literal("containerReference"),
|
|
2372
|
+
containerId: import_v417.z.string()
|
|
2260
2373
|
}),
|
|
2261
|
-
|
|
2262
|
-
type:
|
|
2263
|
-
skills:
|
|
2264
|
-
|
|
2265
|
-
name:
|
|
2266
|
-
description:
|
|
2267
|
-
path:
|
|
2374
|
+
import_v417.z.object({
|
|
2375
|
+
type: import_v417.z.literal("local").optional(),
|
|
2376
|
+
skills: import_v417.z.array(
|
|
2377
|
+
import_v417.z.object({
|
|
2378
|
+
name: import_v417.z.string(),
|
|
2379
|
+
description: import_v417.z.string(),
|
|
2380
|
+
path: import_v417.z.string()
|
|
2268
2381
|
})
|
|
2269
2382
|
).optional()
|
|
2270
2383
|
})
|
|
@@ -2272,60 +2385,94 @@ var shellArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
2272
2385
|
})
|
|
2273
2386
|
)
|
|
2274
2387
|
);
|
|
2275
|
-
var shell = (0,
|
|
2388
|
+
var shell = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
|
|
2276
2389
|
id: "openai.shell",
|
|
2277
2390
|
inputSchema: shellInputSchema,
|
|
2278
2391
|
outputSchema: shellOutputSchema
|
|
2279
2392
|
});
|
|
2280
2393
|
|
|
2394
|
+
// src/tool/tool-search.ts
|
|
2395
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
2396
|
+
var import_v418 = require("zod/v4");
|
|
2397
|
+
var toolSearchArgsSchema = (0, import_provider_utils24.lazySchema)(
|
|
2398
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2399
|
+
import_v418.z.object({
|
|
2400
|
+
execution: import_v418.z.enum(["server", "client"]).optional(),
|
|
2401
|
+
description: import_v418.z.string().optional(),
|
|
2402
|
+
parameters: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).optional()
|
|
2403
|
+
})
|
|
2404
|
+
)
|
|
2405
|
+
);
|
|
2406
|
+
var toolSearchInputSchema = (0, import_provider_utils24.lazySchema)(
|
|
2407
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2408
|
+
import_v418.z.object({
|
|
2409
|
+
arguments: import_v418.z.unknown().optional(),
|
|
2410
|
+
call_id: import_v418.z.string().nullish()
|
|
2411
|
+
})
|
|
2412
|
+
)
|
|
2413
|
+
);
|
|
2414
|
+
var toolSearchOutputSchema = (0, import_provider_utils24.lazySchema)(
|
|
2415
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2416
|
+
import_v418.z.object({
|
|
2417
|
+
tools: import_v418.z.array(import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()))
|
|
2418
|
+
})
|
|
2419
|
+
)
|
|
2420
|
+
);
|
|
2421
|
+
var toolSearchToolFactory = (0, import_provider_utils24.createProviderToolFactoryWithOutputSchema)({
|
|
2422
|
+
id: "openai.tool_search",
|
|
2423
|
+
inputSchema: toolSearchInputSchema,
|
|
2424
|
+
outputSchema: toolSearchOutputSchema
|
|
2425
|
+
});
|
|
2426
|
+
var toolSearch = (args = {}) => toolSearchToolFactory(args);
|
|
2427
|
+
|
|
2281
2428
|
// src/tool/web-search.ts
|
|
2282
|
-
var
|
|
2283
|
-
var
|
|
2284
|
-
var webSearchArgsSchema = (0,
|
|
2285
|
-
() => (0,
|
|
2286
|
-
|
|
2287
|
-
externalWebAccess:
|
|
2288
|
-
filters:
|
|
2289
|
-
searchContextSize:
|
|
2290
|
-
userLocation:
|
|
2291
|
-
type:
|
|
2292
|
-
country:
|
|
2293
|
-
city:
|
|
2294
|
-
region:
|
|
2295
|
-
timezone:
|
|
2429
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
2430
|
+
var import_v419 = require("zod/v4");
|
|
2431
|
+
var webSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
2432
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
2433
|
+
import_v419.z.object({
|
|
2434
|
+
externalWebAccess: import_v419.z.boolean().optional(),
|
|
2435
|
+
filters: import_v419.z.object({ allowedDomains: import_v419.z.array(import_v419.z.string()).optional() }).optional(),
|
|
2436
|
+
searchContextSize: import_v419.z.enum(["low", "medium", "high"]).optional(),
|
|
2437
|
+
userLocation: import_v419.z.object({
|
|
2438
|
+
type: import_v419.z.literal("approximate"),
|
|
2439
|
+
country: import_v419.z.string().optional(),
|
|
2440
|
+
city: import_v419.z.string().optional(),
|
|
2441
|
+
region: import_v419.z.string().optional(),
|
|
2442
|
+
timezone: import_v419.z.string().optional()
|
|
2296
2443
|
}).optional()
|
|
2297
2444
|
})
|
|
2298
2445
|
)
|
|
2299
2446
|
);
|
|
2300
|
-
var webSearchInputSchema = (0,
|
|
2301
|
-
var webSearchOutputSchema = (0,
|
|
2302
|
-
() => (0,
|
|
2303
|
-
|
|
2304
|
-
action:
|
|
2305
|
-
|
|
2306
|
-
type:
|
|
2307
|
-
query:
|
|
2447
|
+
var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(() => (0, import_provider_utils25.zodSchema)(import_v419.z.object({})));
|
|
2448
|
+
var webSearchOutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
2449
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
2450
|
+
import_v419.z.object({
|
|
2451
|
+
action: import_v419.z.discriminatedUnion("type", [
|
|
2452
|
+
import_v419.z.object({
|
|
2453
|
+
type: import_v419.z.literal("search"),
|
|
2454
|
+
query: import_v419.z.string().optional()
|
|
2308
2455
|
}),
|
|
2309
|
-
|
|
2310
|
-
type:
|
|
2311
|
-
url:
|
|
2456
|
+
import_v419.z.object({
|
|
2457
|
+
type: import_v419.z.literal("openPage"),
|
|
2458
|
+
url: import_v419.z.string().nullish()
|
|
2312
2459
|
}),
|
|
2313
|
-
|
|
2314
|
-
type:
|
|
2315
|
-
url:
|
|
2316
|
-
pattern:
|
|
2460
|
+
import_v419.z.object({
|
|
2461
|
+
type: import_v419.z.literal("findInPage"),
|
|
2462
|
+
url: import_v419.z.string().nullish(),
|
|
2463
|
+
pattern: import_v419.z.string().nullish()
|
|
2317
2464
|
})
|
|
2318
2465
|
]).optional(),
|
|
2319
|
-
sources:
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2466
|
+
sources: import_v419.z.array(
|
|
2467
|
+
import_v419.z.discriminatedUnion("type", [
|
|
2468
|
+
import_v419.z.object({ type: import_v419.z.literal("url"), url: import_v419.z.string() }),
|
|
2469
|
+
import_v419.z.object({ type: import_v419.z.literal("api"), name: import_v419.z.string() })
|
|
2323
2470
|
])
|
|
2324
2471
|
).optional()
|
|
2325
2472
|
})
|
|
2326
2473
|
)
|
|
2327
2474
|
);
|
|
2328
|
-
var webSearchToolFactory = (0,
|
|
2475
|
+
var webSearchToolFactory = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
|
|
2329
2476
|
id: "openai.web_search",
|
|
2330
2477
|
inputSchema: webSearchInputSchema,
|
|
2331
2478
|
outputSchema: webSearchOutputSchema
|
|
@@ -2333,109 +2480,109 @@ var webSearchToolFactory = (0, import_provider_utils21.createProviderToolFactory
|
|
|
2333
2480
|
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2334
2481
|
|
|
2335
2482
|
// src/tool/web-search-preview.ts
|
|
2336
|
-
var
|
|
2337
|
-
var
|
|
2338
|
-
var webSearchPreviewArgsSchema = (0,
|
|
2339
|
-
() => (0,
|
|
2340
|
-
|
|
2341
|
-
searchContextSize:
|
|
2342
|
-
userLocation:
|
|
2343
|
-
type:
|
|
2344
|
-
country:
|
|
2345
|
-
city:
|
|
2346
|
-
region:
|
|
2347
|
-
timezone:
|
|
2483
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
2484
|
+
var import_v420 = require("zod/v4");
|
|
2485
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
2486
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
2487
|
+
import_v420.z.object({
|
|
2488
|
+
searchContextSize: import_v420.z.enum(["low", "medium", "high"]).optional(),
|
|
2489
|
+
userLocation: import_v420.z.object({
|
|
2490
|
+
type: import_v420.z.literal("approximate"),
|
|
2491
|
+
country: import_v420.z.string().optional(),
|
|
2492
|
+
city: import_v420.z.string().optional(),
|
|
2493
|
+
region: import_v420.z.string().optional(),
|
|
2494
|
+
timezone: import_v420.z.string().optional()
|
|
2348
2495
|
}).optional()
|
|
2349
2496
|
})
|
|
2350
2497
|
)
|
|
2351
2498
|
);
|
|
2352
|
-
var webSearchPreviewInputSchema = (0,
|
|
2353
|
-
() => (0,
|
|
2499
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils26.lazySchema)(
|
|
2500
|
+
() => (0, import_provider_utils26.zodSchema)(import_v420.z.object({}))
|
|
2354
2501
|
);
|
|
2355
|
-
var webSearchPreviewOutputSchema = (0,
|
|
2356
|
-
() => (0,
|
|
2357
|
-
|
|
2358
|
-
action:
|
|
2359
|
-
|
|
2360
|
-
type:
|
|
2361
|
-
query:
|
|
2502
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
2503
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
2504
|
+
import_v420.z.object({
|
|
2505
|
+
action: import_v420.z.discriminatedUnion("type", [
|
|
2506
|
+
import_v420.z.object({
|
|
2507
|
+
type: import_v420.z.literal("search"),
|
|
2508
|
+
query: import_v420.z.string().optional()
|
|
2362
2509
|
}),
|
|
2363
|
-
|
|
2364
|
-
type:
|
|
2365
|
-
url:
|
|
2510
|
+
import_v420.z.object({
|
|
2511
|
+
type: import_v420.z.literal("openPage"),
|
|
2512
|
+
url: import_v420.z.string().nullish()
|
|
2366
2513
|
}),
|
|
2367
|
-
|
|
2368
|
-
type:
|
|
2369
|
-
url:
|
|
2370
|
-
pattern:
|
|
2514
|
+
import_v420.z.object({
|
|
2515
|
+
type: import_v420.z.literal("findInPage"),
|
|
2516
|
+
url: import_v420.z.string().nullish(),
|
|
2517
|
+
pattern: import_v420.z.string().nullish()
|
|
2371
2518
|
})
|
|
2372
2519
|
]).optional()
|
|
2373
2520
|
})
|
|
2374
2521
|
)
|
|
2375
2522
|
);
|
|
2376
|
-
var webSearchPreview = (0,
|
|
2523
|
+
var webSearchPreview = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
|
|
2377
2524
|
id: "openai.web_search_preview",
|
|
2378
2525
|
inputSchema: webSearchPreviewInputSchema,
|
|
2379
2526
|
outputSchema: webSearchPreviewOutputSchema
|
|
2380
2527
|
});
|
|
2381
2528
|
|
|
2382
2529
|
// src/tool/mcp.ts
|
|
2383
|
-
var
|
|
2384
|
-
var
|
|
2385
|
-
var jsonValueSchema =
|
|
2386
|
-
() =>
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2530
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
2531
|
+
var import_v421 = require("zod/v4");
|
|
2532
|
+
var jsonValueSchema = import_v421.z.lazy(
|
|
2533
|
+
() => import_v421.z.union([
|
|
2534
|
+
import_v421.z.string(),
|
|
2535
|
+
import_v421.z.number(),
|
|
2536
|
+
import_v421.z.boolean(),
|
|
2537
|
+
import_v421.z.null(),
|
|
2538
|
+
import_v421.z.array(jsonValueSchema),
|
|
2539
|
+
import_v421.z.record(import_v421.z.string(), jsonValueSchema)
|
|
2393
2540
|
])
|
|
2394
2541
|
);
|
|
2395
|
-
var mcpArgsSchema = (0,
|
|
2396
|
-
() => (0,
|
|
2397
|
-
|
|
2398
|
-
serverLabel:
|
|
2399
|
-
allowedTools:
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
readOnly:
|
|
2403
|
-
toolNames:
|
|
2542
|
+
var mcpArgsSchema = (0, import_provider_utils27.lazySchema)(
|
|
2543
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
2544
|
+
import_v421.z.object({
|
|
2545
|
+
serverLabel: import_v421.z.string(),
|
|
2546
|
+
allowedTools: import_v421.z.union([
|
|
2547
|
+
import_v421.z.array(import_v421.z.string()),
|
|
2548
|
+
import_v421.z.object({
|
|
2549
|
+
readOnly: import_v421.z.boolean().optional(),
|
|
2550
|
+
toolNames: import_v421.z.array(import_v421.z.string()).optional()
|
|
2404
2551
|
})
|
|
2405
2552
|
]).optional(),
|
|
2406
|
-
authorization:
|
|
2407
|
-
connectorId:
|
|
2408
|
-
headers:
|
|
2409
|
-
requireApproval:
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
never:
|
|
2413
|
-
toolNames:
|
|
2553
|
+
authorization: import_v421.z.string().optional(),
|
|
2554
|
+
connectorId: import_v421.z.string().optional(),
|
|
2555
|
+
headers: import_v421.z.record(import_v421.z.string(), import_v421.z.string()).optional(),
|
|
2556
|
+
requireApproval: import_v421.z.union([
|
|
2557
|
+
import_v421.z.enum(["always", "never"]),
|
|
2558
|
+
import_v421.z.object({
|
|
2559
|
+
never: import_v421.z.object({
|
|
2560
|
+
toolNames: import_v421.z.array(import_v421.z.string()).optional()
|
|
2414
2561
|
}).optional()
|
|
2415
2562
|
})
|
|
2416
2563
|
]).optional(),
|
|
2417
|
-
serverDescription:
|
|
2418
|
-
serverUrl:
|
|
2564
|
+
serverDescription: import_v421.z.string().optional(),
|
|
2565
|
+
serverUrl: import_v421.z.string().optional()
|
|
2419
2566
|
}).refine(
|
|
2420
2567
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2421
2568
|
"One of serverUrl or connectorId must be provided."
|
|
2422
2569
|
)
|
|
2423
2570
|
)
|
|
2424
2571
|
);
|
|
2425
|
-
var mcpInputSchema = (0,
|
|
2426
|
-
var mcpOutputSchema = (0,
|
|
2427
|
-
() => (0,
|
|
2428
|
-
|
|
2429
|
-
type:
|
|
2430
|
-
serverLabel:
|
|
2431
|
-
name:
|
|
2432
|
-
arguments:
|
|
2433
|
-
output:
|
|
2434
|
-
error:
|
|
2572
|
+
var mcpInputSchema = (0, import_provider_utils27.lazySchema)(() => (0, import_provider_utils27.zodSchema)(import_v421.z.object({})));
|
|
2573
|
+
var mcpOutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
2574
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
2575
|
+
import_v421.z.object({
|
|
2576
|
+
type: import_v421.z.literal("call"),
|
|
2577
|
+
serverLabel: import_v421.z.string(),
|
|
2578
|
+
name: import_v421.z.string(),
|
|
2579
|
+
arguments: import_v421.z.string(),
|
|
2580
|
+
output: import_v421.z.string().nullish(),
|
|
2581
|
+
error: import_v421.z.union([import_v421.z.string(), jsonValueSchema]).optional()
|
|
2435
2582
|
})
|
|
2436
2583
|
)
|
|
2437
2584
|
);
|
|
2438
|
-
var mcpToolFactory = (0,
|
|
2585
|
+
var mcpToolFactory = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
2439
2586
|
id: "openai.mcp",
|
|
2440
2587
|
inputSchema: mcpInputSchema,
|
|
2441
2588
|
outputSchema: mcpOutputSchema
|
|
@@ -2457,7 +2604,6 @@ var openaiTools = {
|
|
|
2457
2604
|
* Lark syntax). The model returns a `custom_tool_call` output item whose
|
|
2458
2605
|
* `input` field is a string matching the specified grammar.
|
|
2459
2606
|
*
|
|
2460
|
-
* @param name - The name of the custom tool.
|
|
2461
2607
|
* @param description - An optional description of the tool.
|
|
2462
2608
|
* @param format - The output format constraint (grammar type, syntax, and definition).
|
|
2463
2609
|
*/
|
|
@@ -2547,12 +2693,22 @@ var openaiTools = {
|
|
|
2547
2693
|
* @param serverDescription - Optional description of the server.
|
|
2548
2694
|
* @param serverUrl - URL for the MCP server.
|
|
2549
2695
|
*/
|
|
2550
|
-
mcp
|
|
2696
|
+
mcp,
|
|
2697
|
+
/**
|
|
2698
|
+
* Tool search allows the model to dynamically search for and load deferred
|
|
2699
|
+
* tools into the model's context as needed. This helps reduce overall token
|
|
2700
|
+
* usage, cost, and latency by only loading tools when the model needs them.
|
|
2701
|
+
*
|
|
2702
|
+
* To use tool search, mark functions or namespaces with `defer_loading: true`
|
|
2703
|
+
* in the tools array. The model will use tool search to load these tools
|
|
2704
|
+
* when it determines they are needed.
|
|
2705
|
+
*/
|
|
2706
|
+
toolSearch
|
|
2551
2707
|
};
|
|
2552
2708
|
|
|
2553
2709
|
// src/responses/openai-responses-language-model.ts
|
|
2554
2710
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2555
|
-
var
|
|
2711
|
+
var import_provider_utils32 = require("@ai-sdk/provider-utils");
|
|
2556
2712
|
|
|
2557
2713
|
// src/responses/convert-openai-responses-usage.ts
|
|
2558
2714
|
function convertOpenAIResponsesUsage(usage) {
|
|
@@ -2595,8 +2751,8 @@ function convertOpenAIResponsesUsage(usage) {
|
|
|
2595
2751
|
|
|
2596
2752
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2597
2753
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2598
|
-
var
|
|
2599
|
-
var
|
|
2754
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
2755
|
+
var import_v422 = require("zod/v4");
|
|
2600
2756
|
function isFileId(data, prefixes) {
|
|
2601
2757
|
if (!prefixes) return false;
|
|
2602
2758
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2614,8 +2770,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2614
2770
|
hasApplyPatchTool = false,
|
|
2615
2771
|
customProviderToolNames
|
|
2616
2772
|
}) {
|
|
2617
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2618
|
-
|
|
2773
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
2774
|
+
let input = [];
|
|
2619
2775
|
const warnings = [];
|
|
2620
2776
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2621
2777
|
for (const { role, content } of prompt) {
|
|
@@ -2650,20 +2806,37 @@ async function convertToOpenAIResponsesInput({
|
|
|
2650
2806
|
input.push({
|
|
2651
2807
|
role: "user",
|
|
2652
2808
|
content: content.map((part, index) => {
|
|
2653
|
-
var _a2, _b2, _c2;
|
|
2809
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
2654
2810
|
switch (part.type) {
|
|
2655
2811
|
case "text": {
|
|
2656
2812
|
return { type: "input_text", text: part.text };
|
|
2657
2813
|
}
|
|
2658
2814
|
case "file": {
|
|
2815
|
+
if ((0, import_provider_utils28.isProviderReference)(part.data)) {
|
|
2816
|
+
const fileId = (0, import_provider_utils28.resolveProviderReference)({
|
|
2817
|
+
reference: part.data,
|
|
2818
|
+
provider: providerOptionsName
|
|
2819
|
+
});
|
|
2820
|
+
if (part.mediaType.startsWith("image/")) {
|
|
2821
|
+
return {
|
|
2822
|
+
type: "input_image",
|
|
2823
|
+
file_id: fileId,
|
|
2824
|
+
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
|
|
2825
|
+
};
|
|
2826
|
+
}
|
|
2827
|
+
return {
|
|
2828
|
+
type: "input_file",
|
|
2829
|
+
file_id: fileId
|
|
2830
|
+
};
|
|
2831
|
+
}
|
|
2659
2832
|
if (part.mediaType.startsWith("image/")) {
|
|
2660
2833
|
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
2661
2834
|
return {
|
|
2662
2835
|
type: "input_image",
|
|
2663
2836
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2664
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2837
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils28.convertToBase64)(part.data)}`
|
|
2665
2838
|
},
|
|
2666
|
-
detail: (
|
|
2839
|
+
detail: (_d2 = (_c2 = part.providerOptions) == null ? void 0 : _c2[providerOptionsName]) == null ? void 0 : _d2.imageDetail
|
|
2667
2840
|
};
|
|
2668
2841
|
} else if (part.mediaType === "application/pdf") {
|
|
2669
2842
|
if (part.data instanceof URL) {
|
|
@@ -2675,8 +2848,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2675
2848
|
return {
|
|
2676
2849
|
type: "input_file",
|
|
2677
2850
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2678
|
-
filename: (
|
|
2679
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2851
|
+
filename: (_e2 = part.filename) != null ? _e2 : `part-${index}.pdf`,
|
|
2852
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils28.convertToBase64)(part.data)}`
|
|
2680
2853
|
}
|
|
2681
2854
|
};
|
|
2682
2855
|
} else {
|
|
@@ -2718,6 +2891,32 @@ async function convertToOpenAIResponsesInput({
|
|
|
2718
2891
|
if (hasConversation && id != null) {
|
|
2719
2892
|
break;
|
|
2720
2893
|
}
|
|
2894
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2895
|
+
part.toolName
|
|
2896
|
+
);
|
|
2897
|
+
if (resolvedToolName === "tool_search") {
|
|
2898
|
+
if (store && id != null) {
|
|
2899
|
+
input.push({ type: "item_reference", id });
|
|
2900
|
+
break;
|
|
2901
|
+
}
|
|
2902
|
+
const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils28.parseJSON)({
|
|
2903
|
+
text: part.input,
|
|
2904
|
+
schema: toolSearchInputSchema
|
|
2905
|
+
}) : await (0, import_provider_utils28.validateTypes)({
|
|
2906
|
+
value: part.input,
|
|
2907
|
+
schema: toolSearchInputSchema
|
|
2908
|
+
});
|
|
2909
|
+
const execution = parsedInput.call_id != null ? "client" : "server";
|
|
2910
|
+
input.push({
|
|
2911
|
+
type: "tool_search_call",
|
|
2912
|
+
id: id != null ? id : part.toolCallId,
|
|
2913
|
+
execution,
|
|
2914
|
+
call_id: (_g = parsedInput.call_id) != null ? _g : null,
|
|
2915
|
+
status: "completed",
|
|
2916
|
+
arguments: parsedInput.arguments
|
|
2917
|
+
});
|
|
2918
|
+
break;
|
|
2919
|
+
}
|
|
2721
2920
|
if (part.providerExecuted) {
|
|
2722
2921
|
if (store && id != null) {
|
|
2723
2922
|
input.push({ type: "item_reference", id });
|
|
@@ -2728,11 +2927,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2728
2927
|
input.push({ type: "item_reference", id });
|
|
2729
2928
|
break;
|
|
2730
2929
|
}
|
|
2731
|
-
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2732
|
-
part.toolName
|
|
2733
|
-
);
|
|
2734
2930
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2735
|
-
const parsedInput = await (0,
|
|
2931
|
+
const parsedInput = await (0, import_provider_utils28.validateTypes)({
|
|
2736
2932
|
value: part.input,
|
|
2737
2933
|
schema: localShellInputSchema
|
|
2738
2934
|
});
|
|
@@ -2752,7 +2948,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2752
2948
|
break;
|
|
2753
2949
|
}
|
|
2754
2950
|
if (hasShellTool && resolvedToolName === "shell") {
|
|
2755
|
-
const parsedInput = await (0,
|
|
2951
|
+
const parsedInput = await (0, import_provider_utils28.validateTypes)({
|
|
2756
2952
|
value: part.input,
|
|
2757
2953
|
schema: shellInputSchema
|
|
2758
2954
|
});
|
|
@@ -2770,7 +2966,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2770
2966
|
break;
|
|
2771
2967
|
}
|
|
2772
2968
|
if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
|
|
2773
|
-
const parsedInput = await (0,
|
|
2969
|
+
const parsedInput = await (0, import_provider_utils28.validateTypes)({
|
|
2774
2970
|
value: part.input,
|
|
2775
2971
|
schema: applyPatchInputSchema
|
|
2776
2972
|
});
|
|
@@ -2813,9 +3009,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2813
3009
|
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
2814
3010
|
part.toolName
|
|
2815
3011
|
);
|
|
3012
|
+
if (resolvedResultToolName === "tool_search") {
|
|
3013
|
+
const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
3014
|
+
if (store) {
|
|
3015
|
+
input.push({ type: "item_reference", id: itemId });
|
|
3016
|
+
} else if (part.output.type === "json") {
|
|
3017
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
3018
|
+
value: part.output.value,
|
|
3019
|
+
schema: toolSearchOutputSchema
|
|
3020
|
+
});
|
|
3021
|
+
input.push({
|
|
3022
|
+
type: "tool_search_output",
|
|
3023
|
+
id: itemId,
|
|
3024
|
+
execution: "server",
|
|
3025
|
+
call_id: null,
|
|
3026
|
+
status: "completed",
|
|
3027
|
+
tools: parsedOutput.tools
|
|
3028
|
+
});
|
|
3029
|
+
}
|
|
3030
|
+
break;
|
|
3031
|
+
}
|
|
2816
3032
|
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2817
3033
|
if (part.output.type === "json") {
|
|
2818
|
-
const parsedOutput = await (0,
|
|
3034
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
2819
3035
|
value: part.output.value,
|
|
2820
3036
|
schema: shellOutputSchema
|
|
2821
3037
|
});
|
|
@@ -2835,7 +3051,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2835
3051
|
break;
|
|
2836
3052
|
}
|
|
2837
3053
|
if (store) {
|
|
2838
|
-
const itemId = (
|
|
3054
|
+
const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
|
|
2839
3055
|
input.push({ type: "item_reference", id: itemId });
|
|
2840
3056
|
} else {
|
|
2841
3057
|
warnings.push({
|
|
@@ -2846,7 +3062,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2846
3062
|
break;
|
|
2847
3063
|
}
|
|
2848
3064
|
case "reasoning": {
|
|
2849
|
-
const providerOptions = await (0,
|
|
3065
|
+
const providerOptions = await (0, import_provider_utils28.parseProviderOptions)({
|
|
2850
3066
|
provider: providerOptionsName,
|
|
2851
3067
|
providerOptions: part.providerOptions,
|
|
2852
3068
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2918,6 +3134,28 @@ async function convertToOpenAIResponsesInput({
|
|
|
2918
3134
|
}
|
|
2919
3135
|
break;
|
|
2920
3136
|
}
|
|
3137
|
+
case "custom": {
|
|
3138
|
+
if (part.kind === "openai.compaction") {
|
|
3139
|
+
const providerOpts = (_n = part.providerOptions) == null ? void 0 : _n[providerOptionsName];
|
|
3140
|
+
const id = providerOpts == null ? void 0 : providerOpts.itemId;
|
|
3141
|
+
if (hasConversation && id != null) {
|
|
3142
|
+
break;
|
|
3143
|
+
}
|
|
3144
|
+
if (store && id != null) {
|
|
3145
|
+
input.push({ type: "item_reference", id });
|
|
3146
|
+
break;
|
|
3147
|
+
}
|
|
3148
|
+
const encryptedContent = providerOpts == null ? void 0 : providerOpts.encryptedContent;
|
|
3149
|
+
if (id != null) {
|
|
3150
|
+
input.push({
|
|
3151
|
+
type: "compaction",
|
|
3152
|
+
id,
|
|
3153
|
+
encrypted_content: encryptedContent
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
break;
|
|
3158
|
+
}
|
|
2921
3159
|
}
|
|
2922
3160
|
}
|
|
2923
3161
|
break;
|
|
@@ -2945,7 +3183,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2945
3183
|
}
|
|
2946
3184
|
const output = part.output;
|
|
2947
3185
|
if (output.type === "execution-denied") {
|
|
2948
|
-
const approvalId = (
|
|
3186
|
+
const approvalId = (_p = (_o = output.providerOptions) == null ? void 0 : _o.openai) == null ? void 0 : _p.approvalId;
|
|
2949
3187
|
if (approvalId) {
|
|
2950
3188
|
continue;
|
|
2951
3189
|
}
|
|
@@ -2953,8 +3191,22 @@ async function convertToOpenAIResponsesInput({
|
|
|
2953
3191
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2954
3192
|
part.toolName
|
|
2955
3193
|
);
|
|
3194
|
+
if (resolvedToolName === "tool_search" && output.type === "json") {
|
|
3195
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
3196
|
+
value: output.value,
|
|
3197
|
+
schema: toolSearchOutputSchema
|
|
3198
|
+
});
|
|
3199
|
+
input.push({
|
|
3200
|
+
type: "tool_search_output",
|
|
3201
|
+
execution: "client",
|
|
3202
|
+
call_id: part.toolCallId,
|
|
3203
|
+
status: "completed",
|
|
3204
|
+
tools: parsedOutput.tools
|
|
3205
|
+
});
|
|
3206
|
+
continue;
|
|
3207
|
+
}
|
|
2956
3208
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2957
|
-
const parsedOutput = await (0,
|
|
3209
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
2958
3210
|
value: output.value,
|
|
2959
3211
|
schema: localShellOutputSchema
|
|
2960
3212
|
});
|
|
@@ -2966,7 +3218,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2966
3218
|
continue;
|
|
2967
3219
|
}
|
|
2968
3220
|
if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
|
|
2969
|
-
const parsedOutput = await (0,
|
|
3221
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
2970
3222
|
value: output.value,
|
|
2971
3223
|
schema: shellOutputSchema
|
|
2972
3224
|
});
|
|
@@ -2985,7 +3237,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2985
3237
|
continue;
|
|
2986
3238
|
}
|
|
2987
3239
|
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
2988
|
-
const parsedOutput = await (0,
|
|
3240
|
+
const parsedOutput = await (0, import_provider_utils28.validateTypes)({
|
|
2989
3241
|
value: output.value,
|
|
2990
3242
|
schema: applyPatchOutputSchema
|
|
2991
3243
|
});
|
|
@@ -3005,7 +3257,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3005
3257
|
outputValue = output.value;
|
|
3006
3258
|
break;
|
|
3007
3259
|
case "execution-denied":
|
|
3008
|
-
outputValue = (
|
|
3260
|
+
outputValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
|
|
3009
3261
|
break;
|
|
3010
3262
|
case "json":
|
|
3011
3263
|
case "error-json":
|
|
@@ -3033,6 +3285,11 @@ async function convertToOpenAIResponsesInput({
|
|
|
3033
3285
|
filename: (_a2 = item.filename) != null ? _a2 : "data",
|
|
3034
3286
|
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3035
3287
|
};
|
|
3288
|
+
case "file-url":
|
|
3289
|
+
return {
|
|
3290
|
+
type: "input_file",
|
|
3291
|
+
file_url: item.url
|
|
3292
|
+
};
|
|
3036
3293
|
default:
|
|
3037
3294
|
warnings.push({
|
|
3038
3295
|
type: "other",
|
|
@@ -3040,7 +3297,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3040
3297
|
});
|
|
3041
3298
|
return void 0;
|
|
3042
3299
|
}
|
|
3043
|
-
}).filter(
|
|
3300
|
+
}).filter(import_provider_utils28.isNonNullable);
|
|
3044
3301
|
break;
|
|
3045
3302
|
default:
|
|
3046
3303
|
outputValue = "";
|
|
@@ -3059,7 +3316,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3059
3316
|
contentValue = output.value;
|
|
3060
3317
|
break;
|
|
3061
3318
|
case "execution-denied":
|
|
3062
|
-
contentValue = (
|
|
3319
|
+
contentValue = (_r = output.reason) != null ? _r : "Tool execution denied.";
|
|
3063
3320
|
break;
|
|
3064
3321
|
case "json":
|
|
3065
3322
|
case "error-json":
|
|
@@ -3091,6 +3348,12 @@ async function convertToOpenAIResponsesInput({
|
|
|
3091
3348
|
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3092
3349
|
};
|
|
3093
3350
|
}
|
|
3351
|
+
case "file-url": {
|
|
3352
|
+
return {
|
|
3353
|
+
type: "input_file",
|
|
3354
|
+
file_url: item.url
|
|
3355
|
+
};
|
|
3356
|
+
}
|
|
3094
3357
|
default: {
|
|
3095
3358
|
warnings.push({
|
|
3096
3359
|
type: "other",
|
|
@@ -3099,7 +3362,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3099
3362
|
return void 0;
|
|
3100
3363
|
}
|
|
3101
3364
|
}
|
|
3102
|
-
}).filter(
|
|
3365
|
+
}).filter(import_provider_utils28.isNonNullable);
|
|
3103
3366
|
break;
|
|
3104
3367
|
}
|
|
3105
3368
|
input.push({
|
|
@@ -3116,11 +3379,22 @@ async function convertToOpenAIResponsesInput({
|
|
|
3116
3379
|
}
|
|
3117
3380
|
}
|
|
3118
3381
|
}
|
|
3382
|
+
if (!store && input.some(
|
|
3383
|
+
(item) => "type" in item && item.type === "reasoning" && item.encrypted_content == null
|
|
3384
|
+
)) {
|
|
3385
|
+
warnings.push({
|
|
3386
|
+
type: "other",
|
|
3387
|
+
message: "Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts."
|
|
3388
|
+
});
|
|
3389
|
+
input = input.filter(
|
|
3390
|
+
(item) => !("type" in item) || item.type !== "reasoning" || item.encrypted_content != null
|
|
3391
|
+
);
|
|
3392
|
+
}
|
|
3119
3393
|
return { input, warnings };
|
|
3120
3394
|
}
|
|
3121
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3122
|
-
itemId:
|
|
3123
|
-
reasoningEncryptedContent:
|
|
3395
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v422.z.object({
|
|
3396
|
+
itemId: import_v422.z.string().nullish(),
|
|
3397
|
+
reasoningEncryptedContent: import_v422.z.string().nullish()
|
|
3124
3398
|
});
|
|
3125
3399
|
|
|
3126
3400
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3142,483 +3416,552 @@ function mapOpenAIResponseFinishReason({
|
|
|
3142
3416
|
}
|
|
3143
3417
|
|
|
3144
3418
|
// src/responses/openai-responses-api.ts
|
|
3145
|
-
var
|
|
3146
|
-
var
|
|
3147
|
-
var
|
|
3148
|
-
() =>
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3419
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
3420
|
+
var import_v423 = require("zod/v4");
|
|
3421
|
+
var jsonValueSchema2 = import_v423.z.lazy(
|
|
3422
|
+
() => import_v423.z.union([
|
|
3423
|
+
import_v423.z.string(),
|
|
3424
|
+
import_v423.z.number(),
|
|
3425
|
+
import_v423.z.boolean(),
|
|
3426
|
+
import_v423.z.null(),
|
|
3427
|
+
import_v423.z.array(jsonValueSchema2),
|
|
3428
|
+
import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional())
|
|
3429
|
+
])
|
|
3430
|
+
);
|
|
3431
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils29.lazySchema)(
|
|
3432
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
3433
|
+
import_v423.z.union([
|
|
3434
|
+
import_v423.z.object({
|
|
3435
|
+
type: import_v423.z.literal("response.output_text.delta"),
|
|
3436
|
+
item_id: import_v423.z.string(),
|
|
3437
|
+
delta: import_v423.z.string(),
|
|
3438
|
+
logprobs: import_v423.z.array(
|
|
3439
|
+
import_v423.z.object({
|
|
3440
|
+
token: import_v423.z.string(),
|
|
3441
|
+
logprob: import_v423.z.number(),
|
|
3442
|
+
top_logprobs: import_v423.z.array(
|
|
3443
|
+
import_v423.z.object({
|
|
3444
|
+
token: import_v423.z.string(),
|
|
3445
|
+
logprob: import_v423.z.number()
|
|
3162
3446
|
})
|
|
3163
3447
|
)
|
|
3164
3448
|
})
|
|
3165
3449
|
).nullish()
|
|
3166
3450
|
}),
|
|
3167
|
-
|
|
3168
|
-
type:
|
|
3169
|
-
response:
|
|
3170
|
-
incomplete_details:
|
|
3171
|
-
usage:
|
|
3172
|
-
input_tokens:
|
|
3173
|
-
input_tokens_details:
|
|
3174
|
-
output_tokens:
|
|
3175
|
-
output_tokens_details:
|
|
3451
|
+
import_v423.z.object({
|
|
3452
|
+
type: import_v423.z.enum(["response.completed", "response.incomplete"]),
|
|
3453
|
+
response: import_v423.z.object({
|
|
3454
|
+
incomplete_details: import_v423.z.object({ reason: import_v423.z.string() }).nullish(),
|
|
3455
|
+
usage: import_v423.z.object({
|
|
3456
|
+
input_tokens: import_v423.z.number(),
|
|
3457
|
+
input_tokens_details: import_v423.z.object({ cached_tokens: import_v423.z.number().nullish() }).nullish(),
|
|
3458
|
+
output_tokens: import_v423.z.number(),
|
|
3459
|
+
output_tokens_details: import_v423.z.object({ reasoning_tokens: import_v423.z.number().nullish() }).nullish()
|
|
3176
3460
|
}),
|
|
3177
|
-
service_tier:
|
|
3461
|
+
service_tier: import_v423.z.string().nullish()
|
|
3178
3462
|
})
|
|
3179
3463
|
}),
|
|
3180
|
-
|
|
3181
|
-
type:
|
|
3182
|
-
response:
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3464
|
+
import_v423.z.object({
|
|
3465
|
+
type: import_v423.z.literal("response.failed"),
|
|
3466
|
+
response: import_v423.z.object({
|
|
3467
|
+
error: import_v423.z.object({
|
|
3468
|
+
code: import_v423.z.string().nullish(),
|
|
3469
|
+
message: import_v423.z.string()
|
|
3470
|
+
}).nullish(),
|
|
3471
|
+
incomplete_details: import_v423.z.object({ reason: import_v423.z.string() }).nullish(),
|
|
3472
|
+
usage: import_v423.z.object({
|
|
3473
|
+
input_tokens: import_v423.z.number(),
|
|
3474
|
+
input_tokens_details: import_v423.z.object({ cached_tokens: import_v423.z.number().nullish() }).nullish(),
|
|
3475
|
+
output_tokens: import_v423.z.number(),
|
|
3476
|
+
output_tokens_details: import_v423.z.object({ reasoning_tokens: import_v423.z.number().nullish() }).nullish()
|
|
3477
|
+
}).nullish(),
|
|
3478
|
+
service_tier: import_v423.z.string().nullish()
|
|
3187
3479
|
})
|
|
3188
3480
|
}),
|
|
3189
|
-
|
|
3190
|
-
type:
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3481
|
+
import_v423.z.object({
|
|
3482
|
+
type: import_v423.z.literal("response.created"),
|
|
3483
|
+
response: import_v423.z.object({
|
|
3484
|
+
id: import_v423.z.string(),
|
|
3485
|
+
created_at: import_v423.z.number(),
|
|
3486
|
+
model: import_v423.z.string(),
|
|
3487
|
+
service_tier: import_v423.z.string().nullish()
|
|
3488
|
+
})
|
|
3489
|
+
}),
|
|
3490
|
+
import_v423.z.object({
|
|
3491
|
+
type: import_v423.z.literal("response.output_item.added"),
|
|
3492
|
+
output_index: import_v423.z.number(),
|
|
3493
|
+
item: import_v423.z.discriminatedUnion("type", [
|
|
3494
|
+
import_v423.z.object({
|
|
3495
|
+
type: import_v423.z.literal("message"),
|
|
3496
|
+
id: import_v423.z.string(),
|
|
3497
|
+
phase: import_v423.z.enum(["commentary", "final_answer"]).nullish()
|
|
3197
3498
|
}),
|
|
3198
|
-
|
|
3199
|
-
type:
|
|
3200
|
-
id:
|
|
3201
|
-
encrypted_content:
|
|
3499
|
+
import_v423.z.object({
|
|
3500
|
+
type: import_v423.z.literal("reasoning"),
|
|
3501
|
+
id: import_v423.z.string(),
|
|
3502
|
+
encrypted_content: import_v423.z.string().nullish()
|
|
3202
3503
|
}),
|
|
3203
|
-
|
|
3204
|
-
type:
|
|
3205
|
-
id:
|
|
3206
|
-
call_id:
|
|
3207
|
-
name:
|
|
3208
|
-
arguments:
|
|
3504
|
+
import_v423.z.object({
|
|
3505
|
+
type: import_v423.z.literal("function_call"),
|
|
3506
|
+
id: import_v423.z.string(),
|
|
3507
|
+
call_id: import_v423.z.string(),
|
|
3508
|
+
name: import_v423.z.string(),
|
|
3509
|
+
arguments: import_v423.z.string()
|
|
3209
3510
|
}),
|
|
3210
|
-
|
|
3211
|
-
type:
|
|
3212
|
-
id:
|
|
3213
|
-
status:
|
|
3511
|
+
import_v423.z.object({
|
|
3512
|
+
type: import_v423.z.literal("web_search_call"),
|
|
3513
|
+
id: import_v423.z.string(),
|
|
3514
|
+
status: import_v423.z.string()
|
|
3214
3515
|
}),
|
|
3215
|
-
|
|
3216
|
-
type:
|
|
3217
|
-
id:
|
|
3218
|
-
status:
|
|
3516
|
+
import_v423.z.object({
|
|
3517
|
+
type: import_v423.z.literal("computer_call"),
|
|
3518
|
+
id: import_v423.z.string(),
|
|
3519
|
+
status: import_v423.z.string()
|
|
3219
3520
|
}),
|
|
3220
|
-
|
|
3221
|
-
type:
|
|
3222
|
-
id:
|
|
3521
|
+
import_v423.z.object({
|
|
3522
|
+
type: import_v423.z.literal("file_search_call"),
|
|
3523
|
+
id: import_v423.z.string()
|
|
3223
3524
|
}),
|
|
3224
|
-
|
|
3225
|
-
type:
|
|
3226
|
-
id:
|
|
3525
|
+
import_v423.z.object({
|
|
3526
|
+
type: import_v423.z.literal("image_generation_call"),
|
|
3527
|
+
id: import_v423.z.string()
|
|
3227
3528
|
}),
|
|
3228
|
-
|
|
3229
|
-
type:
|
|
3230
|
-
id:
|
|
3231
|
-
container_id:
|
|
3232
|
-
code:
|
|
3233
|
-
outputs:
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3529
|
+
import_v423.z.object({
|
|
3530
|
+
type: import_v423.z.literal("code_interpreter_call"),
|
|
3531
|
+
id: import_v423.z.string(),
|
|
3532
|
+
container_id: import_v423.z.string(),
|
|
3533
|
+
code: import_v423.z.string().nullable(),
|
|
3534
|
+
outputs: import_v423.z.array(
|
|
3535
|
+
import_v423.z.discriminatedUnion("type", [
|
|
3536
|
+
import_v423.z.object({ type: import_v423.z.literal("logs"), logs: import_v423.z.string() }),
|
|
3537
|
+
import_v423.z.object({ type: import_v423.z.literal("image"), url: import_v423.z.string() })
|
|
3237
3538
|
])
|
|
3238
3539
|
).nullable(),
|
|
3239
|
-
status:
|
|
3540
|
+
status: import_v423.z.string()
|
|
3240
3541
|
}),
|
|
3241
|
-
|
|
3242
|
-
type:
|
|
3243
|
-
id:
|
|
3244
|
-
status:
|
|
3245
|
-
approval_request_id:
|
|
3542
|
+
import_v423.z.object({
|
|
3543
|
+
type: import_v423.z.literal("mcp_call"),
|
|
3544
|
+
id: import_v423.z.string(),
|
|
3545
|
+
status: import_v423.z.string(),
|
|
3546
|
+
approval_request_id: import_v423.z.string().nullish()
|
|
3246
3547
|
}),
|
|
3247
|
-
|
|
3248
|
-
type:
|
|
3249
|
-
id:
|
|
3548
|
+
import_v423.z.object({
|
|
3549
|
+
type: import_v423.z.literal("mcp_list_tools"),
|
|
3550
|
+
id: import_v423.z.string()
|
|
3250
3551
|
}),
|
|
3251
|
-
|
|
3252
|
-
type:
|
|
3253
|
-
id:
|
|
3552
|
+
import_v423.z.object({
|
|
3553
|
+
type: import_v423.z.literal("mcp_approval_request"),
|
|
3554
|
+
id: import_v423.z.string()
|
|
3254
3555
|
}),
|
|
3255
|
-
|
|
3256
|
-
type:
|
|
3257
|
-
id:
|
|
3258
|
-
call_id:
|
|
3259
|
-
status:
|
|
3260
|
-
operation:
|
|
3261
|
-
|
|
3262
|
-
type:
|
|
3263
|
-
path:
|
|
3264
|
-
diff:
|
|
3556
|
+
import_v423.z.object({
|
|
3557
|
+
type: import_v423.z.literal("apply_patch_call"),
|
|
3558
|
+
id: import_v423.z.string(),
|
|
3559
|
+
call_id: import_v423.z.string(),
|
|
3560
|
+
status: import_v423.z.enum(["in_progress", "completed"]),
|
|
3561
|
+
operation: import_v423.z.discriminatedUnion("type", [
|
|
3562
|
+
import_v423.z.object({
|
|
3563
|
+
type: import_v423.z.literal("create_file"),
|
|
3564
|
+
path: import_v423.z.string(),
|
|
3565
|
+
diff: import_v423.z.string()
|
|
3265
3566
|
}),
|
|
3266
|
-
|
|
3267
|
-
type:
|
|
3268
|
-
path:
|
|
3567
|
+
import_v423.z.object({
|
|
3568
|
+
type: import_v423.z.literal("delete_file"),
|
|
3569
|
+
path: import_v423.z.string()
|
|
3269
3570
|
}),
|
|
3270
|
-
|
|
3271
|
-
type:
|
|
3272
|
-
path:
|
|
3273
|
-
diff:
|
|
3571
|
+
import_v423.z.object({
|
|
3572
|
+
type: import_v423.z.literal("update_file"),
|
|
3573
|
+
path: import_v423.z.string(),
|
|
3574
|
+
diff: import_v423.z.string()
|
|
3274
3575
|
})
|
|
3275
3576
|
])
|
|
3276
3577
|
}),
|
|
3277
|
-
|
|
3278
|
-
type:
|
|
3279
|
-
id:
|
|
3280
|
-
call_id:
|
|
3281
|
-
name:
|
|
3282
|
-
input:
|
|
3578
|
+
import_v423.z.object({
|
|
3579
|
+
type: import_v423.z.literal("custom_tool_call"),
|
|
3580
|
+
id: import_v423.z.string(),
|
|
3581
|
+
call_id: import_v423.z.string(),
|
|
3582
|
+
name: import_v423.z.string(),
|
|
3583
|
+
input: import_v423.z.string()
|
|
3283
3584
|
}),
|
|
3284
|
-
|
|
3285
|
-
type:
|
|
3286
|
-
id:
|
|
3287
|
-
call_id:
|
|
3288
|
-
status:
|
|
3289
|
-
action:
|
|
3290
|
-
commands:
|
|
3585
|
+
import_v423.z.object({
|
|
3586
|
+
type: import_v423.z.literal("shell_call"),
|
|
3587
|
+
id: import_v423.z.string(),
|
|
3588
|
+
call_id: import_v423.z.string(),
|
|
3589
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3590
|
+
action: import_v423.z.object({
|
|
3591
|
+
commands: import_v423.z.array(import_v423.z.string())
|
|
3291
3592
|
})
|
|
3292
3593
|
}),
|
|
3293
|
-
|
|
3294
|
-
type:
|
|
3295
|
-
id:
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3594
|
+
import_v423.z.object({
|
|
3595
|
+
type: import_v423.z.literal("compaction"),
|
|
3596
|
+
id: import_v423.z.string(),
|
|
3597
|
+
encrypted_content: import_v423.z.string().nullish()
|
|
3598
|
+
}),
|
|
3599
|
+
import_v423.z.object({
|
|
3600
|
+
type: import_v423.z.literal("shell_call_output"),
|
|
3601
|
+
id: import_v423.z.string(),
|
|
3602
|
+
call_id: import_v423.z.string(),
|
|
3603
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3604
|
+
output: import_v423.z.array(
|
|
3605
|
+
import_v423.z.object({
|
|
3606
|
+
stdout: import_v423.z.string(),
|
|
3607
|
+
stderr: import_v423.z.string(),
|
|
3608
|
+
outcome: import_v423.z.discriminatedUnion("type", [
|
|
3609
|
+
import_v423.z.object({ type: import_v423.z.literal("timeout") }),
|
|
3610
|
+
import_v423.z.object({
|
|
3611
|
+
type: import_v423.z.literal("exit"),
|
|
3612
|
+
exit_code: import_v423.z.number()
|
|
3307
3613
|
})
|
|
3308
3614
|
])
|
|
3309
3615
|
})
|
|
3310
3616
|
)
|
|
3617
|
+
}),
|
|
3618
|
+
import_v423.z.object({
|
|
3619
|
+
type: import_v423.z.literal("tool_search_call"),
|
|
3620
|
+
id: import_v423.z.string(),
|
|
3621
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
3622
|
+
call_id: import_v423.z.string().nullable(),
|
|
3623
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3624
|
+
arguments: import_v423.z.unknown()
|
|
3625
|
+
}),
|
|
3626
|
+
import_v423.z.object({
|
|
3627
|
+
type: import_v423.z.literal("tool_search_output"),
|
|
3628
|
+
id: import_v423.z.string(),
|
|
3629
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
3630
|
+
call_id: import_v423.z.string().nullable(),
|
|
3631
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3632
|
+
tools: import_v423.z.array(import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional()))
|
|
3311
3633
|
})
|
|
3312
3634
|
])
|
|
3313
3635
|
}),
|
|
3314
|
-
|
|
3315
|
-
type:
|
|
3316
|
-
output_index:
|
|
3317
|
-
item:
|
|
3318
|
-
|
|
3319
|
-
type:
|
|
3320
|
-
id:
|
|
3321
|
-
phase:
|
|
3636
|
+
import_v423.z.object({
|
|
3637
|
+
type: import_v423.z.literal("response.output_item.done"),
|
|
3638
|
+
output_index: import_v423.z.number(),
|
|
3639
|
+
item: import_v423.z.discriminatedUnion("type", [
|
|
3640
|
+
import_v423.z.object({
|
|
3641
|
+
type: import_v423.z.literal("message"),
|
|
3642
|
+
id: import_v423.z.string(),
|
|
3643
|
+
phase: import_v423.z.enum(["commentary", "final_answer"]).nullish()
|
|
3322
3644
|
}),
|
|
3323
|
-
|
|
3324
|
-
type:
|
|
3325
|
-
id:
|
|
3326
|
-
encrypted_content:
|
|
3645
|
+
import_v423.z.object({
|
|
3646
|
+
type: import_v423.z.literal("reasoning"),
|
|
3647
|
+
id: import_v423.z.string(),
|
|
3648
|
+
encrypted_content: import_v423.z.string().nullish()
|
|
3327
3649
|
}),
|
|
3328
|
-
|
|
3329
|
-
type:
|
|
3330
|
-
id:
|
|
3331
|
-
call_id:
|
|
3332
|
-
name:
|
|
3333
|
-
arguments:
|
|
3334
|
-
status:
|
|
3650
|
+
import_v423.z.object({
|
|
3651
|
+
type: import_v423.z.literal("function_call"),
|
|
3652
|
+
id: import_v423.z.string(),
|
|
3653
|
+
call_id: import_v423.z.string(),
|
|
3654
|
+
name: import_v423.z.string(),
|
|
3655
|
+
arguments: import_v423.z.string(),
|
|
3656
|
+
status: import_v423.z.literal("completed")
|
|
3335
3657
|
}),
|
|
3336
|
-
|
|
3337
|
-
type:
|
|
3338
|
-
id:
|
|
3339
|
-
call_id:
|
|
3340
|
-
name:
|
|
3341
|
-
input:
|
|
3342
|
-
status:
|
|
3658
|
+
import_v423.z.object({
|
|
3659
|
+
type: import_v423.z.literal("custom_tool_call"),
|
|
3660
|
+
id: import_v423.z.string(),
|
|
3661
|
+
call_id: import_v423.z.string(),
|
|
3662
|
+
name: import_v423.z.string(),
|
|
3663
|
+
input: import_v423.z.string(),
|
|
3664
|
+
status: import_v423.z.literal("completed")
|
|
3343
3665
|
}),
|
|
3344
|
-
|
|
3345
|
-
type:
|
|
3346
|
-
id:
|
|
3347
|
-
code:
|
|
3348
|
-
container_id:
|
|
3349
|
-
outputs:
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3666
|
+
import_v423.z.object({
|
|
3667
|
+
type: import_v423.z.literal("code_interpreter_call"),
|
|
3668
|
+
id: import_v423.z.string(),
|
|
3669
|
+
code: import_v423.z.string().nullable(),
|
|
3670
|
+
container_id: import_v423.z.string(),
|
|
3671
|
+
outputs: import_v423.z.array(
|
|
3672
|
+
import_v423.z.discriminatedUnion("type", [
|
|
3673
|
+
import_v423.z.object({ type: import_v423.z.literal("logs"), logs: import_v423.z.string() }),
|
|
3674
|
+
import_v423.z.object({ type: import_v423.z.literal("image"), url: import_v423.z.string() })
|
|
3353
3675
|
])
|
|
3354
3676
|
).nullable()
|
|
3355
3677
|
}),
|
|
3356
|
-
|
|
3357
|
-
type:
|
|
3358
|
-
id:
|
|
3359
|
-
result:
|
|
3678
|
+
import_v423.z.object({
|
|
3679
|
+
type: import_v423.z.literal("image_generation_call"),
|
|
3680
|
+
id: import_v423.z.string(),
|
|
3681
|
+
result: import_v423.z.string()
|
|
3360
3682
|
}),
|
|
3361
|
-
|
|
3362
|
-
type:
|
|
3363
|
-
id:
|
|
3364
|
-
status:
|
|
3365
|
-
action:
|
|
3366
|
-
|
|
3367
|
-
type:
|
|
3368
|
-
query:
|
|
3369
|
-
sources:
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3683
|
+
import_v423.z.object({
|
|
3684
|
+
type: import_v423.z.literal("web_search_call"),
|
|
3685
|
+
id: import_v423.z.string(),
|
|
3686
|
+
status: import_v423.z.string(),
|
|
3687
|
+
action: import_v423.z.discriminatedUnion("type", [
|
|
3688
|
+
import_v423.z.object({
|
|
3689
|
+
type: import_v423.z.literal("search"),
|
|
3690
|
+
query: import_v423.z.string().nullish(),
|
|
3691
|
+
sources: import_v423.z.array(
|
|
3692
|
+
import_v423.z.discriminatedUnion("type", [
|
|
3693
|
+
import_v423.z.object({ type: import_v423.z.literal("url"), url: import_v423.z.string() }),
|
|
3694
|
+
import_v423.z.object({ type: import_v423.z.literal("api"), name: import_v423.z.string() })
|
|
3373
3695
|
])
|
|
3374
3696
|
).nullish()
|
|
3375
3697
|
}),
|
|
3376
|
-
|
|
3377
|
-
type:
|
|
3378
|
-
url:
|
|
3698
|
+
import_v423.z.object({
|
|
3699
|
+
type: import_v423.z.literal("open_page"),
|
|
3700
|
+
url: import_v423.z.string().nullish()
|
|
3379
3701
|
}),
|
|
3380
|
-
|
|
3381
|
-
type:
|
|
3382
|
-
url:
|
|
3383
|
-
pattern:
|
|
3702
|
+
import_v423.z.object({
|
|
3703
|
+
type: import_v423.z.literal("find_in_page"),
|
|
3704
|
+
url: import_v423.z.string().nullish(),
|
|
3705
|
+
pattern: import_v423.z.string().nullish()
|
|
3384
3706
|
})
|
|
3385
3707
|
]).nullish()
|
|
3386
3708
|
}),
|
|
3387
|
-
|
|
3388
|
-
type:
|
|
3389
|
-
id:
|
|
3390
|
-
queries:
|
|
3391
|
-
results:
|
|
3392
|
-
|
|
3393
|
-
attributes:
|
|
3394
|
-
|
|
3395
|
-
|
|
3709
|
+
import_v423.z.object({
|
|
3710
|
+
type: import_v423.z.literal("file_search_call"),
|
|
3711
|
+
id: import_v423.z.string(),
|
|
3712
|
+
queries: import_v423.z.array(import_v423.z.string()),
|
|
3713
|
+
results: import_v423.z.array(
|
|
3714
|
+
import_v423.z.object({
|
|
3715
|
+
attributes: import_v423.z.record(
|
|
3716
|
+
import_v423.z.string(),
|
|
3717
|
+
import_v423.z.union([import_v423.z.string(), import_v423.z.number(), import_v423.z.boolean()])
|
|
3396
3718
|
),
|
|
3397
|
-
file_id:
|
|
3398
|
-
filename:
|
|
3399
|
-
score:
|
|
3400
|
-
text:
|
|
3719
|
+
file_id: import_v423.z.string(),
|
|
3720
|
+
filename: import_v423.z.string(),
|
|
3721
|
+
score: import_v423.z.number(),
|
|
3722
|
+
text: import_v423.z.string()
|
|
3401
3723
|
})
|
|
3402
3724
|
).nullish()
|
|
3403
3725
|
}),
|
|
3404
|
-
|
|
3405
|
-
type:
|
|
3406
|
-
id:
|
|
3407
|
-
call_id:
|
|
3408
|
-
action:
|
|
3409
|
-
type:
|
|
3410
|
-
command:
|
|
3411
|
-
timeout_ms:
|
|
3412
|
-
user:
|
|
3413
|
-
working_directory:
|
|
3414
|
-
env:
|
|
3726
|
+
import_v423.z.object({
|
|
3727
|
+
type: import_v423.z.literal("local_shell_call"),
|
|
3728
|
+
id: import_v423.z.string(),
|
|
3729
|
+
call_id: import_v423.z.string(),
|
|
3730
|
+
action: import_v423.z.object({
|
|
3731
|
+
type: import_v423.z.literal("exec"),
|
|
3732
|
+
command: import_v423.z.array(import_v423.z.string()),
|
|
3733
|
+
timeout_ms: import_v423.z.number().optional(),
|
|
3734
|
+
user: import_v423.z.string().optional(),
|
|
3735
|
+
working_directory: import_v423.z.string().optional(),
|
|
3736
|
+
env: import_v423.z.record(import_v423.z.string(), import_v423.z.string()).optional()
|
|
3415
3737
|
})
|
|
3416
3738
|
}),
|
|
3417
|
-
|
|
3418
|
-
type:
|
|
3419
|
-
id:
|
|
3420
|
-
status:
|
|
3739
|
+
import_v423.z.object({
|
|
3740
|
+
type: import_v423.z.literal("computer_call"),
|
|
3741
|
+
id: import_v423.z.string(),
|
|
3742
|
+
status: import_v423.z.literal("completed")
|
|
3421
3743
|
}),
|
|
3422
|
-
|
|
3423
|
-
type:
|
|
3424
|
-
id:
|
|
3425
|
-
status:
|
|
3426
|
-
arguments:
|
|
3427
|
-
name:
|
|
3428
|
-
server_label:
|
|
3429
|
-
output:
|
|
3430
|
-
error:
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
type:
|
|
3434
|
-
code:
|
|
3435
|
-
message:
|
|
3744
|
+
import_v423.z.object({
|
|
3745
|
+
type: import_v423.z.literal("mcp_call"),
|
|
3746
|
+
id: import_v423.z.string(),
|
|
3747
|
+
status: import_v423.z.string(),
|
|
3748
|
+
arguments: import_v423.z.string(),
|
|
3749
|
+
name: import_v423.z.string(),
|
|
3750
|
+
server_label: import_v423.z.string(),
|
|
3751
|
+
output: import_v423.z.string().nullish(),
|
|
3752
|
+
error: import_v423.z.union([
|
|
3753
|
+
import_v423.z.string(),
|
|
3754
|
+
import_v423.z.object({
|
|
3755
|
+
type: import_v423.z.string().optional(),
|
|
3756
|
+
code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
|
|
3757
|
+
message: import_v423.z.string().optional()
|
|
3436
3758
|
}).loose()
|
|
3437
3759
|
]).nullish(),
|
|
3438
|
-
approval_request_id:
|
|
3760
|
+
approval_request_id: import_v423.z.string().nullish()
|
|
3439
3761
|
}),
|
|
3440
|
-
|
|
3441
|
-
type:
|
|
3442
|
-
id:
|
|
3443
|
-
server_label:
|
|
3444
|
-
tools:
|
|
3445
|
-
|
|
3446
|
-
name:
|
|
3447
|
-
description:
|
|
3448
|
-
input_schema:
|
|
3449
|
-
annotations:
|
|
3762
|
+
import_v423.z.object({
|
|
3763
|
+
type: import_v423.z.literal("mcp_list_tools"),
|
|
3764
|
+
id: import_v423.z.string(),
|
|
3765
|
+
server_label: import_v423.z.string(),
|
|
3766
|
+
tools: import_v423.z.array(
|
|
3767
|
+
import_v423.z.object({
|
|
3768
|
+
name: import_v423.z.string(),
|
|
3769
|
+
description: import_v423.z.string().optional(),
|
|
3770
|
+
input_schema: import_v423.z.any(),
|
|
3771
|
+
annotations: import_v423.z.record(import_v423.z.string(), import_v423.z.unknown()).optional()
|
|
3450
3772
|
})
|
|
3451
3773
|
),
|
|
3452
|
-
error:
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
type:
|
|
3456
|
-
code:
|
|
3457
|
-
message:
|
|
3774
|
+
error: import_v423.z.union([
|
|
3775
|
+
import_v423.z.string(),
|
|
3776
|
+
import_v423.z.object({
|
|
3777
|
+
type: import_v423.z.string().optional(),
|
|
3778
|
+
code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
|
|
3779
|
+
message: import_v423.z.string().optional()
|
|
3458
3780
|
}).loose()
|
|
3459
3781
|
]).optional()
|
|
3460
3782
|
}),
|
|
3461
|
-
|
|
3462
|
-
type:
|
|
3463
|
-
id:
|
|
3464
|
-
server_label:
|
|
3465
|
-
name:
|
|
3466
|
-
arguments:
|
|
3467
|
-
approval_request_id:
|
|
3783
|
+
import_v423.z.object({
|
|
3784
|
+
type: import_v423.z.literal("mcp_approval_request"),
|
|
3785
|
+
id: import_v423.z.string(),
|
|
3786
|
+
server_label: import_v423.z.string(),
|
|
3787
|
+
name: import_v423.z.string(),
|
|
3788
|
+
arguments: import_v423.z.string(),
|
|
3789
|
+
approval_request_id: import_v423.z.string().optional()
|
|
3468
3790
|
}),
|
|
3469
|
-
|
|
3470
|
-
type:
|
|
3471
|
-
id:
|
|
3472
|
-
call_id:
|
|
3473
|
-
status:
|
|
3474
|
-
operation:
|
|
3475
|
-
|
|
3476
|
-
type:
|
|
3477
|
-
path:
|
|
3478
|
-
diff:
|
|
3791
|
+
import_v423.z.object({
|
|
3792
|
+
type: import_v423.z.literal("apply_patch_call"),
|
|
3793
|
+
id: import_v423.z.string(),
|
|
3794
|
+
call_id: import_v423.z.string(),
|
|
3795
|
+
status: import_v423.z.enum(["in_progress", "completed"]),
|
|
3796
|
+
operation: import_v423.z.discriminatedUnion("type", [
|
|
3797
|
+
import_v423.z.object({
|
|
3798
|
+
type: import_v423.z.literal("create_file"),
|
|
3799
|
+
path: import_v423.z.string(),
|
|
3800
|
+
diff: import_v423.z.string()
|
|
3479
3801
|
}),
|
|
3480
|
-
|
|
3481
|
-
type:
|
|
3482
|
-
path:
|
|
3802
|
+
import_v423.z.object({
|
|
3803
|
+
type: import_v423.z.literal("delete_file"),
|
|
3804
|
+
path: import_v423.z.string()
|
|
3483
3805
|
}),
|
|
3484
|
-
|
|
3485
|
-
type:
|
|
3486
|
-
path:
|
|
3487
|
-
diff:
|
|
3806
|
+
import_v423.z.object({
|
|
3807
|
+
type: import_v423.z.literal("update_file"),
|
|
3808
|
+
path: import_v423.z.string(),
|
|
3809
|
+
diff: import_v423.z.string()
|
|
3488
3810
|
})
|
|
3489
3811
|
])
|
|
3490
3812
|
}),
|
|
3491
|
-
|
|
3492
|
-
type:
|
|
3493
|
-
id:
|
|
3494
|
-
call_id:
|
|
3495
|
-
status:
|
|
3496
|
-
action:
|
|
3497
|
-
commands:
|
|
3813
|
+
import_v423.z.object({
|
|
3814
|
+
type: import_v423.z.literal("shell_call"),
|
|
3815
|
+
id: import_v423.z.string(),
|
|
3816
|
+
call_id: import_v423.z.string(),
|
|
3817
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3818
|
+
action: import_v423.z.object({
|
|
3819
|
+
commands: import_v423.z.array(import_v423.z.string())
|
|
3498
3820
|
})
|
|
3499
3821
|
}),
|
|
3500
|
-
|
|
3501
|
-
type:
|
|
3502
|
-
id:
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3822
|
+
import_v423.z.object({
|
|
3823
|
+
type: import_v423.z.literal("compaction"),
|
|
3824
|
+
id: import_v423.z.string(),
|
|
3825
|
+
encrypted_content: import_v423.z.string()
|
|
3826
|
+
}),
|
|
3827
|
+
import_v423.z.object({
|
|
3828
|
+
type: import_v423.z.literal("shell_call_output"),
|
|
3829
|
+
id: import_v423.z.string(),
|
|
3830
|
+
call_id: import_v423.z.string(),
|
|
3831
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3832
|
+
output: import_v423.z.array(
|
|
3833
|
+
import_v423.z.object({
|
|
3834
|
+
stdout: import_v423.z.string(),
|
|
3835
|
+
stderr: import_v423.z.string(),
|
|
3836
|
+
outcome: import_v423.z.discriminatedUnion("type", [
|
|
3837
|
+
import_v423.z.object({ type: import_v423.z.literal("timeout") }),
|
|
3838
|
+
import_v423.z.object({
|
|
3839
|
+
type: import_v423.z.literal("exit"),
|
|
3840
|
+
exit_code: import_v423.z.number()
|
|
3514
3841
|
})
|
|
3515
3842
|
])
|
|
3516
3843
|
})
|
|
3517
3844
|
)
|
|
3845
|
+
}),
|
|
3846
|
+
import_v423.z.object({
|
|
3847
|
+
type: import_v423.z.literal("tool_search_call"),
|
|
3848
|
+
id: import_v423.z.string(),
|
|
3849
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
3850
|
+
call_id: import_v423.z.string().nullable(),
|
|
3851
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3852
|
+
arguments: import_v423.z.unknown()
|
|
3853
|
+
}),
|
|
3854
|
+
import_v423.z.object({
|
|
3855
|
+
type: import_v423.z.literal("tool_search_output"),
|
|
3856
|
+
id: import_v423.z.string(),
|
|
3857
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
3858
|
+
call_id: import_v423.z.string().nullable(),
|
|
3859
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3860
|
+
tools: import_v423.z.array(import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional()))
|
|
3518
3861
|
})
|
|
3519
3862
|
])
|
|
3520
3863
|
}),
|
|
3521
|
-
|
|
3522
|
-
type:
|
|
3523
|
-
item_id:
|
|
3524
|
-
output_index:
|
|
3525
|
-
delta:
|
|
3864
|
+
import_v423.z.object({
|
|
3865
|
+
type: import_v423.z.literal("response.function_call_arguments.delta"),
|
|
3866
|
+
item_id: import_v423.z.string(),
|
|
3867
|
+
output_index: import_v423.z.number(),
|
|
3868
|
+
delta: import_v423.z.string()
|
|
3526
3869
|
}),
|
|
3527
|
-
|
|
3528
|
-
type:
|
|
3529
|
-
item_id:
|
|
3530
|
-
output_index:
|
|
3531
|
-
delta:
|
|
3870
|
+
import_v423.z.object({
|
|
3871
|
+
type: import_v423.z.literal("response.custom_tool_call_input.delta"),
|
|
3872
|
+
item_id: import_v423.z.string(),
|
|
3873
|
+
output_index: import_v423.z.number(),
|
|
3874
|
+
delta: import_v423.z.string()
|
|
3532
3875
|
}),
|
|
3533
|
-
|
|
3534
|
-
type:
|
|
3535
|
-
item_id:
|
|
3536
|
-
output_index:
|
|
3537
|
-
partial_image_b64:
|
|
3876
|
+
import_v423.z.object({
|
|
3877
|
+
type: import_v423.z.literal("response.image_generation_call.partial_image"),
|
|
3878
|
+
item_id: import_v423.z.string(),
|
|
3879
|
+
output_index: import_v423.z.number(),
|
|
3880
|
+
partial_image_b64: import_v423.z.string()
|
|
3538
3881
|
}),
|
|
3539
|
-
|
|
3540
|
-
type:
|
|
3541
|
-
item_id:
|
|
3542
|
-
output_index:
|
|
3543
|
-
delta:
|
|
3882
|
+
import_v423.z.object({
|
|
3883
|
+
type: import_v423.z.literal("response.code_interpreter_call_code.delta"),
|
|
3884
|
+
item_id: import_v423.z.string(),
|
|
3885
|
+
output_index: import_v423.z.number(),
|
|
3886
|
+
delta: import_v423.z.string()
|
|
3544
3887
|
}),
|
|
3545
|
-
|
|
3546
|
-
type:
|
|
3547
|
-
item_id:
|
|
3548
|
-
output_index:
|
|
3549
|
-
code:
|
|
3888
|
+
import_v423.z.object({
|
|
3889
|
+
type: import_v423.z.literal("response.code_interpreter_call_code.done"),
|
|
3890
|
+
item_id: import_v423.z.string(),
|
|
3891
|
+
output_index: import_v423.z.number(),
|
|
3892
|
+
code: import_v423.z.string()
|
|
3550
3893
|
}),
|
|
3551
|
-
|
|
3552
|
-
type:
|
|
3553
|
-
annotation:
|
|
3554
|
-
|
|
3555
|
-
type:
|
|
3556
|
-
start_index:
|
|
3557
|
-
end_index:
|
|
3558
|
-
url:
|
|
3559
|
-
title:
|
|
3894
|
+
import_v423.z.object({
|
|
3895
|
+
type: import_v423.z.literal("response.output_text.annotation.added"),
|
|
3896
|
+
annotation: import_v423.z.discriminatedUnion("type", [
|
|
3897
|
+
import_v423.z.object({
|
|
3898
|
+
type: import_v423.z.literal("url_citation"),
|
|
3899
|
+
start_index: import_v423.z.number(),
|
|
3900
|
+
end_index: import_v423.z.number(),
|
|
3901
|
+
url: import_v423.z.string(),
|
|
3902
|
+
title: import_v423.z.string()
|
|
3560
3903
|
}),
|
|
3561
|
-
|
|
3562
|
-
type:
|
|
3563
|
-
file_id:
|
|
3564
|
-
filename:
|
|
3565
|
-
index:
|
|
3904
|
+
import_v423.z.object({
|
|
3905
|
+
type: import_v423.z.literal("file_citation"),
|
|
3906
|
+
file_id: import_v423.z.string(),
|
|
3907
|
+
filename: import_v423.z.string(),
|
|
3908
|
+
index: import_v423.z.number()
|
|
3566
3909
|
}),
|
|
3567
|
-
|
|
3568
|
-
type:
|
|
3569
|
-
container_id:
|
|
3570
|
-
file_id:
|
|
3571
|
-
filename:
|
|
3572
|
-
start_index:
|
|
3573
|
-
end_index:
|
|
3910
|
+
import_v423.z.object({
|
|
3911
|
+
type: import_v423.z.literal("container_file_citation"),
|
|
3912
|
+
container_id: import_v423.z.string(),
|
|
3913
|
+
file_id: import_v423.z.string(),
|
|
3914
|
+
filename: import_v423.z.string(),
|
|
3915
|
+
start_index: import_v423.z.number(),
|
|
3916
|
+
end_index: import_v423.z.number()
|
|
3574
3917
|
}),
|
|
3575
|
-
|
|
3576
|
-
type:
|
|
3577
|
-
file_id:
|
|
3578
|
-
index:
|
|
3918
|
+
import_v423.z.object({
|
|
3919
|
+
type: import_v423.z.literal("file_path"),
|
|
3920
|
+
file_id: import_v423.z.string(),
|
|
3921
|
+
index: import_v423.z.number()
|
|
3579
3922
|
})
|
|
3580
3923
|
])
|
|
3581
3924
|
}),
|
|
3582
|
-
|
|
3583
|
-
type:
|
|
3584
|
-
item_id:
|
|
3585
|
-
summary_index:
|
|
3925
|
+
import_v423.z.object({
|
|
3926
|
+
type: import_v423.z.literal("response.reasoning_summary_part.added"),
|
|
3927
|
+
item_id: import_v423.z.string(),
|
|
3928
|
+
summary_index: import_v423.z.number()
|
|
3586
3929
|
}),
|
|
3587
|
-
|
|
3588
|
-
type:
|
|
3589
|
-
item_id:
|
|
3590
|
-
summary_index:
|
|
3591
|
-
delta:
|
|
3930
|
+
import_v423.z.object({
|
|
3931
|
+
type: import_v423.z.literal("response.reasoning_summary_text.delta"),
|
|
3932
|
+
item_id: import_v423.z.string(),
|
|
3933
|
+
summary_index: import_v423.z.number(),
|
|
3934
|
+
delta: import_v423.z.string()
|
|
3592
3935
|
}),
|
|
3593
|
-
|
|
3594
|
-
type:
|
|
3595
|
-
item_id:
|
|
3596
|
-
summary_index:
|
|
3936
|
+
import_v423.z.object({
|
|
3937
|
+
type: import_v423.z.literal("response.reasoning_summary_part.done"),
|
|
3938
|
+
item_id: import_v423.z.string(),
|
|
3939
|
+
summary_index: import_v423.z.number()
|
|
3597
3940
|
}),
|
|
3598
|
-
|
|
3599
|
-
type:
|
|
3600
|
-
item_id:
|
|
3601
|
-
output_index:
|
|
3602
|
-
delta:
|
|
3603
|
-
obfuscation:
|
|
3941
|
+
import_v423.z.object({
|
|
3942
|
+
type: import_v423.z.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3943
|
+
item_id: import_v423.z.string(),
|
|
3944
|
+
output_index: import_v423.z.number(),
|
|
3945
|
+
delta: import_v423.z.string(),
|
|
3946
|
+
obfuscation: import_v423.z.string().nullish()
|
|
3604
3947
|
}),
|
|
3605
|
-
|
|
3606
|
-
type:
|
|
3607
|
-
item_id:
|
|
3608
|
-
output_index:
|
|
3609
|
-
diff:
|
|
3948
|
+
import_v423.z.object({
|
|
3949
|
+
type: import_v423.z.literal("response.apply_patch_call_operation_diff.done"),
|
|
3950
|
+
item_id: import_v423.z.string(),
|
|
3951
|
+
output_index: import_v423.z.number(),
|
|
3952
|
+
diff: import_v423.z.string()
|
|
3610
3953
|
}),
|
|
3611
|
-
|
|
3612
|
-
type:
|
|
3613
|
-
sequence_number:
|
|
3614
|
-
error:
|
|
3615
|
-
type:
|
|
3616
|
-
code:
|
|
3617
|
-
message:
|
|
3618
|
-
param:
|
|
3954
|
+
import_v423.z.object({
|
|
3955
|
+
type: import_v423.z.literal("error"),
|
|
3956
|
+
sequence_number: import_v423.z.number(),
|
|
3957
|
+
error: import_v423.z.object({
|
|
3958
|
+
type: import_v423.z.string(),
|
|
3959
|
+
code: import_v423.z.string(),
|
|
3960
|
+
message: import_v423.z.string(),
|
|
3961
|
+
param: import_v423.z.string().nullish()
|
|
3619
3962
|
})
|
|
3620
3963
|
}),
|
|
3621
|
-
|
|
3964
|
+
import_v423.z.object({ type: import_v423.z.string() }).loose().transform((value) => ({
|
|
3622
3965
|
type: "unknown_chunk",
|
|
3623
3966
|
message: value.type
|
|
3624
3967
|
}))
|
|
@@ -3626,294 +3969,315 @@ var openaiResponsesChunkSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3626
3969
|
])
|
|
3627
3970
|
)
|
|
3628
3971
|
);
|
|
3629
|
-
var openaiResponsesResponseSchema = (0,
|
|
3630
|
-
() => (0,
|
|
3631
|
-
|
|
3632
|
-
id:
|
|
3633
|
-
created_at:
|
|
3634
|
-
error:
|
|
3635
|
-
message:
|
|
3636
|
-
type:
|
|
3637
|
-
param:
|
|
3638
|
-
code:
|
|
3972
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils29.lazySchema)(
|
|
3973
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
3974
|
+
import_v423.z.object({
|
|
3975
|
+
id: import_v423.z.string().optional(),
|
|
3976
|
+
created_at: import_v423.z.number().optional(),
|
|
3977
|
+
error: import_v423.z.object({
|
|
3978
|
+
message: import_v423.z.string(),
|
|
3979
|
+
type: import_v423.z.string(),
|
|
3980
|
+
param: import_v423.z.string().nullish(),
|
|
3981
|
+
code: import_v423.z.string()
|
|
3639
3982
|
}).nullish(),
|
|
3640
|
-
model:
|
|
3641
|
-
output:
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
type:
|
|
3645
|
-
role:
|
|
3646
|
-
id:
|
|
3647
|
-
phase:
|
|
3648
|
-
content:
|
|
3649
|
-
|
|
3650
|
-
type:
|
|
3651
|
-
text:
|
|
3652
|
-
logprobs:
|
|
3653
|
-
|
|
3654
|
-
token:
|
|
3655
|
-
logprob:
|
|
3656
|
-
top_logprobs:
|
|
3657
|
-
|
|
3658
|
-
token:
|
|
3659
|
-
logprob:
|
|
3983
|
+
model: import_v423.z.string().optional(),
|
|
3984
|
+
output: import_v423.z.array(
|
|
3985
|
+
import_v423.z.discriminatedUnion("type", [
|
|
3986
|
+
import_v423.z.object({
|
|
3987
|
+
type: import_v423.z.literal("message"),
|
|
3988
|
+
role: import_v423.z.literal("assistant"),
|
|
3989
|
+
id: import_v423.z.string(),
|
|
3990
|
+
phase: import_v423.z.enum(["commentary", "final_answer"]).nullish(),
|
|
3991
|
+
content: import_v423.z.array(
|
|
3992
|
+
import_v423.z.object({
|
|
3993
|
+
type: import_v423.z.literal("output_text"),
|
|
3994
|
+
text: import_v423.z.string(),
|
|
3995
|
+
logprobs: import_v423.z.array(
|
|
3996
|
+
import_v423.z.object({
|
|
3997
|
+
token: import_v423.z.string(),
|
|
3998
|
+
logprob: import_v423.z.number(),
|
|
3999
|
+
top_logprobs: import_v423.z.array(
|
|
4000
|
+
import_v423.z.object({
|
|
4001
|
+
token: import_v423.z.string(),
|
|
4002
|
+
logprob: import_v423.z.number()
|
|
3660
4003
|
})
|
|
3661
4004
|
)
|
|
3662
4005
|
})
|
|
3663
4006
|
).nullish(),
|
|
3664
|
-
annotations:
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
type:
|
|
3668
|
-
start_index:
|
|
3669
|
-
end_index:
|
|
3670
|
-
url:
|
|
3671
|
-
title:
|
|
4007
|
+
annotations: import_v423.z.array(
|
|
4008
|
+
import_v423.z.discriminatedUnion("type", [
|
|
4009
|
+
import_v423.z.object({
|
|
4010
|
+
type: import_v423.z.literal("url_citation"),
|
|
4011
|
+
start_index: import_v423.z.number(),
|
|
4012
|
+
end_index: import_v423.z.number(),
|
|
4013
|
+
url: import_v423.z.string(),
|
|
4014
|
+
title: import_v423.z.string()
|
|
3672
4015
|
}),
|
|
3673
|
-
|
|
3674
|
-
type:
|
|
3675
|
-
file_id:
|
|
3676
|
-
filename:
|
|
3677
|
-
index:
|
|
4016
|
+
import_v423.z.object({
|
|
4017
|
+
type: import_v423.z.literal("file_citation"),
|
|
4018
|
+
file_id: import_v423.z.string(),
|
|
4019
|
+
filename: import_v423.z.string(),
|
|
4020
|
+
index: import_v423.z.number()
|
|
3678
4021
|
}),
|
|
3679
|
-
|
|
3680
|
-
type:
|
|
3681
|
-
container_id:
|
|
3682
|
-
file_id:
|
|
3683
|
-
filename:
|
|
3684
|
-
start_index:
|
|
3685
|
-
end_index:
|
|
4022
|
+
import_v423.z.object({
|
|
4023
|
+
type: import_v423.z.literal("container_file_citation"),
|
|
4024
|
+
container_id: import_v423.z.string(),
|
|
4025
|
+
file_id: import_v423.z.string(),
|
|
4026
|
+
filename: import_v423.z.string(),
|
|
4027
|
+
start_index: import_v423.z.number(),
|
|
4028
|
+
end_index: import_v423.z.number()
|
|
3686
4029
|
}),
|
|
3687
|
-
|
|
3688
|
-
type:
|
|
3689
|
-
file_id:
|
|
3690
|
-
index:
|
|
4030
|
+
import_v423.z.object({
|
|
4031
|
+
type: import_v423.z.literal("file_path"),
|
|
4032
|
+
file_id: import_v423.z.string(),
|
|
4033
|
+
index: import_v423.z.number()
|
|
3691
4034
|
})
|
|
3692
4035
|
])
|
|
3693
4036
|
)
|
|
3694
4037
|
})
|
|
3695
4038
|
)
|
|
3696
4039
|
}),
|
|
3697
|
-
|
|
3698
|
-
type:
|
|
3699
|
-
id:
|
|
3700
|
-
status:
|
|
3701
|
-
action:
|
|
3702
|
-
|
|
3703
|
-
type:
|
|
3704
|
-
query:
|
|
3705
|
-
sources:
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
type:
|
|
3710
|
-
name:
|
|
4040
|
+
import_v423.z.object({
|
|
4041
|
+
type: import_v423.z.literal("web_search_call"),
|
|
4042
|
+
id: import_v423.z.string(),
|
|
4043
|
+
status: import_v423.z.string(),
|
|
4044
|
+
action: import_v423.z.discriminatedUnion("type", [
|
|
4045
|
+
import_v423.z.object({
|
|
4046
|
+
type: import_v423.z.literal("search"),
|
|
4047
|
+
query: import_v423.z.string().nullish(),
|
|
4048
|
+
sources: import_v423.z.array(
|
|
4049
|
+
import_v423.z.discriminatedUnion("type", [
|
|
4050
|
+
import_v423.z.object({ type: import_v423.z.literal("url"), url: import_v423.z.string() }),
|
|
4051
|
+
import_v423.z.object({
|
|
4052
|
+
type: import_v423.z.literal("api"),
|
|
4053
|
+
name: import_v423.z.string()
|
|
3711
4054
|
})
|
|
3712
4055
|
])
|
|
3713
4056
|
).nullish()
|
|
3714
4057
|
}),
|
|
3715
|
-
|
|
3716
|
-
type:
|
|
3717
|
-
url:
|
|
4058
|
+
import_v423.z.object({
|
|
4059
|
+
type: import_v423.z.literal("open_page"),
|
|
4060
|
+
url: import_v423.z.string().nullish()
|
|
3718
4061
|
}),
|
|
3719
|
-
|
|
3720
|
-
type:
|
|
3721
|
-
url:
|
|
3722
|
-
pattern:
|
|
4062
|
+
import_v423.z.object({
|
|
4063
|
+
type: import_v423.z.literal("find_in_page"),
|
|
4064
|
+
url: import_v423.z.string().nullish(),
|
|
4065
|
+
pattern: import_v423.z.string().nullish()
|
|
3723
4066
|
})
|
|
3724
4067
|
]).nullish()
|
|
3725
4068
|
}),
|
|
3726
|
-
|
|
3727
|
-
type:
|
|
3728
|
-
id:
|
|
3729
|
-
queries:
|
|
3730
|
-
results:
|
|
3731
|
-
|
|
3732
|
-
attributes:
|
|
3733
|
-
|
|
3734
|
-
|
|
4069
|
+
import_v423.z.object({
|
|
4070
|
+
type: import_v423.z.literal("file_search_call"),
|
|
4071
|
+
id: import_v423.z.string(),
|
|
4072
|
+
queries: import_v423.z.array(import_v423.z.string()),
|
|
4073
|
+
results: import_v423.z.array(
|
|
4074
|
+
import_v423.z.object({
|
|
4075
|
+
attributes: import_v423.z.record(
|
|
4076
|
+
import_v423.z.string(),
|
|
4077
|
+
import_v423.z.union([import_v423.z.string(), import_v423.z.number(), import_v423.z.boolean()])
|
|
3735
4078
|
),
|
|
3736
|
-
file_id:
|
|
3737
|
-
filename:
|
|
3738
|
-
score:
|
|
3739
|
-
text:
|
|
4079
|
+
file_id: import_v423.z.string(),
|
|
4080
|
+
filename: import_v423.z.string(),
|
|
4081
|
+
score: import_v423.z.number(),
|
|
4082
|
+
text: import_v423.z.string()
|
|
3740
4083
|
})
|
|
3741
4084
|
).nullish()
|
|
3742
4085
|
}),
|
|
3743
|
-
|
|
3744
|
-
type:
|
|
3745
|
-
id:
|
|
3746
|
-
code:
|
|
3747
|
-
container_id:
|
|
3748
|
-
outputs:
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
4086
|
+
import_v423.z.object({
|
|
4087
|
+
type: import_v423.z.literal("code_interpreter_call"),
|
|
4088
|
+
id: import_v423.z.string(),
|
|
4089
|
+
code: import_v423.z.string().nullable(),
|
|
4090
|
+
container_id: import_v423.z.string(),
|
|
4091
|
+
outputs: import_v423.z.array(
|
|
4092
|
+
import_v423.z.discriminatedUnion("type", [
|
|
4093
|
+
import_v423.z.object({ type: import_v423.z.literal("logs"), logs: import_v423.z.string() }),
|
|
4094
|
+
import_v423.z.object({ type: import_v423.z.literal("image"), url: import_v423.z.string() })
|
|
3752
4095
|
])
|
|
3753
4096
|
).nullable()
|
|
3754
4097
|
}),
|
|
3755
|
-
|
|
3756
|
-
type:
|
|
3757
|
-
id:
|
|
3758
|
-
result:
|
|
4098
|
+
import_v423.z.object({
|
|
4099
|
+
type: import_v423.z.literal("image_generation_call"),
|
|
4100
|
+
id: import_v423.z.string(),
|
|
4101
|
+
result: import_v423.z.string()
|
|
3759
4102
|
}),
|
|
3760
|
-
|
|
3761
|
-
type:
|
|
3762
|
-
id:
|
|
3763
|
-
call_id:
|
|
3764
|
-
action:
|
|
3765
|
-
type:
|
|
3766
|
-
command:
|
|
3767
|
-
timeout_ms:
|
|
3768
|
-
user:
|
|
3769
|
-
working_directory:
|
|
3770
|
-
env:
|
|
4103
|
+
import_v423.z.object({
|
|
4104
|
+
type: import_v423.z.literal("local_shell_call"),
|
|
4105
|
+
id: import_v423.z.string(),
|
|
4106
|
+
call_id: import_v423.z.string(),
|
|
4107
|
+
action: import_v423.z.object({
|
|
4108
|
+
type: import_v423.z.literal("exec"),
|
|
4109
|
+
command: import_v423.z.array(import_v423.z.string()),
|
|
4110
|
+
timeout_ms: import_v423.z.number().optional(),
|
|
4111
|
+
user: import_v423.z.string().optional(),
|
|
4112
|
+
working_directory: import_v423.z.string().optional(),
|
|
4113
|
+
env: import_v423.z.record(import_v423.z.string(), import_v423.z.string()).optional()
|
|
3771
4114
|
})
|
|
3772
4115
|
}),
|
|
3773
|
-
|
|
3774
|
-
type:
|
|
3775
|
-
call_id:
|
|
3776
|
-
name:
|
|
3777
|
-
arguments:
|
|
3778
|
-
id:
|
|
4116
|
+
import_v423.z.object({
|
|
4117
|
+
type: import_v423.z.literal("function_call"),
|
|
4118
|
+
call_id: import_v423.z.string(),
|
|
4119
|
+
name: import_v423.z.string(),
|
|
4120
|
+
arguments: import_v423.z.string(),
|
|
4121
|
+
id: import_v423.z.string()
|
|
3779
4122
|
}),
|
|
3780
|
-
|
|
3781
|
-
type:
|
|
3782
|
-
call_id:
|
|
3783
|
-
name:
|
|
3784
|
-
input:
|
|
3785
|
-
id:
|
|
4123
|
+
import_v423.z.object({
|
|
4124
|
+
type: import_v423.z.literal("custom_tool_call"),
|
|
4125
|
+
call_id: import_v423.z.string(),
|
|
4126
|
+
name: import_v423.z.string(),
|
|
4127
|
+
input: import_v423.z.string(),
|
|
4128
|
+
id: import_v423.z.string()
|
|
3786
4129
|
}),
|
|
3787
|
-
|
|
3788
|
-
type:
|
|
3789
|
-
id:
|
|
3790
|
-
status:
|
|
4130
|
+
import_v423.z.object({
|
|
4131
|
+
type: import_v423.z.literal("computer_call"),
|
|
4132
|
+
id: import_v423.z.string(),
|
|
4133
|
+
status: import_v423.z.string().optional()
|
|
3791
4134
|
}),
|
|
3792
|
-
|
|
3793
|
-
type:
|
|
3794
|
-
id:
|
|
3795
|
-
encrypted_content:
|
|
3796
|
-
summary:
|
|
3797
|
-
|
|
3798
|
-
type:
|
|
3799
|
-
text:
|
|
4135
|
+
import_v423.z.object({
|
|
4136
|
+
type: import_v423.z.literal("reasoning"),
|
|
4137
|
+
id: import_v423.z.string(),
|
|
4138
|
+
encrypted_content: import_v423.z.string().nullish(),
|
|
4139
|
+
summary: import_v423.z.array(
|
|
4140
|
+
import_v423.z.object({
|
|
4141
|
+
type: import_v423.z.literal("summary_text"),
|
|
4142
|
+
text: import_v423.z.string()
|
|
3800
4143
|
})
|
|
3801
4144
|
)
|
|
3802
4145
|
}),
|
|
3803
|
-
|
|
3804
|
-
type:
|
|
3805
|
-
id:
|
|
3806
|
-
status:
|
|
3807
|
-
arguments:
|
|
3808
|
-
name:
|
|
3809
|
-
server_label:
|
|
3810
|
-
output:
|
|
3811
|
-
error:
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
type:
|
|
3815
|
-
code:
|
|
3816
|
-
message:
|
|
4146
|
+
import_v423.z.object({
|
|
4147
|
+
type: import_v423.z.literal("mcp_call"),
|
|
4148
|
+
id: import_v423.z.string(),
|
|
4149
|
+
status: import_v423.z.string(),
|
|
4150
|
+
arguments: import_v423.z.string(),
|
|
4151
|
+
name: import_v423.z.string(),
|
|
4152
|
+
server_label: import_v423.z.string(),
|
|
4153
|
+
output: import_v423.z.string().nullish(),
|
|
4154
|
+
error: import_v423.z.union([
|
|
4155
|
+
import_v423.z.string(),
|
|
4156
|
+
import_v423.z.object({
|
|
4157
|
+
type: import_v423.z.string().optional(),
|
|
4158
|
+
code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
|
|
4159
|
+
message: import_v423.z.string().optional()
|
|
3817
4160
|
}).loose()
|
|
3818
4161
|
]).nullish(),
|
|
3819
|
-
approval_request_id:
|
|
4162
|
+
approval_request_id: import_v423.z.string().nullish()
|
|
3820
4163
|
}),
|
|
3821
|
-
|
|
3822
|
-
type:
|
|
3823
|
-
id:
|
|
3824
|
-
server_label:
|
|
3825
|
-
tools:
|
|
3826
|
-
|
|
3827
|
-
name:
|
|
3828
|
-
description:
|
|
3829
|
-
input_schema:
|
|
3830
|
-
annotations:
|
|
4164
|
+
import_v423.z.object({
|
|
4165
|
+
type: import_v423.z.literal("mcp_list_tools"),
|
|
4166
|
+
id: import_v423.z.string(),
|
|
4167
|
+
server_label: import_v423.z.string(),
|
|
4168
|
+
tools: import_v423.z.array(
|
|
4169
|
+
import_v423.z.object({
|
|
4170
|
+
name: import_v423.z.string(),
|
|
4171
|
+
description: import_v423.z.string().optional(),
|
|
4172
|
+
input_schema: import_v423.z.any(),
|
|
4173
|
+
annotations: import_v423.z.record(import_v423.z.string(), import_v423.z.unknown()).optional()
|
|
3831
4174
|
})
|
|
3832
4175
|
),
|
|
3833
|
-
error:
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
type:
|
|
3837
|
-
code:
|
|
3838
|
-
message:
|
|
4176
|
+
error: import_v423.z.union([
|
|
4177
|
+
import_v423.z.string(),
|
|
4178
|
+
import_v423.z.object({
|
|
4179
|
+
type: import_v423.z.string().optional(),
|
|
4180
|
+
code: import_v423.z.union([import_v423.z.number(), import_v423.z.string()]).optional(),
|
|
4181
|
+
message: import_v423.z.string().optional()
|
|
3839
4182
|
}).loose()
|
|
3840
4183
|
]).optional()
|
|
3841
4184
|
}),
|
|
3842
|
-
|
|
3843
|
-
type:
|
|
3844
|
-
id:
|
|
3845
|
-
server_label:
|
|
3846
|
-
name:
|
|
3847
|
-
arguments:
|
|
3848
|
-
approval_request_id:
|
|
4185
|
+
import_v423.z.object({
|
|
4186
|
+
type: import_v423.z.literal("mcp_approval_request"),
|
|
4187
|
+
id: import_v423.z.string(),
|
|
4188
|
+
server_label: import_v423.z.string(),
|
|
4189
|
+
name: import_v423.z.string(),
|
|
4190
|
+
arguments: import_v423.z.string(),
|
|
4191
|
+
approval_request_id: import_v423.z.string().optional()
|
|
3849
4192
|
}),
|
|
3850
|
-
|
|
3851
|
-
type:
|
|
3852
|
-
id:
|
|
3853
|
-
call_id:
|
|
3854
|
-
status:
|
|
3855
|
-
operation:
|
|
3856
|
-
|
|
3857
|
-
type:
|
|
3858
|
-
path:
|
|
3859
|
-
diff:
|
|
4193
|
+
import_v423.z.object({
|
|
4194
|
+
type: import_v423.z.literal("apply_patch_call"),
|
|
4195
|
+
id: import_v423.z.string(),
|
|
4196
|
+
call_id: import_v423.z.string(),
|
|
4197
|
+
status: import_v423.z.enum(["in_progress", "completed"]),
|
|
4198
|
+
operation: import_v423.z.discriminatedUnion("type", [
|
|
4199
|
+
import_v423.z.object({
|
|
4200
|
+
type: import_v423.z.literal("create_file"),
|
|
4201
|
+
path: import_v423.z.string(),
|
|
4202
|
+
diff: import_v423.z.string()
|
|
3860
4203
|
}),
|
|
3861
|
-
|
|
3862
|
-
type:
|
|
3863
|
-
path:
|
|
4204
|
+
import_v423.z.object({
|
|
4205
|
+
type: import_v423.z.literal("delete_file"),
|
|
4206
|
+
path: import_v423.z.string()
|
|
3864
4207
|
}),
|
|
3865
|
-
|
|
3866
|
-
type:
|
|
3867
|
-
path:
|
|
3868
|
-
diff:
|
|
4208
|
+
import_v423.z.object({
|
|
4209
|
+
type: import_v423.z.literal("update_file"),
|
|
4210
|
+
path: import_v423.z.string(),
|
|
4211
|
+
diff: import_v423.z.string()
|
|
3869
4212
|
})
|
|
3870
4213
|
])
|
|
3871
4214
|
}),
|
|
3872
|
-
|
|
3873
|
-
type:
|
|
3874
|
-
id:
|
|
3875
|
-
call_id:
|
|
3876
|
-
status:
|
|
3877
|
-
action:
|
|
3878
|
-
commands:
|
|
4215
|
+
import_v423.z.object({
|
|
4216
|
+
type: import_v423.z.literal("shell_call"),
|
|
4217
|
+
id: import_v423.z.string(),
|
|
4218
|
+
call_id: import_v423.z.string(),
|
|
4219
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4220
|
+
action: import_v423.z.object({
|
|
4221
|
+
commands: import_v423.z.array(import_v423.z.string())
|
|
3879
4222
|
})
|
|
3880
4223
|
}),
|
|
3881
|
-
|
|
3882
|
-
type:
|
|
3883
|
-
id:
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
4224
|
+
import_v423.z.object({
|
|
4225
|
+
type: import_v423.z.literal("compaction"),
|
|
4226
|
+
id: import_v423.z.string(),
|
|
4227
|
+
encrypted_content: import_v423.z.string()
|
|
4228
|
+
}),
|
|
4229
|
+
import_v423.z.object({
|
|
4230
|
+
type: import_v423.z.literal("shell_call_output"),
|
|
4231
|
+
id: import_v423.z.string(),
|
|
4232
|
+
call_id: import_v423.z.string(),
|
|
4233
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4234
|
+
output: import_v423.z.array(
|
|
4235
|
+
import_v423.z.object({
|
|
4236
|
+
stdout: import_v423.z.string(),
|
|
4237
|
+
stderr: import_v423.z.string(),
|
|
4238
|
+
outcome: import_v423.z.discriminatedUnion("type", [
|
|
4239
|
+
import_v423.z.object({ type: import_v423.z.literal("timeout") }),
|
|
4240
|
+
import_v423.z.object({
|
|
4241
|
+
type: import_v423.z.literal("exit"),
|
|
4242
|
+
exit_code: import_v423.z.number()
|
|
3895
4243
|
})
|
|
3896
4244
|
])
|
|
3897
4245
|
})
|
|
3898
4246
|
)
|
|
4247
|
+
}),
|
|
4248
|
+
import_v423.z.object({
|
|
4249
|
+
type: import_v423.z.literal("tool_search_call"),
|
|
4250
|
+
id: import_v423.z.string(),
|
|
4251
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
4252
|
+
call_id: import_v423.z.string().nullable(),
|
|
4253
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4254
|
+
arguments: import_v423.z.unknown()
|
|
4255
|
+
}),
|
|
4256
|
+
import_v423.z.object({
|
|
4257
|
+
type: import_v423.z.literal("tool_search_output"),
|
|
4258
|
+
id: import_v423.z.string(),
|
|
4259
|
+
execution: import_v423.z.enum(["server", "client"]),
|
|
4260
|
+
call_id: import_v423.z.string().nullable(),
|
|
4261
|
+
status: import_v423.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4262
|
+
tools: import_v423.z.array(import_v423.z.record(import_v423.z.string(), jsonValueSchema2.optional()))
|
|
3899
4263
|
})
|
|
3900
4264
|
])
|
|
3901
4265
|
).optional(),
|
|
3902
|
-
service_tier:
|
|
3903
|
-
incomplete_details:
|
|
3904
|
-
usage:
|
|
3905
|
-
input_tokens:
|
|
3906
|
-
input_tokens_details:
|
|
3907
|
-
output_tokens:
|
|
3908
|
-
output_tokens_details:
|
|
4266
|
+
service_tier: import_v423.z.string().nullish(),
|
|
4267
|
+
incomplete_details: import_v423.z.object({ reason: import_v423.z.string() }).nullish(),
|
|
4268
|
+
usage: import_v423.z.object({
|
|
4269
|
+
input_tokens: import_v423.z.number(),
|
|
4270
|
+
input_tokens_details: import_v423.z.object({ cached_tokens: import_v423.z.number().nullish() }).nullish(),
|
|
4271
|
+
output_tokens: import_v423.z.number(),
|
|
4272
|
+
output_tokens_details: import_v423.z.object({ reasoning_tokens: import_v423.z.number().nullish() }).nullish()
|
|
3909
4273
|
}).optional()
|
|
3910
4274
|
})
|
|
3911
4275
|
)
|
|
3912
4276
|
);
|
|
3913
4277
|
|
|
3914
4278
|
// src/responses/openai-responses-options.ts
|
|
3915
|
-
var
|
|
3916
|
-
var
|
|
4279
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
4280
|
+
var import_v424 = require("zod/v4");
|
|
3917
4281
|
var TOP_LOGPROBS_MAX = 20;
|
|
3918
4282
|
var openaiResponsesReasoningModelIds = [
|
|
3919
4283
|
"o1",
|
|
@@ -3942,11 +4306,16 @@ var openaiResponsesReasoningModelIds = [
|
|
|
3942
4306
|
"gpt-5.2-chat-latest",
|
|
3943
4307
|
"gpt-5.2-pro",
|
|
3944
4308
|
"gpt-5.2-codex",
|
|
4309
|
+
"gpt-5.3-chat-latest",
|
|
4310
|
+
"gpt-5.3-codex",
|
|
3945
4311
|
"gpt-5.4",
|
|
3946
4312
|
"gpt-5.4-2026-03-05",
|
|
4313
|
+
"gpt-5.4-mini",
|
|
4314
|
+
"gpt-5.4-mini-2026-03-17",
|
|
4315
|
+
"gpt-5.4-nano",
|
|
4316
|
+
"gpt-5.4-nano-2026-03-17",
|
|
3947
4317
|
"gpt-5.4-pro",
|
|
3948
|
-
"gpt-5.4-pro-2026-03-05"
|
|
3949
|
-
"gpt-5.3-codex"
|
|
4318
|
+
"gpt-5.4-pro-2026-03-05"
|
|
3950
4319
|
];
|
|
3951
4320
|
var openaiResponsesModelIds = [
|
|
3952
4321
|
"gpt-4.1",
|
|
@@ -3973,9 +4342,9 @@ var openaiResponsesModelIds = [
|
|
|
3973
4342
|
"gpt-5-chat-latest",
|
|
3974
4343
|
...openaiResponsesReasoningModelIds
|
|
3975
4344
|
];
|
|
3976
|
-
var openaiLanguageModelResponsesOptionsSchema = (0,
|
|
3977
|
-
() => (0,
|
|
3978
|
-
|
|
4345
|
+
var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils30.lazySchema)(
|
|
4346
|
+
() => (0, import_provider_utils30.zodSchema)(
|
|
4347
|
+
import_v424.z.object({
|
|
3979
4348
|
/**
|
|
3980
4349
|
* The ID of the OpenAI Conversation to continue.
|
|
3981
4350
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -3983,13 +4352,13 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
3983
4352
|
* Defaults to `undefined`.
|
|
3984
4353
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3985
4354
|
*/
|
|
3986
|
-
conversation:
|
|
4355
|
+
conversation: import_v424.z.string().nullish(),
|
|
3987
4356
|
/**
|
|
3988
4357
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
3989
4358
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
3990
4359
|
*/
|
|
3991
|
-
include:
|
|
3992
|
-
|
|
4360
|
+
include: import_v424.z.array(
|
|
4361
|
+
import_v424.z.enum([
|
|
3993
4362
|
"reasoning.encrypted_content",
|
|
3994
4363
|
// handled internally by default, only needed for unknown reasoning models
|
|
3995
4364
|
"file_search_call.results",
|
|
@@ -4001,7 +4370,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4001
4370
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
4002
4371
|
* Defaults to `undefined`.
|
|
4003
4372
|
*/
|
|
4004
|
-
instructions:
|
|
4373
|
+
instructions: import_v424.z.string().nullish(),
|
|
4005
4374
|
/**
|
|
4006
4375
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
4007
4376
|
* the response size and can slow down response times. However, it can
|
|
@@ -4016,30 +4385,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4016
4385
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
4017
4386
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
4018
4387
|
*/
|
|
4019
|
-
logprobs:
|
|
4388
|
+
logprobs: import_v424.z.union([import_v424.z.boolean(), import_v424.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
4020
4389
|
/**
|
|
4021
4390
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
4022
4391
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
4023
4392
|
* Any further attempts to call a tool by the model will be ignored.
|
|
4024
4393
|
*/
|
|
4025
|
-
maxToolCalls:
|
|
4394
|
+
maxToolCalls: import_v424.z.number().nullish(),
|
|
4026
4395
|
/**
|
|
4027
4396
|
* Additional metadata to store with the generation.
|
|
4028
4397
|
*/
|
|
4029
|
-
metadata:
|
|
4398
|
+
metadata: import_v424.z.any().nullish(),
|
|
4030
4399
|
/**
|
|
4031
4400
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
4032
4401
|
*/
|
|
4033
|
-
parallelToolCalls:
|
|
4402
|
+
parallelToolCalls: import_v424.z.boolean().nullish(),
|
|
4034
4403
|
/**
|
|
4035
4404
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
4036
4405
|
* Defaults to `undefined`.
|
|
4037
4406
|
*/
|
|
4038
|
-
previousResponseId:
|
|
4407
|
+
previousResponseId: import_v424.z.string().nullish(),
|
|
4039
4408
|
/**
|
|
4040
4409
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
4041
4410
|
*/
|
|
4042
|
-
promptCacheKey:
|
|
4411
|
+
promptCacheKey: import_v424.z.string().nullish(),
|
|
4043
4412
|
/**
|
|
4044
4413
|
* The retention policy for the prompt cache.
|
|
4045
4414
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -4048,7 +4417,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4048
4417
|
*
|
|
4049
4418
|
* @default 'in_memory'
|
|
4050
4419
|
*/
|
|
4051
|
-
promptCacheRetention:
|
|
4420
|
+
promptCacheRetention: import_v424.z.enum(["in_memory", "24h"]).nullish(),
|
|
4052
4421
|
/**
|
|
4053
4422
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
4054
4423
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -4059,17 +4428,17 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4059
4428
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
4060
4429
|
* an error.
|
|
4061
4430
|
*/
|
|
4062
|
-
reasoningEffort:
|
|
4431
|
+
reasoningEffort: import_v424.z.string().nullish(),
|
|
4063
4432
|
/**
|
|
4064
4433
|
* Controls reasoning summary output from the model.
|
|
4065
4434
|
* Set to "auto" to automatically receive the richest level available,
|
|
4066
4435
|
* or "detailed" for comprehensive summaries.
|
|
4067
4436
|
*/
|
|
4068
|
-
reasoningSummary:
|
|
4437
|
+
reasoningSummary: import_v424.z.string().nullish(),
|
|
4069
4438
|
/**
|
|
4070
4439
|
* The identifier for safety monitoring and tracking.
|
|
4071
4440
|
*/
|
|
4072
|
-
safetyIdentifier:
|
|
4441
|
+
safetyIdentifier: import_v424.z.string().nullish(),
|
|
4073
4442
|
/**
|
|
4074
4443
|
* Service tier for the request.
|
|
4075
4444
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -4077,34 +4446,34 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4077
4446
|
*
|
|
4078
4447
|
* Defaults to 'auto'.
|
|
4079
4448
|
*/
|
|
4080
|
-
serviceTier:
|
|
4449
|
+
serviceTier: import_v424.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
4081
4450
|
/**
|
|
4082
4451
|
* Whether to store the generation. Defaults to `true`.
|
|
4083
4452
|
*/
|
|
4084
|
-
store:
|
|
4453
|
+
store: import_v424.z.boolean().nullish(),
|
|
4085
4454
|
/**
|
|
4086
4455
|
* Whether to use strict JSON schema validation.
|
|
4087
4456
|
* Defaults to `true`.
|
|
4088
4457
|
*/
|
|
4089
|
-
strictJsonSchema:
|
|
4458
|
+
strictJsonSchema: import_v424.z.boolean().nullish(),
|
|
4090
4459
|
/**
|
|
4091
4460
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
4092
4461
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
4093
4462
|
* Valid values: 'low', 'medium', 'high'.
|
|
4094
4463
|
*/
|
|
4095
|
-
textVerbosity:
|
|
4464
|
+
textVerbosity: import_v424.z.enum(["low", "medium", "high"]).nullish(),
|
|
4096
4465
|
/**
|
|
4097
4466
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
4098
4467
|
* 'disabled' turns truncation off.
|
|
4099
4468
|
*/
|
|
4100
|
-
truncation:
|
|
4469
|
+
truncation: import_v424.z.enum(["auto", "disabled"]).nullish(),
|
|
4101
4470
|
/**
|
|
4102
4471
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
4103
4472
|
* monitor and detect abuse.
|
|
4104
4473
|
* Defaults to `undefined`.
|
|
4105
4474
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
4106
4475
|
*/
|
|
4107
|
-
user:
|
|
4476
|
+
user: import_v424.z.string().nullish(),
|
|
4108
4477
|
/**
|
|
4109
4478
|
* Override the system message mode for this model.
|
|
4110
4479
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -4113,7 +4482,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4113
4482
|
*
|
|
4114
4483
|
* If not specified, the mode is automatically determined based on the model.
|
|
4115
4484
|
*/
|
|
4116
|
-
systemMessageMode:
|
|
4485
|
+
systemMessageMode: import_v424.z.enum(["system", "developer", "remove"]).optional(),
|
|
4117
4486
|
/**
|
|
4118
4487
|
* Force treating this model as a reasoning model.
|
|
4119
4488
|
*
|
|
@@ -4123,21 +4492,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4123
4492
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4124
4493
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4125
4494
|
*/
|
|
4126
|
-
forceReasoning:
|
|
4495
|
+
forceReasoning: import_v424.z.boolean().optional(),
|
|
4496
|
+
/**
|
|
4497
|
+
* Enable server-side context management (compaction).
|
|
4498
|
+
*/
|
|
4499
|
+
contextManagement: import_v424.z.array(
|
|
4500
|
+
import_v424.z.object({
|
|
4501
|
+
type: import_v424.z.literal("compaction"),
|
|
4502
|
+
compactThreshold: import_v424.z.number()
|
|
4503
|
+
})
|
|
4504
|
+
).nullish()
|
|
4127
4505
|
})
|
|
4128
4506
|
)
|
|
4129
4507
|
);
|
|
4130
4508
|
|
|
4131
4509
|
// src/responses/openai-responses-prepare-tools.ts
|
|
4132
4510
|
var import_provider7 = require("@ai-sdk/provider");
|
|
4133
|
-
var
|
|
4511
|
+
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
4134
4512
|
async function prepareResponsesTools({
|
|
4135
4513
|
tools,
|
|
4136
4514
|
toolChoice,
|
|
4137
4515
|
toolNameMapping,
|
|
4138
4516
|
customProviderToolNames
|
|
4139
4517
|
}) {
|
|
4140
|
-
var _a;
|
|
4518
|
+
var _a, _b;
|
|
4141
4519
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
4142
4520
|
const toolWarnings = [];
|
|
4143
4521
|
if (tools == null) {
|
|
@@ -4147,19 +4525,23 @@ async function prepareResponsesTools({
|
|
|
4147
4525
|
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
4148
4526
|
for (const tool of tools) {
|
|
4149
4527
|
switch (tool.type) {
|
|
4150
|
-
case "function":
|
|
4528
|
+
case "function": {
|
|
4529
|
+
const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
|
|
4530
|
+
const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
|
|
4151
4531
|
openaiTools2.push({
|
|
4152
4532
|
type: "function",
|
|
4153
4533
|
name: tool.name,
|
|
4154
4534
|
description: tool.description,
|
|
4155
4535
|
parameters: tool.inputSchema,
|
|
4156
|
-
...tool.strict != null ? { strict: tool.strict } : {}
|
|
4536
|
+
...tool.strict != null ? { strict: tool.strict } : {},
|
|
4537
|
+
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
4157
4538
|
});
|
|
4158
4539
|
break;
|
|
4540
|
+
}
|
|
4159
4541
|
case "provider": {
|
|
4160
4542
|
switch (tool.id) {
|
|
4161
4543
|
case "openai.file_search": {
|
|
4162
|
-
const args = await (0,
|
|
4544
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4163
4545
|
value: tool.args,
|
|
4164
4546
|
schema: fileSearchArgsSchema
|
|
4165
4547
|
});
|
|
@@ -4182,7 +4564,7 @@ async function prepareResponsesTools({
|
|
|
4182
4564
|
break;
|
|
4183
4565
|
}
|
|
4184
4566
|
case "openai.shell": {
|
|
4185
|
-
const args = await (0,
|
|
4567
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4186
4568
|
value: tool.args,
|
|
4187
4569
|
schema: shellArgsSchema
|
|
4188
4570
|
});
|
|
@@ -4201,7 +4583,7 @@ async function prepareResponsesTools({
|
|
|
4201
4583
|
break;
|
|
4202
4584
|
}
|
|
4203
4585
|
case "openai.web_search_preview": {
|
|
4204
|
-
const args = await (0,
|
|
4586
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4205
4587
|
value: tool.args,
|
|
4206
4588
|
schema: webSearchPreviewArgsSchema
|
|
4207
4589
|
});
|
|
@@ -4213,7 +4595,7 @@ async function prepareResponsesTools({
|
|
|
4213
4595
|
break;
|
|
4214
4596
|
}
|
|
4215
4597
|
case "openai.web_search": {
|
|
4216
|
-
const args = await (0,
|
|
4598
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4217
4599
|
value: tool.args,
|
|
4218
4600
|
schema: webSearchArgsSchema
|
|
4219
4601
|
});
|
|
@@ -4227,7 +4609,7 @@ async function prepareResponsesTools({
|
|
|
4227
4609
|
break;
|
|
4228
4610
|
}
|
|
4229
4611
|
case "openai.code_interpreter": {
|
|
4230
|
-
const args = await (0,
|
|
4612
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4231
4613
|
value: tool.args,
|
|
4232
4614
|
schema: codeInterpreterArgsSchema
|
|
4233
4615
|
});
|
|
@@ -4238,7 +4620,7 @@ async function prepareResponsesTools({
|
|
|
4238
4620
|
break;
|
|
4239
4621
|
}
|
|
4240
4622
|
case "openai.image_generation": {
|
|
4241
|
-
const args = await (0,
|
|
4623
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4242
4624
|
value: tool.args,
|
|
4243
4625
|
schema: imageGenerationArgsSchema
|
|
4244
4626
|
});
|
|
@@ -4261,7 +4643,7 @@ async function prepareResponsesTools({
|
|
|
4261
4643
|
break;
|
|
4262
4644
|
}
|
|
4263
4645
|
case "openai.mcp": {
|
|
4264
|
-
const args = await (0,
|
|
4646
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4265
4647
|
value: tool.args,
|
|
4266
4648
|
schema: mcpArgsSchema
|
|
4267
4649
|
});
|
|
@@ -4287,17 +4669,30 @@ async function prepareResponsesTools({
|
|
|
4287
4669
|
break;
|
|
4288
4670
|
}
|
|
4289
4671
|
case "openai.custom": {
|
|
4290
|
-
const args = await (0,
|
|
4672
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4291
4673
|
value: tool.args,
|
|
4292
4674
|
schema: customArgsSchema
|
|
4293
4675
|
});
|
|
4294
4676
|
openaiTools2.push({
|
|
4295
4677
|
type: "custom",
|
|
4296
|
-
name:
|
|
4678
|
+
name: tool.name,
|
|
4297
4679
|
description: args.description,
|
|
4298
4680
|
format: args.format
|
|
4299
4681
|
});
|
|
4300
|
-
resolvedCustomProviderToolNames.add(
|
|
4682
|
+
resolvedCustomProviderToolNames.add(tool.name);
|
|
4683
|
+
break;
|
|
4684
|
+
}
|
|
4685
|
+
case "openai.tool_search": {
|
|
4686
|
+
const args = await (0, import_provider_utils31.validateTypes)({
|
|
4687
|
+
value: tool.args,
|
|
4688
|
+
schema: toolSearchArgsSchema
|
|
4689
|
+
});
|
|
4690
|
+
openaiTools2.push({
|
|
4691
|
+
type: "tool_search",
|
|
4692
|
+
...args.execution != null ? { execution: args.execution } : {},
|
|
4693
|
+
...args.description != null ? { description: args.description } : {},
|
|
4694
|
+
...args.parameters != null ? { parameters: args.parameters } : {}
|
|
4695
|
+
});
|
|
4301
4696
|
break;
|
|
4302
4697
|
}
|
|
4303
4698
|
}
|
|
@@ -4321,7 +4716,7 @@ async function prepareResponsesTools({
|
|
|
4321
4716
|
case "required":
|
|
4322
4717
|
return { tools: openaiTools2, toolChoice: type, toolWarnings };
|
|
4323
4718
|
case "tool": {
|
|
4324
|
-
const resolvedToolName = (
|
|
4719
|
+
const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
|
|
4325
4720
|
return {
|
|
4326
4721
|
tools: openaiTools2,
|
|
4327
4722
|
toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
|
|
@@ -4401,7 +4796,7 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
|
4401
4796
|
}
|
|
4402
4797
|
var OpenAIResponsesLanguageModel = class {
|
|
4403
4798
|
constructor(modelId, config) {
|
|
4404
|
-
this.specificationVersion = "
|
|
4799
|
+
this.specificationVersion = "v4";
|
|
4405
4800
|
this.supportedUrls = {
|
|
4406
4801
|
"image/*": [/^https?:\/\/.*$/],
|
|
4407
4802
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -4422,12 +4817,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4422
4817
|
frequencyPenalty,
|
|
4423
4818
|
seed,
|
|
4424
4819
|
prompt,
|
|
4820
|
+
reasoning,
|
|
4425
4821
|
providerOptions,
|
|
4426
4822
|
tools,
|
|
4427
4823
|
toolChoice,
|
|
4428
4824
|
responseFormat
|
|
4429
4825
|
}) {
|
|
4430
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4826
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4431
4827
|
const warnings = [];
|
|
4432
4828
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
4433
4829
|
if (topK != null) {
|
|
@@ -4446,19 +4842,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4446
4842
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
4447
4843
|
}
|
|
4448
4844
|
const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
|
|
4449
|
-
let openaiOptions = await (0,
|
|
4845
|
+
let openaiOptions = await (0, import_provider_utils32.parseProviderOptions)({
|
|
4450
4846
|
provider: providerOptionsName,
|
|
4451
4847
|
providerOptions,
|
|
4452
4848
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4453
4849
|
});
|
|
4454
4850
|
if (openaiOptions == null && providerOptionsName !== "openai") {
|
|
4455
|
-
openaiOptions = await (0,
|
|
4851
|
+
openaiOptions = await (0, import_provider_utils32.parseProviderOptions)({
|
|
4456
4852
|
provider: "openai",
|
|
4457
4853
|
providerOptions,
|
|
4458
4854
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4459
4855
|
});
|
|
4460
4856
|
}
|
|
4461
|
-
const
|
|
4857
|
+
const resolvedReasoningEffort = (_a = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a : (0, import_provider_utils32.isCustomReasoning)(reasoning) ? reasoning : void 0;
|
|
4858
|
+
const isReasoningModel = (_b = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
|
|
4462
4859
|
if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
|
|
4463
4860
|
warnings.push({
|
|
4464
4861
|
type: "unsupported",
|
|
@@ -4466,7 +4863,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4466
4863
|
details: "conversation and previousResponseId cannot be used together"
|
|
4467
4864
|
});
|
|
4468
4865
|
}
|
|
4469
|
-
const toolNameMapping = (0,
|
|
4866
|
+
const toolNameMapping = (0, import_provider_utils32.createToolNameMapping)({
|
|
4470
4867
|
tools,
|
|
4471
4868
|
providerToolNames: {
|
|
4472
4869
|
"openai.code_interpreter": "code_interpreter",
|
|
@@ -4477,9 +4874,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4477
4874
|
"openai.web_search": "web_search",
|
|
4478
4875
|
"openai.web_search_preview": "web_search_preview",
|
|
4479
4876
|
"openai.mcp": "mcp",
|
|
4480
|
-
"openai.apply_patch": "apply_patch"
|
|
4481
|
-
|
|
4482
|
-
|
|
4877
|
+
"openai.apply_patch": "apply_patch",
|
|
4878
|
+
"openai.tool_search": "tool_search"
|
|
4879
|
+
}
|
|
4483
4880
|
});
|
|
4484
4881
|
const customProviderToolNames = /* @__PURE__ */ new Set();
|
|
4485
4882
|
const {
|
|
@@ -4495,10 +4892,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4495
4892
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
4496
4893
|
prompt,
|
|
4497
4894
|
toolNameMapping,
|
|
4498
|
-
systemMessageMode: (
|
|
4895
|
+
systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
|
|
4499
4896
|
providerOptionsName,
|
|
4500
4897
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
4501
|
-
store: (
|
|
4898
|
+
store: (_d = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _d : true,
|
|
4502
4899
|
hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
|
|
4503
4900
|
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
4504
4901
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
@@ -4506,7 +4903,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4506
4903
|
customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0
|
|
4507
4904
|
});
|
|
4508
4905
|
warnings.push(...inputWarnings);
|
|
4509
|
-
const strictJsonSchema = (
|
|
4906
|
+
const strictJsonSchema = (_e = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _e : true;
|
|
4510
4907
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4511
4908
|
function addInclude(key) {
|
|
4512
4909
|
if (include == null) {
|
|
@@ -4522,9 +4919,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4522
4919
|
if (topLogprobs) {
|
|
4523
4920
|
addInclude("message.output_text.logprobs");
|
|
4524
4921
|
}
|
|
4525
|
-
const webSearchToolName = (
|
|
4922
|
+
const webSearchToolName = (_f = tools == null ? void 0 : tools.find(
|
|
4526
4923
|
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4527
|
-
)) == null ? void 0 :
|
|
4924
|
+
)) == null ? void 0 : _f.name;
|
|
4528
4925
|
if (webSearchToolName) {
|
|
4529
4926
|
addInclude("web_search_call.action.sources");
|
|
4530
4927
|
}
|
|
@@ -4547,7 +4944,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4547
4944
|
format: responseFormat.schema != null ? {
|
|
4548
4945
|
type: "json_schema",
|
|
4549
4946
|
strict: strictJsonSchema,
|
|
4550
|
-
name: (
|
|
4947
|
+
name: (_g = responseFormat.name) != null ? _g : "response",
|
|
4551
4948
|
description: responseFormat.description,
|
|
4552
4949
|
schema: responseFormat.schema
|
|
4553
4950
|
} : { type: "json_object" }
|
|
@@ -4573,11 +4970,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4573
4970
|
safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
|
|
4574
4971
|
top_logprobs: topLogprobs,
|
|
4575
4972
|
truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
|
|
4973
|
+
// context management (server-side compaction):
|
|
4974
|
+
...(openaiOptions == null ? void 0 : openaiOptions.contextManagement) && {
|
|
4975
|
+
context_management: openaiOptions.contextManagement.map((cm) => ({
|
|
4976
|
+
type: cm.type,
|
|
4977
|
+
compact_threshold: cm.compactThreshold
|
|
4978
|
+
}))
|
|
4979
|
+
},
|
|
4576
4980
|
// model-specific settings:
|
|
4577
|
-
...isReasoningModel && (
|
|
4981
|
+
...isReasoningModel && (resolvedReasoningEffort != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) && {
|
|
4578
4982
|
reasoning: {
|
|
4579
|
-
...
|
|
4580
|
-
effort:
|
|
4983
|
+
...resolvedReasoningEffort != null && {
|
|
4984
|
+
effort: resolvedReasoningEffort
|
|
4581
4985
|
},
|
|
4582
4986
|
...(openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null && {
|
|
4583
4987
|
summary: openaiOptions.reasoningSummary
|
|
@@ -4586,7 +4990,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4586
4990
|
}
|
|
4587
4991
|
};
|
|
4588
4992
|
if (isReasoningModel) {
|
|
4589
|
-
if (!(
|
|
4993
|
+
if (!(resolvedReasoningEffort === "none" && modelCapabilities.supportsNonReasoningParameters)) {
|
|
4590
4994
|
if (baseArgs.temperature != null) {
|
|
4591
4995
|
baseArgs.temperature = void 0;
|
|
4592
4996
|
warnings.push({
|
|
@@ -4636,9 +5040,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4636
5040
|
});
|
|
4637
5041
|
delete baseArgs.service_tier;
|
|
4638
5042
|
}
|
|
4639
|
-
const shellToolEnvType = (
|
|
5043
|
+
const shellToolEnvType = (_j = (_i = (_h = tools == null ? void 0 : tools.find(
|
|
4640
5044
|
(tool) => tool.type === "provider" && tool.id === "openai.shell"
|
|
4641
|
-
)) == null ? void 0 :
|
|
5045
|
+
)) == null ? void 0 : _h.args) == null ? void 0 : _i.environment) == null ? void 0 : _j.type;
|
|
4642
5046
|
const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
|
|
4643
5047
|
return {
|
|
4644
5048
|
webSearchToolName,
|
|
@@ -4655,7 +5059,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4655
5059
|
};
|
|
4656
5060
|
}
|
|
4657
5061
|
async doGenerate(options) {
|
|
4658
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
5062
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
|
|
4659
5063
|
const {
|
|
4660
5064
|
args: body,
|
|
4661
5065
|
warnings,
|
|
@@ -4673,12 +5077,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4673
5077
|
responseHeaders,
|
|
4674
5078
|
value: response,
|
|
4675
5079
|
rawValue: rawResponse
|
|
4676
|
-
} = await (0,
|
|
5080
|
+
} = await (0, import_provider_utils32.postJsonToApi)({
|
|
4677
5081
|
url,
|
|
4678
|
-
headers: (0,
|
|
5082
|
+
headers: (0, import_provider_utils32.combineHeaders)(this.config.headers(), options.headers),
|
|
4679
5083
|
body,
|
|
4680
5084
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4681
|
-
successfulResponseHandler: (0,
|
|
5085
|
+
successfulResponseHandler: (0, import_provider_utils32.createJsonResponseHandler)(
|
|
4682
5086
|
openaiResponsesResponseSchema
|
|
4683
5087
|
),
|
|
4684
5088
|
abortSignal: options.abortSignal,
|
|
@@ -4698,6 +5102,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4698
5102
|
const content = [];
|
|
4699
5103
|
const logprobs = [];
|
|
4700
5104
|
let hasFunctionCall = false;
|
|
5105
|
+
const hostedToolSearchCallIds = [];
|
|
4701
5106
|
for (const part of response.output) {
|
|
4702
5107
|
switch (part.type) {
|
|
4703
5108
|
case "reasoning": {
|
|
@@ -4736,6 +5141,46 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4736
5141
|
});
|
|
4737
5142
|
break;
|
|
4738
5143
|
}
|
|
5144
|
+
case "tool_search_call": {
|
|
5145
|
+
const toolCallId = (_b = part.call_id) != null ? _b : part.id;
|
|
5146
|
+
const isHosted = part.execution === "server";
|
|
5147
|
+
if (isHosted) {
|
|
5148
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5149
|
+
}
|
|
5150
|
+
content.push({
|
|
5151
|
+
type: "tool-call",
|
|
5152
|
+
toolCallId,
|
|
5153
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5154
|
+
input: JSON.stringify({
|
|
5155
|
+
arguments: part.arguments,
|
|
5156
|
+
call_id: part.call_id
|
|
5157
|
+
}),
|
|
5158
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5159
|
+
providerMetadata: {
|
|
5160
|
+
[providerOptionsName]: {
|
|
5161
|
+
itemId: part.id
|
|
5162
|
+
}
|
|
5163
|
+
}
|
|
5164
|
+
});
|
|
5165
|
+
break;
|
|
5166
|
+
}
|
|
5167
|
+
case "tool_search_output": {
|
|
5168
|
+
const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
|
|
5169
|
+
content.push({
|
|
5170
|
+
type: "tool-result",
|
|
5171
|
+
toolCallId,
|
|
5172
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5173
|
+
result: {
|
|
5174
|
+
tools: part.tools
|
|
5175
|
+
},
|
|
5176
|
+
providerMetadata: {
|
|
5177
|
+
[providerOptionsName]: {
|
|
5178
|
+
itemId: part.id
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
});
|
|
5182
|
+
break;
|
|
5183
|
+
}
|
|
4739
5184
|
case "local_shell_call": {
|
|
4740
5185
|
content.push({
|
|
4741
5186
|
type: "tool-call",
|
|
@@ -4791,7 +5236,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4791
5236
|
}
|
|
4792
5237
|
case "message": {
|
|
4793
5238
|
for (const contentPart of part.content) {
|
|
4794
|
-
if (((
|
|
5239
|
+
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
|
|
4795
5240
|
logprobs.push(contentPart.logprobs);
|
|
4796
5241
|
}
|
|
4797
5242
|
const providerMetadata2 = {
|
|
@@ -4813,7 +5258,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4813
5258
|
content.push({
|
|
4814
5259
|
type: "source",
|
|
4815
5260
|
sourceType: "url",
|
|
4816
|
-
id: (
|
|
5261
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils32.generateId)(),
|
|
4817
5262
|
url: annotation.url,
|
|
4818
5263
|
title: annotation.title
|
|
4819
5264
|
});
|
|
@@ -4821,7 +5266,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4821
5266
|
content.push({
|
|
4822
5267
|
type: "source",
|
|
4823
5268
|
sourceType: "document",
|
|
4824
|
-
id: (
|
|
5269
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils32.generateId)(),
|
|
4825
5270
|
mediaType: "text/plain",
|
|
4826
5271
|
title: annotation.filename,
|
|
4827
5272
|
filename: annotation.filename,
|
|
@@ -4837,7 +5282,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4837
5282
|
content.push({
|
|
4838
5283
|
type: "source",
|
|
4839
5284
|
sourceType: "document",
|
|
4840
|
-
id: (
|
|
5285
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils32.generateId)(),
|
|
4841
5286
|
mediaType: "text/plain",
|
|
4842
5287
|
title: annotation.filename,
|
|
4843
5288
|
filename: annotation.filename,
|
|
@@ -4853,7 +5298,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4853
5298
|
content.push({
|
|
4854
5299
|
type: "source",
|
|
4855
5300
|
sourceType: "document",
|
|
4856
|
-
id: (
|
|
5301
|
+
id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils32.generateId)(),
|
|
4857
5302
|
mediaType: "application/octet-stream",
|
|
4858
5303
|
title: annotation.file_id,
|
|
4859
5304
|
filename: annotation.file_id,
|
|
@@ -4922,7 +5367,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4922
5367
|
break;
|
|
4923
5368
|
}
|
|
4924
5369
|
case "mcp_call": {
|
|
4925
|
-
const toolCallId = part.approval_request_id != null ? (
|
|
5370
|
+
const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
|
|
4926
5371
|
const toolName = `mcp.${part.name}`;
|
|
4927
5372
|
content.push({
|
|
4928
5373
|
type: "tool-call",
|
|
@@ -4956,8 +5401,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4956
5401
|
break;
|
|
4957
5402
|
}
|
|
4958
5403
|
case "mcp_approval_request": {
|
|
4959
|
-
const approvalRequestId = (
|
|
4960
|
-
const dummyToolCallId = (
|
|
5404
|
+
const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
|
|
5405
|
+
const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils32.generateId)();
|
|
4961
5406
|
const toolName = `mcp.${part.name}`;
|
|
4962
5407
|
content.push({
|
|
4963
5408
|
type: "tool-call",
|
|
@@ -5007,13 +5452,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5007
5452
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5008
5453
|
result: {
|
|
5009
5454
|
queries: part.queries,
|
|
5010
|
-
results: (
|
|
5455
|
+
results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
|
|
5011
5456
|
attributes: result.attributes,
|
|
5012
5457
|
fileId: result.file_id,
|
|
5013
5458
|
filename: result.filename,
|
|
5014
5459
|
score: result.score,
|
|
5015
5460
|
text: result.text
|
|
5016
|
-
}))) != null ?
|
|
5461
|
+
}))) != null ? _y : null
|
|
5017
5462
|
}
|
|
5018
5463
|
});
|
|
5019
5464
|
break;
|
|
@@ -5056,6 +5501,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5056
5501
|
});
|
|
5057
5502
|
break;
|
|
5058
5503
|
}
|
|
5504
|
+
case "compaction": {
|
|
5505
|
+
content.push({
|
|
5506
|
+
type: "custom",
|
|
5507
|
+
kind: "openai.compaction",
|
|
5508
|
+
providerMetadata: {
|
|
5509
|
+
[providerOptionsName]: {
|
|
5510
|
+
type: "compaction",
|
|
5511
|
+
itemId: part.id,
|
|
5512
|
+
encryptedContent: part.encrypted_content
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
});
|
|
5516
|
+
break;
|
|
5517
|
+
}
|
|
5059
5518
|
}
|
|
5060
5519
|
}
|
|
5061
5520
|
const providerMetadata = {
|
|
@@ -5070,10 +5529,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5070
5529
|
content,
|
|
5071
5530
|
finishReason: {
|
|
5072
5531
|
unified: mapOpenAIResponseFinishReason({
|
|
5073
|
-
finishReason: (
|
|
5532
|
+
finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
|
|
5074
5533
|
hasFunctionCall
|
|
5075
5534
|
}),
|
|
5076
|
-
raw: (
|
|
5535
|
+
raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
|
|
5077
5536
|
},
|
|
5078
5537
|
usage: convertOpenAIResponsesUsage(usage),
|
|
5079
5538
|
request: { body },
|
|
@@ -5098,18 +5557,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5098
5557
|
providerOptionsName,
|
|
5099
5558
|
isShellProviderExecuted
|
|
5100
5559
|
} = await this.getArgs(options);
|
|
5101
|
-
const { responseHeaders, value: response } = await (0,
|
|
5560
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils32.postJsonToApi)({
|
|
5102
5561
|
url: this.config.url({
|
|
5103
5562
|
path: "/responses",
|
|
5104
5563
|
modelId: this.modelId
|
|
5105
5564
|
}),
|
|
5106
|
-
headers: (0,
|
|
5565
|
+
headers: (0, import_provider_utils32.combineHeaders)(this.config.headers(), options.headers),
|
|
5107
5566
|
body: {
|
|
5108
5567
|
...body,
|
|
5109
5568
|
stream: true
|
|
5110
5569
|
},
|
|
5111
5570
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
5112
|
-
successfulResponseHandler: (0,
|
|
5571
|
+
successfulResponseHandler: (0, import_provider_utils32.createEventSourceResponseHandler)(
|
|
5113
5572
|
openaiResponsesChunkSchema
|
|
5114
5573
|
),
|
|
5115
5574
|
abortSignal: options.abortSignal,
|
|
@@ -5131,6 +5590,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5131
5590
|
let hasFunctionCall = false;
|
|
5132
5591
|
const activeReasoning = {};
|
|
5133
5592
|
let serviceTier;
|
|
5593
|
+
const hostedToolSearchCallIds = [];
|
|
5134
5594
|
return {
|
|
5135
5595
|
stream: response.pipeThrough(
|
|
5136
5596
|
new TransformStream({
|
|
@@ -5138,7 +5598,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5138
5598
|
controller.enqueue({ type: "stream-start", warnings });
|
|
5139
5599
|
},
|
|
5140
5600
|
transform(chunk, controller) {
|
|
5141
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
5601
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
|
|
5142
5602
|
if (options.includeRawChunks) {
|
|
5143
5603
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
5144
5604
|
}
|
|
@@ -5246,6 +5706,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5246
5706
|
input: "{}",
|
|
5247
5707
|
providerExecuted: true
|
|
5248
5708
|
});
|
|
5709
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5710
|
+
const toolCallId = value.item.id;
|
|
5711
|
+
const toolName = toolNameMapping.toCustomToolName("tool_search");
|
|
5712
|
+
const isHosted = value.item.execution === "server";
|
|
5713
|
+
ongoingToolCalls[value.output_index] = {
|
|
5714
|
+
toolName,
|
|
5715
|
+
toolCallId,
|
|
5716
|
+
toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
|
|
5717
|
+
};
|
|
5718
|
+
if (isHosted) {
|
|
5719
|
+
controller.enqueue({
|
|
5720
|
+
type: "tool-input-start",
|
|
5721
|
+
id: toolCallId,
|
|
5722
|
+
toolName,
|
|
5723
|
+
providerExecuted: true
|
|
5724
|
+
});
|
|
5725
|
+
}
|
|
5726
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5249
5727
|
} else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
|
|
5250
5728
|
} else if (value.item.type === "apply_patch_call") {
|
|
5251
5729
|
const { call_id: callId, operation } = value.item;
|
|
@@ -5292,7 +5770,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5292
5770
|
} else if (value.item.type === "shell_call_output") {
|
|
5293
5771
|
} else if (value.item.type === "message") {
|
|
5294
5772
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
5295
|
-
activeMessagePhase = (
|
|
5773
|
+
activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
|
|
5296
5774
|
controller.enqueue({
|
|
5297
5775
|
type: "text-start",
|
|
5298
5776
|
id: value.item.id,
|
|
@@ -5316,14 +5794,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5316
5794
|
providerMetadata: {
|
|
5317
5795
|
[providerOptionsName]: {
|
|
5318
5796
|
itemId: value.item.id,
|
|
5319
|
-
reasoningEncryptedContent: (
|
|
5797
|
+
reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
|
|
5320
5798
|
}
|
|
5321
5799
|
}
|
|
5322
5800
|
});
|
|
5323
5801
|
}
|
|
5324
5802
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
5325
5803
|
if (value.item.type === "message") {
|
|
5326
|
-
const phase = (
|
|
5804
|
+
const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
|
|
5327
5805
|
activeMessagePhase = void 0;
|
|
5328
5806
|
controller.enqueue({
|
|
5329
5807
|
type: "text-end",
|
|
@@ -5417,13 +5895,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5417
5895
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5418
5896
|
result: {
|
|
5419
5897
|
queries: value.item.queries,
|
|
5420
|
-
results: (
|
|
5898
|
+
results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
|
|
5421
5899
|
attributes: result.attributes,
|
|
5422
5900
|
fileId: result.file_id,
|
|
5423
5901
|
filename: result.filename,
|
|
5424
5902
|
score: result.score,
|
|
5425
5903
|
text: result.text
|
|
5426
|
-
}))) != null ?
|
|
5904
|
+
}))) != null ? _f : null
|
|
5427
5905
|
}
|
|
5428
5906
|
});
|
|
5429
5907
|
} else if (value.item.type === "code_interpreter_call") {
|
|
@@ -5445,12 +5923,62 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5445
5923
|
result: value.item.result
|
|
5446
5924
|
}
|
|
5447
5925
|
});
|
|
5926
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5927
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
5928
|
+
const isHosted = value.item.execution === "server";
|
|
5929
|
+
if (toolCall != null) {
|
|
5930
|
+
const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
|
|
5931
|
+
if (isHosted) {
|
|
5932
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5933
|
+
} else {
|
|
5934
|
+
controller.enqueue({
|
|
5935
|
+
type: "tool-input-start",
|
|
5936
|
+
id: toolCallId,
|
|
5937
|
+
toolName: toolCall.toolName
|
|
5938
|
+
});
|
|
5939
|
+
}
|
|
5940
|
+
controller.enqueue({
|
|
5941
|
+
type: "tool-input-end",
|
|
5942
|
+
id: toolCallId
|
|
5943
|
+
});
|
|
5944
|
+
controller.enqueue({
|
|
5945
|
+
type: "tool-call",
|
|
5946
|
+
toolCallId,
|
|
5947
|
+
toolName: toolCall.toolName,
|
|
5948
|
+
input: JSON.stringify({
|
|
5949
|
+
arguments: value.item.arguments,
|
|
5950
|
+
call_id: isHosted ? null : toolCallId
|
|
5951
|
+
}),
|
|
5952
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5953
|
+
providerMetadata: {
|
|
5954
|
+
[providerOptionsName]: {
|
|
5955
|
+
itemId: value.item.id
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5958
|
+
});
|
|
5959
|
+
}
|
|
5960
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
5961
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5962
|
+
const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
|
|
5963
|
+
controller.enqueue({
|
|
5964
|
+
type: "tool-result",
|
|
5965
|
+
toolCallId,
|
|
5966
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5967
|
+
result: {
|
|
5968
|
+
tools: value.item.tools
|
|
5969
|
+
},
|
|
5970
|
+
providerMetadata: {
|
|
5971
|
+
[providerOptionsName]: {
|
|
5972
|
+
itemId: value.item.id
|
|
5973
|
+
}
|
|
5974
|
+
}
|
|
5975
|
+
});
|
|
5448
5976
|
} else if (value.item.type === "mcp_call") {
|
|
5449
5977
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5450
|
-
const approvalRequestId = (
|
|
5451
|
-
const aliasedToolCallId = approvalRequestId != null ? (
|
|
5978
|
+
const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
|
|
5979
|
+
const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
5452
5980
|
approvalRequestId
|
|
5453
|
-
)) != null ?
|
|
5981
|
+
)) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
|
|
5454
5982
|
const toolName = `mcp.${value.item.name}`;
|
|
5455
5983
|
controller.enqueue({
|
|
5456
5984
|
type: "tool-call",
|
|
@@ -5520,8 +6048,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5520
6048
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5521
6049
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5522
6050
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5523
|
-
const dummyToolCallId = (
|
|
5524
|
-
const approvalRequestId = (
|
|
6051
|
+
const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils32.generateId)();
|
|
6052
|
+
const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
|
|
5525
6053
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5526
6054
|
approvalRequestId,
|
|
5527
6055
|
dummyToolCallId
|
|
@@ -5610,12 +6138,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5610
6138
|
providerMetadata: {
|
|
5611
6139
|
[providerOptionsName]: {
|
|
5612
6140
|
itemId: value.item.id,
|
|
5613
|
-
reasoningEncryptedContent: (
|
|
6141
|
+
reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
|
|
5614
6142
|
}
|
|
5615
6143
|
}
|
|
5616
6144
|
});
|
|
5617
6145
|
}
|
|
5618
6146
|
delete activeReasoning[value.item.id];
|
|
6147
|
+
} else if (value.item.type === "compaction") {
|
|
6148
|
+
controller.enqueue({
|
|
6149
|
+
type: "custom",
|
|
6150
|
+
kind: "openai.compaction",
|
|
6151
|
+
providerMetadata: {
|
|
6152
|
+
[providerOptionsName]: {
|
|
6153
|
+
type: "compaction",
|
|
6154
|
+
itemId: value.item.id,
|
|
6155
|
+
encryptedContent: value.item.encrypted_content
|
|
6156
|
+
}
|
|
6157
|
+
}
|
|
6158
|
+
});
|
|
5619
6159
|
}
|
|
5620
6160
|
} else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
|
|
5621
6161
|
const toolCall = ongoingToolCalls[value.output_index];
|
|
@@ -5723,7 +6263,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5723
6263
|
id: value.item_id,
|
|
5724
6264
|
delta: value.delta
|
|
5725
6265
|
});
|
|
5726
|
-
if (((
|
|
6266
|
+
if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
|
|
5727
6267
|
logprobs.push(value.logprobs);
|
|
5728
6268
|
}
|
|
5729
6269
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -5752,7 +6292,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5752
6292
|
providerMetadata: {
|
|
5753
6293
|
[providerOptionsName]: {
|
|
5754
6294
|
itemId: value.item_id,
|
|
5755
|
-
reasoningEncryptedContent: (
|
|
6295
|
+
reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
|
|
5756
6296
|
}
|
|
5757
6297
|
}
|
|
5758
6298
|
});
|
|
@@ -5786,22 +6326,32 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5786
6326
|
} else if (isResponseFinishedChunk(value)) {
|
|
5787
6327
|
finishReason = {
|
|
5788
6328
|
unified: mapOpenAIResponseFinishReason({
|
|
5789
|
-
finishReason: (
|
|
6329
|
+
finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
|
|
5790
6330
|
hasFunctionCall
|
|
5791
6331
|
}),
|
|
5792
|
-
raw: (
|
|
6332
|
+
raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
|
|
5793
6333
|
};
|
|
5794
6334
|
usage = value.response.usage;
|
|
5795
6335
|
if (typeof value.response.service_tier === "string") {
|
|
5796
6336
|
serviceTier = value.response.service_tier;
|
|
5797
6337
|
}
|
|
6338
|
+
} else if (isResponseFailedChunk(value)) {
|
|
6339
|
+
const incompleteReason = (_y = value.response.incomplete_details) == null ? void 0 : _y.reason;
|
|
6340
|
+
finishReason = {
|
|
6341
|
+
unified: incompleteReason ? mapOpenAIResponseFinishReason({
|
|
6342
|
+
finishReason: incompleteReason,
|
|
6343
|
+
hasFunctionCall
|
|
6344
|
+
}) : "error",
|
|
6345
|
+
raw: incompleteReason != null ? incompleteReason : "error"
|
|
6346
|
+
};
|
|
6347
|
+
usage = (_z = value.response.usage) != null ? _z : void 0;
|
|
5798
6348
|
} else if (isResponseAnnotationAddedChunk(value)) {
|
|
5799
6349
|
ongoingAnnotations.push(value.annotation);
|
|
5800
6350
|
if (value.annotation.type === "url_citation") {
|
|
5801
6351
|
controller.enqueue({
|
|
5802
6352
|
type: "source",
|
|
5803
6353
|
sourceType: "url",
|
|
5804
|
-
id: (
|
|
6354
|
+
id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0, import_provider_utils32.generateId)(),
|
|
5805
6355
|
url: value.annotation.url,
|
|
5806
6356
|
title: value.annotation.title
|
|
5807
6357
|
});
|
|
@@ -5809,7 +6359,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5809
6359
|
controller.enqueue({
|
|
5810
6360
|
type: "source",
|
|
5811
6361
|
sourceType: "document",
|
|
5812
|
-
id: (
|
|
6362
|
+
id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0, import_provider_utils32.generateId)(),
|
|
5813
6363
|
mediaType: "text/plain",
|
|
5814
6364
|
title: value.annotation.filename,
|
|
5815
6365
|
filename: value.annotation.filename,
|
|
@@ -5825,7 +6375,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5825
6375
|
controller.enqueue({
|
|
5826
6376
|
type: "source",
|
|
5827
6377
|
sourceType: "document",
|
|
5828
|
-
id: (
|
|
6378
|
+
id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : (0, import_provider_utils32.generateId)(),
|
|
5829
6379
|
mediaType: "text/plain",
|
|
5830
6380
|
title: value.annotation.filename,
|
|
5831
6381
|
filename: value.annotation.filename,
|
|
@@ -5841,7 +6391,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5841
6391
|
controller.enqueue({
|
|
5842
6392
|
type: "source",
|
|
5843
6393
|
sourceType: "document",
|
|
5844
|
-
id: (
|
|
6394
|
+
id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : (0, import_provider_utils32.generateId)(),
|
|
5845
6395
|
mediaType: "application/octet-stream",
|
|
5846
6396
|
title: value.annotation.file_id,
|
|
5847
6397
|
filename: value.annotation.file_id,
|
|
@@ -5889,6 +6439,9 @@ function isResponseOutputItemDoneChunk(chunk) {
|
|
|
5889
6439
|
function isResponseFinishedChunk(chunk) {
|
|
5890
6440
|
return chunk.type === "response.completed" || chunk.type === "response.incomplete";
|
|
5891
6441
|
}
|
|
6442
|
+
function isResponseFailedChunk(chunk) {
|
|
6443
|
+
return chunk.type === "response.failed";
|
|
6444
|
+
}
|
|
5892
6445
|
function isResponseCreatedChunk(chunk) {
|
|
5893
6446
|
return chunk.type === "response.created";
|
|
5894
6447
|
}
|
|
@@ -5951,16 +6504,16 @@ function escapeJSONDelta(delta) {
|
|
|
5951
6504
|
}
|
|
5952
6505
|
|
|
5953
6506
|
// src/speech/openai-speech-model.ts
|
|
5954
|
-
var
|
|
6507
|
+
var import_provider_utils34 = require("@ai-sdk/provider-utils");
|
|
5955
6508
|
|
|
5956
6509
|
// src/speech/openai-speech-options.ts
|
|
5957
|
-
var
|
|
5958
|
-
var
|
|
5959
|
-
var openaiSpeechModelOptionsSchema = (0,
|
|
5960
|
-
() => (0,
|
|
5961
|
-
|
|
5962
|
-
instructions:
|
|
5963
|
-
speed:
|
|
6510
|
+
var import_provider_utils33 = require("@ai-sdk/provider-utils");
|
|
6511
|
+
var import_v425 = require("zod/v4");
|
|
6512
|
+
var openaiSpeechModelOptionsSchema = (0, import_provider_utils33.lazySchema)(
|
|
6513
|
+
() => (0, import_provider_utils33.zodSchema)(
|
|
6514
|
+
import_v425.z.object({
|
|
6515
|
+
instructions: import_v425.z.string().nullish(),
|
|
6516
|
+
speed: import_v425.z.number().min(0.25).max(4).default(1).nullish()
|
|
5964
6517
|
})
|
|
5965
6518
|
)
|
|
5966
6519
|
);
|
|
@@ -5970,7 +6523,7 @@ var OpenAISpeechModel = class {
|
|
|
5970
6523
|
constructor(modelId, config) {
|
|
5971
6524
|
this.modelId = modelId;
|
|
5972
6525
|
this.config = config;
|
|
5973
|
-
this.specificationVersion = "
|
|
6526
|
+
this.specificationVersion = "v4";
|
|
5974
6527
|
}
|
|
5975
6528
|
get provider() {
|
|
5976
6529
|
return this.config.provider;
|
|
@@ -5985,7 +6538,7 @@ var OpenAISpeechModel = class {
|
|
|
5985
6538
|
providerOptions
|
|
5986
6539
|
}) {
|
|
5987
6540
|
const warnings = [];
|
|
5988
|
-
const openAIOptions = await (0,
|
|
6541
|
+
const openAIOptions = await (0, import_provider_utils34.parseProviderOptions)({
|
|
5989
6542
|
provider: "openai",
|
|
5990
6543
|
providerOptions,
|
|
5991
6544
|
schema: openaiSpeechModelOptionsSchema
|
|
@@ -6038,15 +6591,15 @@ var OpenAISpeechModel = class {
|
|
|
6038
6591
|
value: audio,
|
|
6039
6592
|
responseHeaders,
|
|
6040
6593
|
rawValue: rawResponse
|
|
6041
|
-
} = await (0,
|
|
6594
|
+
} = await (0, import_provider_utils34.postJsonToApi)({
|
|
6042
6595
|
url: this.config.url({
|
|
6043
6596
|
path: "/audio/speech",
|
|
6044
6597
|
modelId: this.modelId
|
|
6045
6598
|
}),
|
|
6046
|
-
headers: (0,
|
|
6599
|
+
headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
|
|
6047
6600
|
body: requestBody,
|
|
6048
6601
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6049
|
-
successfulResponseHandler: (0,
|
|
6602
|
+
successfulResponseHandler: (0, import_provider_utils34.createBinaryResponseHandler)(),
|
|
6050
6603
|
abortSignal: options.abortSignal,
|
|
6051
6604
|
fetch: this.config.fetch
|
|
6052
6605
|
});
|
|
@@ -6067,36 +6620,36 @@ var OpenAISpeechModel = class {
|
|
|
6067
6620
|
};
|
|
6068
6621
|
|
|
6069
6622
|
// src/transcription/openai-transcription-model.ts
|
|
6070
|
-
var
|
|
6623
|
+
var import_provider_utils37 = require("@ai-sdk/provider-utils");
|
|
6071
6624
|
|
|
6072
6625
|
// src/transcription/openai-transcription-api.ts
|
|
6073
|
-
var
|
|
6074
|
-
var
|
|
6075
|
-
var openaiTranscriptionResponseSchema = (0,
|
|
6076
|
-
() => (0,
|
|
6077
|
-
|
|
6078
|
-
text:
|
|
6079
|
-
language:
|
|
6080
|
-
duration:
|
|
6081
|
-
words:
|
|
6082
|
-
|
|
6083
|
-
word:
|
|
6084
|
-
start:
|
|
6085
|
-
end:
|
|
6626
|
+
var import_provider_utils35 = require("@ai-sdk/provider-utils");
|
|
6627
|
+
var import_v426 = require("zod/v4");
|
|
6628
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils35.lazySchema)(
|
|
6629
|
+
() => (0, import_provider_utils35.zodSchema)(
|
|
6630
|
+
import_v426.z.object({
|
|
6631
|
+
text: import_v426.z.string(),
|
|
6632
|
+
language: import_v426.z.string().nullish(),
|
|
6633
|
+
duration: import_v426.z.number().nullish(),
|
|
6634
|
+
words: import_v426.z.array(
|
|
6635
|
+
import_v426.z.object({
|
|
6636
|
+
word: import_v426.z.string(),
|
|
6637
|
+
start: import_v426.z.number(),
|
|
6638
|
+
end: import_v426.z.number()
|
|
6086
6639
|
})
|
|
6087
6640
|
).nullish(),
|
|
6088
|
-
segments:
|
|
6089
|
-
|
|
6090
|
-
id:
|
|
6091
|
-
seek:
|
|
6092
|
-
start:
|
|
6093
|
-
end:
|
|
6094
|
-
text:
|
|
6095
|
-
tokens:
|
|
6096
|
-
temperature:
|
|
6097
|
-
avg_logprob:
|
|
6098
|
-
compression_ratio:
|
|
6099
|
-
no_speech_prob:
|
|
6641
|
+
segments: import_v426.z.array(
|
|
6642
|
+
import_v426.z.object({
|
|
6643
|
+
id: import_v426.z.number(),
|
|
6644
|
+
seek: import_v426.z.number(),
|
|
6645
|
+
start: import_v426.z.number(),
|
|
6646
|
+
end: import_v426.z.number(),
|
|
6647
|
+
text: import_v426.z.string(),
|
|
6648
|
+
tokens: import_v426.z.array(import_v426.z.number()),
|
|
6649
|
+
temperature: import_v426.z.number(),
|
|
6650
|
+
avg_logprob: import_v426.z.number(),
|
|
6651
|
+
compression_ratio: import_v426.z.number(),
|
|
6652
|
+
no_speech_prob: import_v426.z.number()
|
|
6100
6653
|
})
|
|
6101
6654
|
).nullish()
|
|
6102
6655
|
})
|
|
@@ -6104,33 +6657,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils31.lazySchema)(
|
|
|
6104
6657
|
);
|
|
6105
6658
|
|
|
6106
6659
|
// src/transcription/openai-transcription-options.ts
|
|
6107
|
-
var
|
|
6108
|
-
var
|
|
6109
|
-
var openAITranscriptionModelOptions = (0,
|
|
6110
|
-
() => (0,
|
|
6111
|
-
|
|
6660
|
+
var import_provider_utils36 = require("@ai-sdk/provider-utils");
|
|
6661
|
+
var import_v427 = require("zod/v4");
|
|
6662
|
+
var openAITranscriptionModelOptions = (0, import_provider_utils36.lazySchema)(
|
|
6663
|
+
() => (0, import_provider_utils36.zodSchema)(
|
|
6664
|
+
import_v427.z.object({
|
|
6112
6665
|
/**
|
|
6113
6666
|
* Additional information to include in the transcription response.
|
|
6114
6667
|
*/
|
|
6115
|
-
include:
|
|
6668
|
+
include: import_v427.z.array(import_v427.z.string()).optional(),
|
|
6116
6669
|
/**
|
|
6117
6670
|
* The language of the input audio in ISO-639-1 format.
|
|
6118
6671
|
*/
|
|
6119
|
-
language:
|
|
6672
|
+
language: import_v427.z.string().optional(),
|
|
6120
6673
|
/**
|
|
6121
6674
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
6122
6675
|
*/
|
|
6123
|
-
prompt:
|
|
6676
|
+
prompt: import_v427.z.string().optional(),
|
|
6124
6677
|
/**
|
|
6125
6678
|
* The sampling temperature, between 0 and 1.
|
|
6126
6679
|
* @default 0
|
|
6127
6680
|
*/
|
|
6128
|
-
temperature:
|
|
6681
|
+
temperature: import_v427.z.number().min(0).max(1).default(0).optional(),
|
|
6129
6682
|
/**
|
|
6130
6683
|
* The timestamp granularities to populate for this transcription.
|
|
6131
6684
|
* @default ['segment']
|
|
6132
6685
|
*/
|
|
6133
|
-
timestampGranularities:
|
|
6686
|
+
timestampGranularities: import_v427.z.array(import_v427.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
6134
6687
|
})
|
|
6135
6688
|
)
|
|
6136
6689
|
);
|
|
@@ -6199,7 +6752,7 @@ var OpenAITranscriptionModel = class {
|
|
|
6199
6752
|
constructor(modelId, config) {
|
|
6200
6753
|
this.modelId = modelId;
|
|
6201
6754
|
this.config = config;
|
|
6202
|
-
this.specificationVersion = "
|
|
6755
|
+
this.specificationVersion = "v4";
|
|
6203
6756
|
}
|
|
6204
6757
|
get provider() {
|
|
6205
6758
|
return this.config.provider;
|
|
@@ -6210,15 +6763,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6210
6763
|
providerOptions
|
|
6211
6764
|
}) {
|
|
6212
6765
|
const warnings = [];
|
|
6213
|
-
const openAIOptions = await (0,
|
|
6766
|
+
const openAIOptions = await (0, import_provider_utils37.parseProviderOptions)({
|
|
6214
6767
|
provider: "openai",
|
|
6215
6768
|
providerOptions,
|
|
6216
6769
|
schema: openAITranscriptionModelOptions
|
|
6217
6770
|
});
|
|
6218
6771
|
const formData = new FormData();
|
|
6219
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
6772
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils37.convertBase64ToUint8Array)(audio)]);
|
|
6220
6773
|
formData.append("model", this.modelId);
|
|
6221
|
-
const fileExtension = (0,
|
|
6774
|
+
const fileExtension = (0, import_provider_utils37.mediaTypeToExtension)(mediaType);
|
|
6222
6775
|
formData.append(
|
|
6223
6776
|
"file",
|
|
6224
6777
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -6263,15 +6816,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6263
6816
|
value: response,
|
|
6264
6817
|
responseHeaders,
|
|
6265
6818
|
rawValue: rawResponse
|
|
6266
|
-
} = await (0,
|
|
6819
|
+
} = await (0, import_provider_utils37.postFormDataToApi)({
|
|
6267
6820
|
url: this.config.url({
|
|
6268
6821
|
path: "/audio/transcriptions",
|
|
6269
6822
|
modelId: this.modelId
|
|
6270
6823
|
}),
|
|
6271
|
-
headers: (0,
|
|
6824
|
+
headers: (0, import_provider_utils37.combineHeaders)(this.config.headers(), options.headers),
|
|
6272
6825
|
formData,
|
|
6273
6826
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6274
|
-
successfulResponseHandler: (0,
|
|
6827
|
+
successfulResponseHandler: (0, import_provider_utils37.createJsonResponseHandler)(
|
|
6275
6828
|
openaiTranscriptionResponseSchema
|
|
6276
6829
|
),
|
|
6277
6830
|
abortSignal: options.abortSignal,
|
|
@@ -6303,21 +6856,21 @@ var OpenAITranscriptionModel = class {
|
|
|
6303
6856
|
};
|
|
6304
6857
|
|
|
6305
6858
|
// src/version.ts
|
|
6306
|
-
var VERSION = true ? "4.0.0-beta.
|
|
6859
|
+
var VERSION = true ? "4.0.0-beta.21" : "0.0.0-test";
|
|
6307
6860
|
|
|
6308
6861
|
// src/openai-provider.ts
|
|
6309
6862
|
function createOpenAI(options = {}) {
|
|
6310
6863
|
var _a, _b;
|
|
6311
|
-
const baseURL = (_a = (0,
|
|
6312
|
-
(0,
|
|
6864
|
+
const baseURL = (_a = (0, import_provider_utils38.withoutTrailingSlash)(
|
|
6865
|
+
(0, import_provider_utils38.loadOptionalSetting)({
|
|
6313
6866
|
settingValue: options.baseURL,
|
|
6314
6867
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
6315
6868
|
})
|
|
6316
6869
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
6317
6870
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
6318
|
-
const getHeaders = () => (0,
|
|
6871
|
+
const getHeaders = () => (0, import_provider_utils38.withUserAgentSuffix)(
|
|
6319
6872
|
{
|
|
6320
|
-
Authorization: `Bearer ${(0,
|
|
6873
|
+
Authorization: `Bearer ${(0, import_provider_utils38.loadApiKey)({
|
|
6321
6874
|
apiKey: options.apiKey,
|
|
6322
6875
|
environmentVariableName: "OPENAI_API_KEY",
|
|
6323
6876
|
description: "OpenAI"
|
|
@@ -6364,6 +6917,12 @@ function createOpenAI(options = {}) {
|
|
|
6364
6917
|
headers: getHeaders,
|
|
6365
6918
|
fetch: options.fetch
|
|
6366
6919
|
});
|
|
6920
|
+
const createFiles = () => new OpenAIFiles({
|
|
6921
|
+
provider: `${providerName}.files`,
|
|
6922
|
+
baseURL,
|
|
6923
|
+
headers: getHeaders,
|
|
6924
|
+
fetch: options.fetch
|
|
6925
|
+
});
|
|
6367
6926
|
const createLanguageModel = (modelId) => {
|
|
6368
6927
|
if (new.target) {
|
|
6369
6928
|
throw new Error(
|
|
@@ -6378,13 +6937,14 @@ function createOpenAI(options = {}) {
|
|
|
6378
6937
|
url: ({ path }) => `${baseURL}${path}`,
|
|
6379
6938
|
headers: getHeaders,
|
|
6380
6939
|
fetch: options.fetch,
|
|
6940
|
+
// Soft-deprecated. TODO: remove in v8
|
|
6381
6941
|
fileIdPrefixes: ["file-"]
|
|
6382
6942
|
});
|
|
6383
6943
|
};
|
|
6384
6944
|
const provider = function(modelId) {
|
|
6385
6945
|
return createLanguageModel(modelId);
|
|
6386
6946
|
};
|
|
6387
|
-
provider.specificationVersion = "
|
|
6947
|
+
provider.specificationVersion = "v4";
|
|
6388
6948
|
provider.languageModel = createLanguageModel;
|
|
6389
6949
|
provider.chat = createChatModel;
|
|
6390
6950
|
provider.completion = createCompletionModel;
|
|
@@ -6399,6 +6959,7 @@ function createOpenAI(options = {}) {
|
|
|
6399
6959
|
provider.transcriptionModel = createTranscriptionModel;
|
|
6400
6960
|
provider.speech = createSpeechModel;
|
|
6401
6961
|
provider.speechModel = createSpeechModel;
|
|
6962
|
+
provider.files = createFiles;
|
|
6402
6963
|
provider.tools = openaiTools;
|
|
6403
6964
|
return provider;
|
|
6404
6965
|
}
|