@ai-sdk/openai 2.0.104 → 2.0.106
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 +15 -0
- package/dist/index.d.mts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +686 -624
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +637 -571
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +20 -2
- package/dist/internal/index.d.ts +20 -2
- package/dist/internal/index.js +683 -617
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +638 -570
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/internal/index.js
CHANGED
|
@@ -44,6 +44,8 @@ __export(index_exports, {
|
|
|
44
44
|
openaiChatLanguageModelOptions: () => openaiChatLanguageModelOptions,
|
|
45
45
|
openaiCompletionProviderOptions: () => openaiCompletionProviderOptions,
|
|
46
46
|
openaiEmbeddingProviderOptions: () => openaiEmbeddingProviderOptions,
|
|
47
|
+
openaiImageModelGenerationOptions: () => openaiImageModelGenerationOptions,
|
|
48
|
+
openaiImageModelOptions: () => openaiImageModelOptions,
|
|
47
49
|
openaiSpeechProviderOptionsSchema: () => openaiSpeechProviderOptionsSchema,
|
|
48
50
|
webSearchPreview: () => webSearchPreview,
|
|
49
51
|
webSearchPreviewArgsSchema: () => webSearchPreviewArgsSchema,
|
|
@@ -1653,7 +1655,7 @@ var OpenAIEmbeddingModel = class {
|
|
|
1653
1655
|
};
|
|
1654
1656
|
|
|
1655
1657
|
// src/image/openai-image-model.ts
|
|
1656
|
-
var
|
|
1658
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
1657
1659
|
|
|
1658
1660
|
// src/image/openai-image-api.ts
|
|
1659
1661
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
@@ -1686,6 +1688,8 @@ var openaiImageResponseSchema = (0, import_provider_utils12.lazyValidator)(
|
|
|
1686
1688
|
);
|
|
1687
1689
|
|
|
1688
1690
|
// src/image/openai-image-options.ts
|
|
1691
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
1692
|
+
var import_v49 = require("zod/v4");
|
|
1689
1693
|
var modelMaxImagesPerCall = {
|
|
1690
1694
|
"dall-e-3": 1,
|
|
1691
1695
|
"dall-e-2": 10,
|
|
@@ -1700,6 +1704,55 @@ var hasDefaultResponseFormat = /* @__PURE__ */ new Set([
|
|
|
1700
1704
|
"gpt-image-1.5",
|
|
1701
1705
|
"gpt-image-2"
|
|
1702
1706
|
]);
|
|
1707
|
+
var baseImageModelOptionsObject = import_v49.z.object({
|
|
1708
|
+
/**
|
|
1709
|
+
* Quality of the generated image(s).
|
|
1710
|
+
*
|
|
1711
|
+
* Valid values: `standard`, `hd`, `low`, `medium`, `high`, `auto`.
|
|
1712
|
+
*/
|
|
1713
|
+
quality: import_v49.z.enum(["standard", "hd", "low", "medium", "high", "auto"]).optional(),
|
|
1714
|
+
/**
|
|
1715
|
+
* Background behavior for the generated image(s).
|
|
1716
|
+
*
|
|
1717
|
+
* If `transparent`, the output format must support transparency
|
|
1718
|
+
* (i.e. `png` or `webp`).
|
|
1719
|
+
*/
|
|
1720
|
+
background: import_v49.z.enum(["transparent", "opaque", "auto"]).optional(),
|
|
1721
|
+
/**
|
|
1722
|
+
* Format in which the generated image(s) are returned.
|
|
1723
|
+
*/
|
|
1724
|
+
outputFormat: import_v49.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
1725
|
+
/**
|
|
1726
|
+
* Compression level (0-100) for the generated image(s). Applies to the
|
|
1727
|
+
* `jpeg` and `webp` output formats.
|
|
1728
|
+
*/
|
|
1729
|
+
outputCompression: import_v49.z.number().int().min(0).max(100).optional(),
|
|
1730
|
+
/**
|
|
1731
|
+
* A unique identifier representing your end-user, which can help OpenAI
|
|
1732
|
+
* to monitor and detect abuse.
|
|
1733
|
+
*/
|
|
1734
|
+
user: import_v49.z.string().optional()
|
|
1735
|
+
});
|
|
1736
|
+
var openaiImageModelOptions = (0, import_provider_utils13.lazyValidator)(
|
|
1737
|
+
() => (0, import_provider_utils13.zodSchema)(baseImageModelOptionsObject)
|
|
1738
|
+
);
|
|
1739
|
+
var openaiImageModelGenerationOptions = (0, import_provider_utils13.lazyValidator)(
|
|
1740
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1741
|
+
baseImageModelOptionsObject.extend({
|
|
1742
|
+
/**
|
|
1743
|
+
* Style of the generated image. `vivid` produces hyper-real and
|
|
1744
|
+
* dramatic images; `natural` produces more subdued, less hyper-real
|
|
1745
|
+
* looking images.
|
|
1746
|
+
*/
|
|
1747
|
+
style: import_v49.z.enum(["vivid", "natural"]).optional(),
|
|
1748
|
+
/**
|
|
1749
|
+
* Content moderation level for the generated image(s). `low` applies
|
|
1750
|
+
* less restrictive filtering.
|
|
1751
|
+
*/
|
|
1752
|
+
moderation: import_v49.z.enum(["auto", "low"]).optional()
|
|
1753
|
+
})
|
|
1754
|
+
)
|
|
1755
|
+
);
|
|
1703
1756
|
|
|
1704
1757
|
// src/image/openai-image-model.ts
|
|
1705
1758
|
var OpenAIImageModel = class {
|
|
@@ -1738,22 +1791,33 @@ var OpenAIImageModel = class {
|
|
|
1738
1791
|
warnings.push({ type: "unsupported-setting", setting: "seed" });
|
|
1739
1792
|
}
|
|
1740
1793
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1741
|
-
const
|
|
1794
|
+
const openaiOptions = (_d = await (0, import_provider_utils14.parseProviderOptions)({
|
|
1795
|
+
provider: "openai",
|
|
1796
|
+
providerOptions,
|
|
1797
|
+
schema: openaiImageModelGenerationOptions
|
|
1798
|
+
})) != null ? _d : {};
|
|
1799
|
+
const { value: response, responseHeaders } = await (0, import_provider_utils14.postJsonToApi)({
|
|
1742
1800
|
url: this.config.url({
|
|
1743
1801
|
path: "/images/generations",
|
|
1744
1802
|
modelId: this.modelId
|
|
1745
1803
|
}),
|
|
1746
|
-
headers: (0,
|
|
1804
|
+
headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), headers),
|
|
1747
1805
|
body: {
|
|
1748
1806
|
model: this.modelId,
|
|
1749
1807
|
prompt,
|
|
1750
1808
|
n,
|
|
1751
1809
|
size,
|
|
1752
|
-
|
|
1810
|
+
quality: openaiOptions.quality,
|
|
1811
|
+
style: openaiOptions.style,
|
|
1812
|
+
background: openaiOptions.background,
|
|
1813
|
+
moderation: openaiOptions.moderation,
|
|
1814
|
+
output_format: openaiOptions.outputFormat,
|
|
1815
|
+
output_compression: openaiOptions.outputCompression,
|
|
1816
|
+
user: openaiOptions.user,
|
|
1753
1817
|
...!hasDefaultResponseFormat.has(this.modelId) ? { response_format: "b64_json" } : {}
|
|
1754
1818
|
},
|
|
1755
1819
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
1756
|
-
successfulResponseHandler: (0,
|
|
1820
|
+
successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
|
|
1757
1821
|
openaiImageResponseSchema
|
|
1758
1822
|
),
|
|
1759
1823
|
abortSignal,
|
|
@@ -1817,36 +1881,36 @@ function distributeTokenDetails(usage, index, total) {
|
|
|
1817
1881
|
}
|
|
1818
1882
|
|
|
1819
1883
|
// src/transcription/openai-transcription-model.ts
|
|
1820
|
-
var
|
|
1884
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
1821
1885
|
|
|
1822
1886
|
// src/transcription/openai-transcription-api.ts
|
|
1823
|
-
var
|
|
1824
|
-
var
|
|
1825
|
-
var openaiTranscriptionResponseSchema = (0,
|
|
1826
|
-
() => (0,
|
|
1827
|
-
|
|
1828
|
-
text:
|
|
1829
|
-
language:
|
|
1830
|
-
duration:
|
|
1831
|
-
words:
|
|
1832
|
-
|
|
1833
|
-
word:
|
|
1834
|
-
start:
|
|
1835
|
-
end:
|
|
1887
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
1888
|
+
var import_v410 = require("zod/v4");
|
|
1889
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils15.lazyValidator)(
|
|
1890
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1891
|
+
import_v410.z.object({
|
|
1892
|
+
text: import_v410.z.string(),
|
|
1893
|
+
language: import_v410.z.string().nullish(),
|
|
1894
|
+
duration: import_v410.z.number().nullish(),
|
|
1895
|
+
words: import_v410.z.array(
|
|
1896
|
+
import_v410.z.object({
|
|
1897
|
+
word: import_v410.z.string(),
|
|
1898
|
+
start: import_v410.z.number(),
|
|
1899
|
+
end: import_v410.z.number()
|
|
1836
1900
|
})
|
|
1837
1901
|
).nullish(),
|
|
1838
|
-
segments:
|
|
1839
|
-
|
|
1840
|
-
id:
|
|
1841
|
-
seek:
|
|
1842
|
-
start:
|
|
1843
|
-
end:
|
|
1844
|
-
text:
|
|
1845
|
-
tokens:
|
|
1846
|
-
temperature:
|
|
1847
|
-
avg_logprob:
|
|
1848
|
-
compression_ratio:
|
|
1849
|
-
no_speech_prob:
|
|
1902
|
+
segments: import_v410.z.array(
|
|
1903
|
+
import_v410.z.object({
|
|
1904
|
+
id: import_v410.z.number(),
|
|
1905
|
+
seek: import_v410.z.number(),
|
|
1906
|
+
start: import_v410.z.number(),
|
|
1907
|
+
end: import_v410.z.number(),
|
|
1908
|
+
text: import_v410.z.string(),
|
|
1909
|
+
tokens: import_v410.z.array(import_v410.z.number()),
|
|
1910
|
+
temperature: import_v410.z.number(),
|
|
1911
|
+
avg_logprob: import_v410.z.number(),
|
|
1912
|
+
compression_ratio: import_v410.z.number(),
|
|
1913
|
+
no_speech_prob: import_v410.z.number()
|
|
1850
1914
|
})
|
|
1851
1915
|
).nullish()
|
|
1852
1916
|
})
|
|
@@ -1854,33 +1918,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils14.lazyValidato
|
|
|
1854
1918
|
);
|
|
1855
1919
|
|
|
1856
1920
|
// src/transcription/openai-transcription-options.ts
|
|
1857
|
-
var
|
|
1858
|
-
var
|
|
1859
|
-
var openAITranscriptionProviderOptions = (0,
|
|
1860
|
-
() => (0,
|
|
1861
|
-
|
|
1921
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
1922
|
+
var import_v411 = require("zod/v4");
|
|
1923
|
+
var openAITranscriptionProviderOptions = (0, import_provider_utils16.lazyValidator)(
|
|
1924
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
1925
|
+
import_v411.z.object({
|
|
1862
1926
|
/**
|
|
1863
1927
|
* Additional information to include in the transcription response.
|
|
1864
1928
|
*/
|
|
1865
|
-
include:
|
|
1929
|
+
include: import_v411.z.array(import_v411.z.string()).optional(),
|
|
1866
1930
|
/**
|
|
1867
1931
|
* The language of the input audio in ISO-639-1 format.
|
|
1868
1932
|
*/
|
|
1869
|
-
language:
|
|
1933
|
+
language: import_v411.z.string().optional(),
|
|
1870
1934
|
/**
|
|
1871
1935
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
1872
1936
|
*/
|
|
1873
|
-
prompt:
|
|
1937
|
+
prompt: import_v411.z.string().optional(),
|
|
1874
1938
|
/**
|
|
1875
1939
|
* The sampling temperature, between 0 and 1.
|
|
1876
1940
|
* @default 0
|
|
1877
1941
|
*/
|
|
1878
|
-
temperature:
|
|
1942
|
+
temperature: import_v411.z.number().min(0).max(1).default(0).optional(),
|
|
1879
1943
|
/**
|
|
1880
1944
|
* The timestamp granularities to populate for this transcription.
|
|
1881
1945
|
* @default ['segment']
|
|
1882
1946
|
*/
|
|
1883
|
-
timestampGranularities:
|
|
1947
|
+
timestampGranularities: import_v411.z.array(import_v411.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
1884
1948
|
})
|
|
1885
1949
|
)
|
|
1886
1950
|
);
|
|
@@ -1960,15 +2024,15 @@ var OpenAITranscriptionModel = class {
|
|
|
1960
2024
|
providerOptions
|
|
1961
2025
|
}) {
|
|
1962
2026
|
const warnings = [];
|
|
1963
|
-
const openAIOptions = await (0,
|
|
2027
|
+
const openAIOptions = await (0, import_provider_utils17.parseProviderOptions)({
|
|
1964
2028
|
provider: "openai",
|
|
1965
2029
|
providerOptions,
|
|
1966
2030
|
schema: openAITranscriptionProviderOptions
|
|
1967
2031
|
});
|
|
1968
2032
|
const formData = new FormData();
|
|
1969
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
2033
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils17.convertBase64ToUint8Array)(audio)]);
|
|
1970
2034
|
formData.append("model", this.modelId);
|
|
1971
|
-
const fileExtension = (0,
|
|
2035
|
+
const fileExtension = (0, import_provider_utils17.mediaTypeToExtension)(mediaType);
|
|
1972
2036
|
formData.append(
|
|
1973
2037
|
"file",
|
|
1974
2038
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -2013,15 +2077,15 @@ var OpenAITranscriptionModel = class {
|
|
|
2013
2077
|
value: response,
|
|
2014
2078
|
responseHeaders,
|
|
2015
2079
|
rawValue: rawResponse
|
|
2016
|
-
} = await (0,
|
|
2080
|
+
} = await (0, import_provider_utils17.postFormDataToApi)({
|
|
2017
2081
|
url: this.config.url({
|
|
2018
2082
|
path: "/audio/transcriptions",
|
|
2019
2083
|
modelId: this.modelId
|
|
2020
2084
|
}),
|
|
2021
|
-
headers: (0,
|
|
2085
|
+
headers: (0, import_provider_utils17.combineHeaders)(this.config.headers(), options.headers),
|
|
2022
2086
|
formData,
|
|
2023
2087
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2024
|
-
successfulResponseHandler: (0,
|
|
2088
|
+
successfulResponseHandler: (0, import_provider_utils17.createJsonResponseHandler)(
|
|
2025
2089
|
openaiTranscriptionResponseSchema
|
|
2026
2090
|
),
|
|
2027
2091
|
abortSignal: options.abortSignal,
|
|
@@ -2053,16 +2117,16 @@ var OpenAITranscriptionModel = class {
|
|
|
2053
2117
|
};
|
|
2054
2118
|
|
|
2055
2119
|
// src/speech/openai-speech-model.ts
|
|
2056
|
-
var
|
|
2120
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
2057
2121
|
|
|
2058
2122
|
// src/speech/openai-speech-options.ts
|
|
2059
|
-
var
|
|
2060
|
-
var
|
|
2061
|
-
var openaiSpeechProviderOptionsSchema = (0,
|
|
2062
|
-
() => (0,
|
|
2063
|
-
|
|
2064
|
-
instructions:
|
|
2065
|
-
speed:
|
|
2123
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
2124
|
+
var import_v412 = require("zod/v4");
|
|
2125
|
+
var openaiSpeechProviderOptionsSchema = (0, import_provider_utils18.lazyValidator)(
|
|
2126
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2127
|
+
import_v412.z.object({
|
|
2128
|
+
instructions: import_v412.z.string().nullish(),
|
|
2129
|
+
speed: import_v412.z.number().min(0.25).max(4).default(1).nullish()
|
|
2066
2130
|
})
|
|
2067
2131
|
)
|
|
2068
2132
|
);
|
|
@@ -2087,7 +2151,7 @@ var OpenAISpeechModel = class {
|
|
|
2087
2151
|
providerOptions
|
|
2088
2152
|
}) {
|
|
2089
2153
|
const warnings = [];
|
|
2090
|
-
const openAIOptions = await (0,
|
|
2154
|
+
const openAIOptions = await (0, import_provider_utils19.parseProviderOptions)({
|
|
2091
2155
|
provider: "openai",
|
|
2092
2156
|
providerOptions,
|
|
2093
2157
|
schema: openaiSpeechProviderOptionsSchema
|
|
@@ -2140,15 +2204,15 @@ var OpenAISpeechModel = class {
|
|
|
2140
2204
|
value: audio,
|
|
2141
2205
|
responseHeaders,
|
|
2142
2206
|
rawValue: rawResponse
|
|
2143
|
-
} = await (0,
|
|
2207
|
+
} = await (0, import_provider_utils19.postJsonToApi)({
|
|
2144
2208
|
url: this.config.url({
|
|
2145
2209
|
path: "/audio/speech",
|
|
2146
2210
|
modelId: this.modelId
|
|
2147
2211
|
}),
|
|
2148
|
-
headers: (0,
|
|
2212
|
+
headers: (0, import_provider_utils19.combineHeaders)(this.config.headers(), options.headers),
|
|
2149
2213
|
body: requestBody,
|
|
2150
2214
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2151
|
-
successfulResponseHandler: (0,
|
|
2215
|
+
successfulResponseHandler: (0, import_provider_utils19.createBinaryResponseHandler)(),
|
|
2152
2216
|
abortSignal: options.abortSignal,
|
|
2153
2217
|
fetch: this.config.fetch
|
|
2154
2218
|
});
|
|
@@ -2170,34 +2234,34 @@ var OpenAISpeechModel = class {
|
|
|
2170
2234
|
|
|
2171
2235
|
// src/responses/openai-responses-language-model.ts
|
|
2172
2236
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2173
|
-
var
|
|
2237
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
2174
2238
|
|
|
2175
2239
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2176
2240
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2177
|
-
var
|
|
2178
|
-
var
|
|
2241
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2242
|
+
var import_v414 = require("zod/v4");
|
|
2179
2243
|
|
|
2180
2244
|
// src/tool/local-shell.ts
|
|
2181
|
-
var
|
|
2182
|
-
var
|
|
2183
|
-
var localShellInputSchema = (0,
|
|
2184
|
-
() => (0,
|
|
2185
|
-
|
|
2186
|
-
action:
|
|
2187
|
-
type:
|
|
2188
|
-
command:
|
|
2189
|
-
timeoutMs:
|
|
2190
|
-
user:
|
|
2191
|
-
workingDirectory:
|
|
2192
|
-
env:
|
|
2245
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2246
|
+
var import_v413 = require("zod/v4");
|
|
2247
|
+
var localShellInputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2248
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2249
|
+
import_v413.z.object({
|
|
2250
|
+
action: import_v413.z.object({
|
|
2251
|
+
type: import_v413.z.literal("exec"),
|
|
2252
|
+
command: import_v413.z.array(import_v413.z.string()),
|
|
2253
|
+
timeoutMs: import_v413.z.number().optional(),
|
|
2254
|
+
user: import_v413.z.string().optional(),
|
|
2255
|
+
workingDirectory: import_v413.z.string().optional(),
|
|
2256
|
+
env: import_v413.z.record(import_v413.z.string(), import_v413.z.string()).optional()
|
|
2193
2257
|
})
|
|
2194
2258
|
})
|
|
2195
2259
|
)
|
|
2196
2260
|
);
|
|
2197
|
-
var localShellOutputSchema = (0,
|
|
2198
|
-
() => (0,
|
|
2261
|
+
var localShellOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2262
|
+
() => (0, import_provider_utils20.zodSchema)(import_v413.z.object({ output: import_v413.z.string() }))
|
|
2199
2263
|
);
|
|
2200
|
-
var localShell = (0,
|
|
2264
|
+
var localShell = (0, import_provider_utils20.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2201
2265
|
id: "openai.local_shell",
|
|
2202
2266
|
name: "local_shell",
|
|
2203
2267
|
inputSchema: localShellInputSchema,
|
|
@@ -2262,7 +2326,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2262
2326
|
return {
|
|
2263
2327
|
type: "input_image",
|
|
2264
2328
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2265
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2329
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
|
|
2266
2330
|
},
|
|
2267
2331
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2268
2332
|
};
|
|
@@ -2277,7 +2341,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2277
2341
|
type: "input_file",
|
|
2278
2342
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2279
2343
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2280
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2344
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
|
|
2281
2345
|
}
|
|
2282
2346
|
};
|
|
2283
2347
|
} else {
|
|
@@ -2322,7 +2386,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2322
2386
|
break;
|
|
2323
2387
|
}
|
|
2324
2388
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2325
|
-
const parsedInput = await (0,
|
|
2389
|
+
const parsedInput = await (0, import_provider_utils21.validateTypes)({
|
|
2326
2390
|
value: part.input,
|
|
2327
2391
|
schema: localShellInputSchema
|
|
2328
2392
|
});
|
|
@@ -2363,7 +2427,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2363
2427
|
break;
|
|
2364
2428
|
}
|
|
2365
2429
|
case "reasoning": {
|
|
2366
|
-
const providerOptions = await (0,
|
|
2430
|
+
const providerOptions = await (0, import_provider_utils21.parseProviderOptions)({
|
|
2367
2431
|
provider: "openai",
|
|
2368
2432
|
providerOptions: part.providerOptions,
|
|
2369
2433
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2424,7 +2488,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2424
2488
|
for (const part of content) {
|
|
2425
2489
|
const output = part.output;
|
|
2426
2490
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2427
|
-
const parsedOutput = await (0,
|
|
2491
|
+
const parsedOutput = await (0, import_provider_utils21.validateTypes)({
|
|
2428
2492
|
value: output.value,
|
|
2429
2493
|
schema: localShellOutputSchema
|
|
2430
2494
|
});
|
|
@@ -2492,9 +2556,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2492
2556
|
}
|
|
2493
2557
|
return { input, warnings };
|
|
2494
2558
|
}
|
|
2495
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2496
|
-
itemId:
|
|
2497
|
-
reasoningEncryptedContent:
|
|
2559
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v414.z.object({
|
|
2560
|
+
itemId: import_v414.z.string().nullish(),
|
|
2561
|
+
reasoningEncryptedContent: import_v414.z.string().nullish()
|
|
2498
2562
|
});
|
|
2499
2563
|
|
|
2500
2564
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2516,275 +2580,275 @@ function mapOpenAIResponseFinishReason({
|
|
|
2516
2580
|
}
|
|
2517
2581
|
|
|
2518
2582
|
// src/responses/openai-responses-api.ts
|
|
2519
|
-
var
|
|
2520
|
-
var
|
|
2521
|
-
var openaiResponsesChunkSchema = (0,
|
|
2522
|
-
() => (0,
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
type:
|
|
2526
|
-
item_id:
|
|
2527
|
-
delta:
|
|
2528
|
-
logprobs:
|
|
2529
|
-
|
|
2530
|
-
token:
|
|
2531
|
-
logprob:
|
|
2532
|
-
top_logprobs:
|
|
2533
|
-
|
|
2534
|
-
token:
|
|
2535
|
-
logprob:
|
|
2583
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2584
|
+
var import_v415 = require("zod/v4");
|
|
2585
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
|
|
2586
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2587
|
+
import_v415.z.union([
|
|
2588
|
+
import_v415.z.object({
|
|
2589
|
+
type: import_v415.z.literal("response.output_text.delta"),
|
|
2590
|
+
item_id: import_v415.z.string(),
|
|
2591
|
+
delta: import_v415.z.string(),
|
|
2592
|
+
logprobs: import_v415.z.array(
|
|
2593
|
+
import_v415.z.object({
|
|
2594
|
+
token: import_v415.z.string(),
|
|
2595
|
+
logprob: import_v415.z.number(),
|
|
2596
|
+
top_logprobs: import_v415.z.array(
|
|
2597
|
+
import_v415.z.object({
|
|
2598
|
+
token: import_v415.z.string(),
|
|
2599
|
+
logprob: import_v415.z.number()
|
|
2536
2600
|
})
|
|
2537
2601
|
)
|
|
2538
2602
|
})
|
|
2539
2603
|
).nullish()
|
|
2540
2604
|
}),
|
|
2541
|
-
|
|
2542
|
-
type:
|
|
2543
|
-
response:
|
|
2544
|
-
incomplete_details:
|
|
2545
|
-
usage:
|
|
2546
|
-
input_tokens:
|
|
2547
|
-
input_tokens_details:
|
|
2548
|
-
output_tokens:
|
|
2549
|
-
output_tokens_details:
|
|
2605
|
+
import_v415.z.object({
|
|
2606
|
+
type: import_v415.z.enum(["response.completed", "response.incomplete"]),
|
|
2607
|
+
response: import_v415.z.object({
|
|
2608
|
+
incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
|
|
2609
|
+
usage: import_v415.z.object({
|
|
2610
|
+
input_tokens: import_v415.z.number(),
|
|
2611
|
+
input_tokens_details: import_v415.z.object({ cached_tokens: import_v415.z.number().nullish() }).nullish(),
|
|
2612
|
+
output_tokens: import_v415.z.number(),
|
|
2613
|
+
output_tokens_details: import_v415.z.object({ reasoning_tokens: import_v415.z.number().nullish() }).nullish()
|
|
2550
2614
|
}),
|
|
2551
|
-
service_tier:
|
|
2615
|
+
service_tier: import_v415.z.string().nullish()
|
|
2552
2616
|
})
|
|
2553
2617
|
}),
|
|
2554
|
-
|
|
2555
|
-
type:
|
|
2556
|
-
response:
|
|
2557
|
-
id:
|
|
2558
|
-
created_at:
|
|
2559
|
-
model:
|
|
2560
|
-
service_tier:
|
|
2618
|
+
import_v415.z.object({
|
|
2619
|
+
type: import_v415.z.literal("response.created"),
|
|
2620
|
+
response: import_v415.z.object({
|
|
2621
|
+
id: import_v415.z.string(),
|
|
2622
|
+
created_at: import_v415.z.number(),
|
|
2623
|
+
model: import_v415.z.string(),
|
|
2624
|
+
service_tier: import_v415.z.string().nullish()
|
|
2561
2625
|
})
|
|
2562
2626
|
}),
|
|
2563
|
-
|
|
2564
|
-
type:
|
|
2565
|
-
output_index:
|
|
2566
|
-
item:
|
|
2567
|
-
|
|
2568
|
-
type:
|
|
2569
|
-
id:
|
|
2570
|
-
phase:
|
|
2627
|
+
import_v415.z.object({
|
|
2628
|
+
type: import_v415.z.literal("response.output_item.added"),
|
|
2629
|
+
output_index: import_v415.z.number(),
|
|
2630
|
+
item: import_v415.z.discriminatedUnion("type", [
|
|
2631
|
+
import_v415.z.object({
|
|
2632
|
+
type: import_v415.z.literal("message"),
|
|
2633
|
+
id: import_v415.z.string(),
|
|
2634
|
+
phase: import_v415.z.enum(["commentary", "final_answer"]).nullish()
|
|
2571
2635
|
}),
|
|
2572
|
-
|
|
2573
|
-
type:
|
|
2574
|
-
id:
|
|
2575
|
-
encrypted_content:
|
|
2636
|
+
import_v415.z.object({
|
|
2637
|
+
type: import_v415.z.literal("reasoning"),
|
|
2638
|
+
id: import_v415.z.string(),
|
|
2639
|
+
encrypted_content: import_v415.z.string().nullish()
|
|
2576
2640
|
}),
|
|
2577
|
-
|
|
2578
|
-
type:
|
|
2579
|
-
id:
|
|
2580
|
-
call_id:
|
|
2581
|
-
name:
|
|
2582
|
-
arguments:
|
|
2641
|
+
import_v415.z.object({
|
|
2642
|
+
type: import_v415.z.literal("function_call"),
|
|
2643
|
+
id: import_v415.z.string(),
|
|
2644
|
+
call_id: import_v415.z.string(),
|
|
2645
|
+
name: import_v415.z.string(),
|
|
2646
|
+
arguments: import_v415.z.string()
|
|
2583
2647
|
}),
|
|
2584
|
-
|
|
2585
|
-
type:
|
|
2586
|
-
id:
|
|
2587
|
-
status:
|
|
2648
|
+
import_v415.z.object({
|
|
2649
|
+
type: import_v415.z.literal("web_search_call"),
|
|
2650
|
+
id: import_v415.z.string(),
|
|
2651
|
+
status: import_v415.z.string()
|
|
2588
2652
|
}),
|
|
2589
|
-
|
|
2590
|
-
type:
|
|
2591
|
-
id:
|
|
2592
|
-
status:
|
|
2653
|
+
import_v415.z.object({
|
|
2654
|
+
type: import_v415.z.literal("computer_call"),
|
|
2655
|
+
id: import_v415.z.string(),
|
|
2656
|
+
status: import_v415.z.string()
|
|
2593
2657
|
}),
|
|
2594
|
-
|
|
2595
|
-
type:
|
|
2596
|
-
id:
|
|
2658
|
+
import_v415.z.object({
|
|
2659
|
+
type: import_v415.z.literal("file_search_call"),
|
|
2660
|
+
id: import_v415.z.string()
|
|
2597
2661
|
}),
|
|
2598
|
-
|
|
2599
|
-
type:
|
|
2600
|
-
id:
|
|
2662
|
+
import_v415.z.object({
|
|
2663
|
+
type: import_v415.z.literal("image_generation_call"),
|
|
2664
|
+
id: import_v415.z.string()
|
|
2601
2665
|
}),
|
|
2602
|
-
|
|
2603
|
-
type:
|
|
2604
|
-
id:
|
|
2605
|
-
container_id:
|
|
2606
|
-
code:
|
|
2607
|
-
outputs:
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2666
|
+
import_v415.z.object({
|
|
2667
|
+
type: import_v415.z.literal("code_interpreter_call"),
|
|
2668
|
+
id: import_v415.z.string(),
|
|
2669
|
+
container_id: import_v415.z.string(),
|
|
2670
|
+
code: import_v415.z.string().nullable(),
|
|
2671
|
+
outputs: import_v415.z.array(
|
|
2672
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2673
|
+
import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
|
|
2674
|
+
import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
|
|
2611
2675
|
])
|
|
2612
2676
|
).nullable(),
|
|
2613
|
-
status:
|
|
2677
|
+
status: import_v415.z.string()
|
|
2614
2678
|
})
|
|
2615
2679
|
])
|
|
2616
2680
|
}),
|
|
2617
|
-
|
|
2618
|
-
type:
|
|
2619
|
-
output_index:
|
|
2620
|
-
item:
|
|
2621
|
-
|
|
2622
|
-
type:
|
|
2623
|
-
id:
|
|
2624
|
-
phase:
|
|
2681
|
+
import_v415.z.object({
|
|
2682
|
+
type: import_v415.z.literal("response.output_item.done"),
|
|
2683
|
+
output_index: import_v415.z.number(),
|
|
2684
|
+
item: import_v415.z.discriminatedUnion("type", [
|
|
2685
|
+
import_v415.z.object({
|
|
2686
|
+
type: import_v415.z.literal("message"),
|
|
2687
|
+
id: import_v415.z.string(),
|
|
2688
|
+
phase: import_v415.z.enum(["commentary", "final_answer"]).nullish()
|
|
2625
2689
|
}),
|
|
2626
|
-
|
|
2627
|
-
type:
|
|
2628
|
-
id:
|
|
2629
|
-
encrypted_content:
|
|
2690
|
+
import_v415.z.object({
|
|
2691
|
+
type: import_v415.z.literal("reasoning"),
|
|
2692
|
+
id: import_v415.z.string(),
|
|
2693
|
+
encrypted_content: import_v415.z.string().nullish()
|
|
2630
2694
|
}),
|
|
2631
|
-
|
|
2632
|
-
type:
|
|
2633
|
-
id:
|
|
2634
|
-
call_id:
|
|
2635
|
-
name:
|
|
2636
|
-
arguments:
|
|
2637
|
-
status:
|
|
2695
|
+
import_v415.z.object({
|
|
2696
|
+
type: import_v415.z.literal("function_call"),
|
|
2697
|
+
id: import_v415.z.string(),
|
|
2698
|
+
call_id: import_v415.z.string(),
|
|
2699
|
+
name: import_v415.z.string(),
|
|
2700
|
+
arguments: import_v415.z.string(),
|
|
2701
|
+
status: import_v415.z.literal("completed")
|
|
2638
2702
|
}),
|
|
2639
|
-
|
|
2640
|
-
type:
|
|
2641
|
-
id:
|
|
2642
|
-
code:
|
|
2643
|
-
container_id:
|
|
2644
|
-
outputs:
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2703
|
+
import_v415.z.object({
|
|
2704
|
+
type: import_v415.z.literal("code_interpreter_call"),
|
|
2705
|
+
id: import_v415.z.string(),
|
|
2706
|
+
code: import_v415.z.string().nullable(),
|
|
2707
|
+
container_id: import_v415.z.string(),
|
|
2708
|
+
outputs: import_v415.z.array(
|
|
2709
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2710
|
+
import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
|
|
2711
|
+
import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
|
|
2648
2712
|
])
|
|
2649
2713
|
).nullable()
|
|
2650
2714
|
}),
|
|
2651
|
-
|
|
2652
|
-
type:
|
|
2653
|
-
id:
|
|
2654
|
-
result:
|
|
2715
|
+
import_v415.z.object({
|
|
2716
|
+
type: import_v415.z.literal("image_generation_call"),
|
|
2717
|
+
id: import_v415.z.string(),
|
|
2718
|
+
result: import_v415.z.string()
|
|
2655
2719
|
}),
|
|
2656
|
-
|
|
2657
|
-
type:
|
|
2658
|
-
id:
|
|
2659
|
-
status:
|
|
2660
|
-
action:
|
|
2661
|
-
|
|
2662
|
-
type:
|
|
2663
|
-
query:
|
|
2664
|
-
sources:
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2720
|
+
import_v415.z.object({
|
|
2721
|
+
type: import_v415.z.literal("web_search_call"),
|
|
2722
|
+
id: import_v415.z.string(),
|
|
2723
|
+
status: import_v415.z.string(),
|
|
2724
|
+
action: import_v415.z.discriminatedUnion("type", [
|
|
2725
|
+
import_v415.z.object({
|
|
2726
|
+
type: import_v415.z.literal("search"),
|
|
2727
|
+
query: import_v415.z.string().nullish(),
|
|
2728
|
+
sources: import_v415.z.array(
|
|
2729
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2730
|
+
import_v415.z.object({ type: import_v415.z.literal("url"), url: import_v415.z.string() }),
|
|
2731
|
+
import_v415.z.object({ type: import_v415.z.literal("api"), name: import_v415.z.string() })
|
|
2668
2732
|
])
|
|
2669
2733
|
).nullish()
|
|
2670
2734
|
}),
|
|
2671
|
-
|
|
2672
|
-
type:
|
|
2673
|
-
url:
|
|
2735
|
+
import_v415.z.object({
|
|
2736
|
+
type: import_v415.z.literal("open_page"),
|
|
2737
|
+
url: import_v415.z.string().nullish()
|
|
2674
2738
|
}),
|
|
2675
|
-
|
|
2676
|
-
type:
|
|
2677
|
-
url:
|
|
2678
|
-
pattern:
|
|
2739
|
+
import_v415.z.object({
|
|
2740
|
+
type: import_v415.z.literal("find_in_page"),
|
|
2741
|
+
url: import_v415.z.string().nullish(),
|
|
2742
|
+
pattern: import_v415.z.string().nullish()
|
|
2679
2743
|
})
|
|
2680
2744
|
]).nullish()
|
|
2681
2745
|
}),
|
|
2682
|
-
|
|
2683
|
-
type:
|
|
2684
|
-
id:
|
|
2685
|
-
queries:
|
|
2686
|
-
results:
|
|
2687
|
-
|
|
2688
|
-
attributes:
|
|
2689
|
-
file_id:
|
|
2690
|
-
filename:
|
|
2691
|
-
score:
|
|
2692
|
-
text:
|
|
2746
|
+
import_v415.z.object({
|
|
2747
|
+
type: import_v415.z.literal("file_search_call"),
|
|
2748
|
+
id: import_v415.z.string(),
|
|
2749
|
+
queries: import_v415.z.array(import_v415.z.string()),
|
|
2750
|
+
results: import_v415.z.array(
|
|
2751
|
+
import_v415.z.object({
|
|
2752
|
+
attributes: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()),
|
|
2753
|
+
file_id: import_v415.z.string(),
|
|
2754
|
+
filename: import_v415.z.string(),
|
|
2755
|
+
score: import_v415.z.number(),
|
|
2756
|
+
text: import_v415.z.string()
|
|
2693
2757
|
})
|
|
2694
2758
|
).nullish()
|
|
2695
2759
|
}),
|
|
2696
|
-
|
|
2697
|
-
type:
|
|
2698
|
-
id:
|
|
2699
|
-
call_id:
|
|
2700
|
-
action:
|
|
2701
|
-
type:
|
|
2702
|
-
command:
|
|
2703
|
-
timeout_ms:
|
|
2704
|
-
user:
|
|
2705
|
-
working_directory:
|
|
2706
|
-
env:
|
|
2760
|
+
import_v415.z.object({
|
|
2761
|
+
type: import_v415.z.literal("local_shell_call"),
|
|
2762
|
+
id: import_v415.z.string(),
|
|
2763
|
+
call_id: import_v415.z.string(),
|
|
2764
|
+
action: import_v415.z.object({
|
|
2765
|
+
type: import_v415.z.literal("exec"),
|
|
2766
|
+
command: import_v415.z.array(import_v415.z.string()),
|
|
2767
|
+
timeout_ms: import_v415.z.number().optional(),
|
|
2768
|
+
user: import_v415.z.string().optional(),
|
|
2769
|
+
working_directory: import_v415.z.string().optional(),
|
|
2770
|
+
env: import_v415.z.record(import_v415.z.string(), import_v415.z.string()).optional()
|
|
2707
2771
|
})
|
|
2708
2772
|
}),
|
|
2709
|
-
|
|
2710
|
-
type:
|
|
2711
|
-
id:
|
|
2712
|
-
status:
|
|
2773
|
+
import_v415.z.object({
|
|
2774
|
+
type: import_v415.z.literal("computer_call"),
|
|
2775
|
+
id: import_v415.z.string(),
|
|
2776
|
+
status: import_v415.z.literal("completed")
|
|
2713
2777
|
})
|
|
2714
2778
|
])
|
|
2715
2779
|
}),
|
|
2716
|
-
|
|
2717
|
-
type:
|
|
2718
|
-
item_id:
|
|
2719
|
-
output_index:
|
|
2720
|
-
delta:
|
|
2780
|
+
import_v415.z.object({
|
|
2781
|
+
type: import_v415.z.literal("response.function_call_arguments.delta"),
|
|
2782
|
+
item_id: import_v415.z.string(),
|
|
2783
|
+
output_index: import_v415.z.number(),
|
|
2784
|
+
delta: import_v415.z.string()
|
|
2721
2785
|
}),
|
|
2722
|
-
|
|
2723
|
-
type:
|
|
2724
|
-
item_id:
|
|
2725
|
-
output_index:
|
|
2726
|
-
partial_image_b64:
|
|
2786
|
+
import_v415.z.object({
|
|
2787
|
+
type: import_v415.z.literal("response.image_generation_call.partial_image"),
|
|
2788
|
+
item_id: import_v415.z.string(),
|
|
2789
|
+
output_index: import_v415.z.number(),
|
|
2790
|
+
partial_image_b64: import_v415.z.string()
|
|
2727
2791
|
}),
|
|
2728
|
-
|
|
2729
|
-
type:
|
|
2730
|
-
item_id:
|
|
2731
|
-
output_index:
|
|
2732
|
-
delta:
|
|
2792
|
+
import_v415.z.object({
|
|
2793
|
+
type: import_v415.z.literal("response.code_interpreter_call_code.delta"),
|
|
2794
|
+
item_id: import_v415.z.string(),
|
|
2795
|
+
output_index: import_v415.z.number(),
|
|
2796
|
+
delta: import_v415.z.string()
|
|
2733
2797
|
}),
|
|
2734
|
-
|
|
2735
|
-
type:
|
|
2736
|
-
item_id:
|
|
2737
|
-
output_index:
|
|
2738
|
-
code:
|
|
2798
|
+
import_v415.z.object({
|
|
2799
|
+
type: import_v415.z.literal("response.code_interpreter_call_code.done"),
|
|
2800
|
+
item_id: import_v415.z.string(),
|
|
2801
|
+
output_index: import_v415.z.number(),
|
|
2802
|
+
code: import_v415.z.string()
|
|
2739
2803
|
}),
|
|
2740
|
-
|
|
2741
|
-
type:
|
|
2742
|
-
annotation:
|
|
2743
|
-
|
|
2744
|
-
type:
|
|
2745
|
-
start_index:
|
|
2746
|
-
end_index:
|
|
2747
|
-
url:
|
|
2748
|
-
title:
|
|
2804
|
+
import_v415.z.object({
|
|
2805
|
+
type: import_v415.z.literal("response.output_text.annotation.added"),
|
|
2806
|
+
annotation: import_v415.z.discriminatedUnion("type", [
|
|
2807
|
+
import_v415.z.object({
|
|
2808
|
+
type: import_v415.z.literal("url_citation"),
|
|
2809
|
+
start_index: import_v415.z.number(),
|
|
2810
|
+
end_index: import_v415.z.number(),
|
|
2811
|
+
url: import_v415.z.string(),
|
|
2812
|
+
title: import_v415.z.string()
|
|
2749
2813
|
}),
|
|
2750
|
-
|
|
2751
|
-
type:
|
|
2752
|
-
file_id:
|
|
2753
|
-
filename:
|
|
2754
|
-
index:
|
|
2755
|
-
start_index:
|
|
2756
|
-
end_index:
|
|
2757
|
-
quote:
|
|
2814
|
+
import_v415.z.object({
|
|
2815
|
+
type: import_v415.z.literal("file_citation"),
|
|
2816
|
+
file_id: import_v415.z.string(),
|
|
2817
|
+
filename: import_v415.z.string().nullish(),
|
|
2818
|
+
index: import_v415.z.number().nullish(),
|
|
2819
|
+
start_index: import_v415.z.number().nullish(),
|
|
2820
|
+
end_index: import_v415.z.number().nullish(),
|
|
2821
|
+
quote: import_v415.z.string().nullish()
|
|
2758
2822
|
})
|
|
2759
2823
|
])
|
|
2760
2824
|
}),
|
|
2761
|
-
|
|
2762
|
-
type:
|
|
2763
|
-
item_id:
|
|
2764
|
-
summary_index:
|
|
2825
|
+
import_v415.z.object({
|
|
2826
|
+
type: import_v415.z.literal("response.reasoning_summary_part.added"),
|
|
2827
|
+
item_id: import_v415.z.string(),
|
|
2828
|
+
summary_index: import_v415.z.number()
|
|
2765
2829
|
}),
|
|
2766
|
-
|
|
2767
|
-
type:
|
|
2768
|
-
item_id:
|
|
2769
|
-
summary_index:
|
|
2770
|
-
delta:
|
|
2830
|
+
import_v415.z.object({
|
|
2831
|
+
type: import_v415.z.literal("response.reasoning_summary_text.delta"),
|
|
2832
|
+
item_id: import_v415.z.string(),
|
|
2833
|
+
summary_index: import_v415.z.number(),
|
|
2834
|
+
delta: import_v415.z.string()
|
|
2771
2835
|
}),
|
|
2772
|
-
|
|
2773
|
-
type:
|
|
2774
|
-
item_id:
|
|
2775
|
-
summary_index:
|
|
2836
|
+
import_v415.z.object({
|
|
2837
|
+
type: import_v415.z.literal("response.reasoning_summary_part.done"),
|
|
2838
|
+
item_id: import_v415.z.string(),
|
|
2839
|
+
summary_index: import_v415.z.number()
|
|
2776
2840
|
}),
|
|
2777
|
-
|
|
2778
|
-
type:
|
|
2779
|
-
sequence_number:
|
|
2780
|
-
error:
|
|
2781
|
-
type:
|
|
2782
|
-
code:
|
|
2783
|
-
message:
|
|
2784
|
-
param:
|
|
2841
|
+
import_v415.z.object({
|
|
2842
|
+
type: import_v415.z.literal("error"),
|
|
2843
|
+
sequence_number: import_v415.z.number(),
|
|
2844
|
+
error: import_v415.z.object({
|
|
2845
|
+
type: import_v415.z.string(),
|
|
2846
|
+
code: import_v415.z.string(),
|
|
2847
|
+
message: import_v415.z.string(),
|
|
2848
|
+
param: import_v415.z.string().nullish()
|
|
2785
2849
|
})
|
|
2786
2850
|
}),
|
|
2787
|
-
|
|
2851
|
+
import_v415.z.object({ type: import_v415.z.string() }).loose().transform((value) => ({
|
|
2788
2852
|
type: "unknown_chunk",
|
|
2789
2853
|
message: value.type
|
|
2790
2854
|
}))
|
|
@@ -2792,194 +2856,194 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
|
|
|
2792
2856
|
])
|
|
2793
2857
|
)
|
|
2794
2858
|
);
|
|
2795
|
-
var openaiResponsesResponseSchema = (0,
|
|
2796
|
-
() => (0,
|
|
2797
|
-
|
|
2798
|
-
id:
|
|
2799
|
-
created_at:
|
|
2800
|
-
error:
|
|
2801
|
-
message:
|
|
2802
|
-
type:
|
|
2803
|
-
param:
|
|
2804
|
-
code:
|
|
2859
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils22.lazyValidator)(
|
|
2860
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2861
|
+
import_v415.z.object({
|
|
2862
|
+
id: import_v415.z.string().optional(),
|
|
2863
|
+
created_at: import_v415.z.number().optional(),
|
|
2864
|
+
error: import_v415.z.object({
|
|
2865
|
+
message: import_v415.z.string(),
|
|
2866
|
+
type: import_v415.z.string(),
|
|
2867
|
+
param: import_v415.z.string().nullish(),
|
|
2868
|
+
code: import_v415.z.string()
|
|
2805
2869
|
}).nullish(),
|
|
2806
|
-
model:
|
|
2807
|
-
output:
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
type:
|
|
2811
|
-
role:
|
|
2812
|
-
id:
|
|
2813
|
-
phase:
|
|
2814
|
-
content:
|
|
2815
|
-
|
|
2816
|
-
type:
|
|
2817
|
-
text:
|
|
2818
|
-
logprobs:
|
|
2819
|
-
|
|
2820
|
-
token:
|
|
2821
|
-
logprob:
|
|
2822
|
-
top_logprobs:
|
|
2823
|
-
|
|
2824
|
-
token:
|
|
2825
|
-
logprob:
|
|
2870
|
+
model: import_v415.z.string().optional(),
|
|
2871
|
+
output: import_v415.z.array(
|
|
2872
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2873
|
+
import_v415.z.object({
|
|
2874
|
+
type: import_v415.z.literal("message"),
|
|
2875
|
+
role: import_v415.z.literal("assistant"),
|
|
2876
|
+
id: import_v415.z.string(),
|
|
2877
|
+
phase: import_v415.z.enum(["commentary", "final_answer"]).nullish(),
|
|
2878
|
+
content: import_v415.z.array(
|
|
2879
|
+
import_v415.z.object({
|
|
2880
|
+
type: import_v415.z.literal("output_text"),
|
|
2881
|
+
text: import_v415.z.string(),
|
|
2882
|
+
logprobs: import_v415.z.array(
|
|
2883
|
+
import_v415.z.object({
|
|
2884
|
+
token: import_v415.z.string(),
|
|
2885
|
+
logprob: import_v415.z.number(),
|
|
2886
|
+
top_logprobs: import_v415.z.array(
|
|
2887
|
+
import_v415.z.object({
|
|
2888
|
+
token: import_v415.z.string(),
|
|
2889
|
+
logprob: import_v415.z.number()
|
|
2826
2890
|
})
|
|
2827
2891
|
)
|
|
2828
2892
|
})
|
|
2829
2893
|
).nullish(),
|
|
2830
|
-
annotations:
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
type:
|
|
2834
|
-
start_index:
|
|
2835
|
-
end_index:
|
|
2836
|
-
url:
|
|
2837
|
-
title:
|
|
2894
|
+
annotations: import_v415.z.array(
|
|
2895
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2896
|
+
import_v415.z.object({
|
|
2897
|
+
type: import_v415.z.literal("url_citation"),
|
|
2898
|
+
start_index: import_v415.z.number(),
|
|
2899
|
+
end_index: import_v415.z.number(),
|
|
2900
|
+
url: import_v415.z.string(),
|
|
2901
|
+
title: import_v415.z.string()
|
|
2838
2902
|
}),
|
|
2839
|
-
|
|
2840
|
-
type:
|
|
2841
|
-
file_id:
|
|
2842
|
-
filename:
|
|
2843
|
-
index:
|
|
2844
|
-
start_index:
|
|
2845
|
-
end_index:
|
|
2846
|
-
quote:
|
|
2903
|
+
import_v415.z.object({
|
|
2904
|
+
type: import_v415.z.literal("file_citation"),
|
|
2905
|
+
file_id: import_v415.z.string(),
|
|
2906
|
+
filename: import_v415.z.string().nullish(),
|
|
2907
|
+
index: import_v415.z.number().nullish(),
|
|
2908
|
+
start_index: import_v415.z.number().nullish(),
|
|
2909
|
+
end_index: import_v415.z.number().nullish(),
|
|
2910
|
+
quote: import_v415.z.string().nullish()
|
|
2847
2911
|
}),
|
|
2848
|
-
|
|
2849
|
-
type:
|
|
2850
|
-
container_id:
|
|
2851
|
-
file_id:
|
|
2852
|
-
filename:
|
|
2853
|
-
start_index:
|
|
2854
|
-
end_index:
|
|
2855
|
-
index:
|
|
2912
|
+
import_v415.z.object({
|
|
2913
|
+
type: import_v415.z.literal("container_file_citation"),
|
|
2914
|
+
container_id: import_v415.z.string(),
|
|
2915
|
+
file_id: import_v415.z.string(),
|
|
2916
|
+
filename: import_v415.z.string().nullish(),
|
|
2917
|
+
start_index: import_v415.z.number().nullish(),
|
|
2918
|
+
end_index: import_v415.z.number().nullish(),
|
|
2919
|
+
index: import_v415.z.number().nullish()
|
|
2856
2920
|
}),
|
|
2857
|
-
|
|
2858
|
-
type:
|
|
2859
|
-
file_id:
|
|
2860
|
-
index:
|
|
2921
|
+
import_v415.z.object({
|
|
2922
|
+
type: import_v415.z.literal("file_path"),
|
|
2923
|
+
file_id: import_v415.z.string(),
|
|
2924
|
+
index: import_v415.z.number().nullish()
|
|
2861
2925
|
})
|
|
2862
2926
|
])
|
|
2863
2927
|
)
|
|
2864
2928
|
})
|
|
2865
2929
|
)
|
|
2866
2930
|
}),
|
|
2867
|
-
|
|
2868
|
-
type:
|
|
2869
|
-
id:
|
|
2870
|
-
status:
|
|
2871
|
-
action:
|
|
2872
|
-
|
|
2873
|
-
type:
|
|
2874
|
-
query:
|
|
2875
|
-
sources:
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
type:
|
|
2880
|
-
name:
|
|
2931
|
+
import_v415.z.object({
|
|
2932
|
+
type: import_v415.z.literal("web_search_call"),
|
|
2933
|
+
id: import_v415.z.string(),
|
|
2934
|
+
status: import_v415.z.string(),
|
|
2935
|
+
action: import_v415.z.discriminatedUnion("type", [
|
|
2936
|
+
import_v415.z.object({
|
|
2937
|
+
type: import_v415.z.literal("search"),
|
|
2938
|
+
query: import_v415.z.string().nullish(),
|
|
2939
|
+
sources: import_v415.z.array(
|
|
2940
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2941
|
+
import_v415.z.object({ type: import_v415.z.literal("url"), url: import_v415.z.string() }),
|
|
2942
|
+
import_v415.z.object({
|
|
2943
|
+
type: import_v415.z.literal("api"),
|
|
2944
|
+
name: import_v415.z.string()
|
|
2881
2945
|
})
|
|
2882
2946
|
])
|
|
2883
2947
|
).nullish()
|
|
2884
2948
|
}),
|
|
2885
|
-
|
|
2886
|
-
type:
|
|
2887
|
-
url:
|
|
2949
|
+
import_v415.z.object({
|
|
2950
|
+
type: import_v415.z.literal("open_page"),
|
|
2951
|
+
url: import_v415.z.string().nullish()
|
|
2888
2952
|
}),
|
|
2889
|
-
|
|
2890
|
-
type:
|
|
2891
|
-
url:
|
|
2892
|
-
pattern:
|
|
2953
|
+
import_v415.z.object({
|
|
2954
|
+
type: import_v415.z.literal("find_in_page"),
|
|
2955
|
+
url: import_v415.z.string().nullish(),
|
|
2956
|
+
pattern: import_v415.z.string().nullish()
|
|
2893
2957
|
})
|
|
2894
2958
|
]).nullish()
|
|
2895
2959
|
}),
|
|
2896
|
-
|
|
2897
|
-
type:
|
|
2898
|
-
id:
|
|
2899
|
-
queries:
|
|
2900
|
-
results:
|
|
2901
|
-
|
|
2902
|
-
attributes:
|
|
2903
|
-
|
|
2904
|
-
|
|
2960
|
+
import_v415.z.object({
|
|
2961
|
+
type: import_v415.z.literal("file_search_call"),
|
|
2962
|
+
id: import_v415.z.string(),
|
|
2963
|
+
queries: import_v415.z.array(import_v415.z.string()),
|
|
2964
|
+
results: import_v415.z.array(
|
|
2965
|
+
import_v415.z.object({
|
|
2966
|
+
attributes: import_v415.z.record(
|
|
2967
|
+
import_v415.z.string(),
|
|
2968
|
+
import_v415.z.union([import_v415.z.string(), import_v415.z.number(), import_v415.z.boolean()])
|
|
2905
2969
|
),
|
|
2906
|
-
file_id:
|
|
2907
|
-
filename:
|
|
2908
|
-
score:
|
|
2909
|
-
text:
|
|
2970
|
+
file_id: import_v415.z.string(),
|
|
2971
|
+
filename: import_v415.z.string(),
|
|
2972
|
+
score: import_v415.z.number(),
|
|
2973
|
+
text: import_v415.z.string()
|
|
2910
2974
|
})
|
|
2911
2975
|
).nullish()
|
|
2912
2976
|
}),
|
|
2913
|
-
|
|
2914
|
-
type:
|
|
2915
|
-
id:
|
|
2916
|
-
code:
|
|
2917
|
-
container_id:
|
|
2918
|
-
outputs:
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2977
|
+
import_v415.z.object({
|
|
2978
|
+
type: import_v415.z.literal("code_interpreter_call"),
|
|
2979
|
+
id: import_v415.z.string(),
|
|
2980
|
+
code: import_v415.z.string().nullable(),
|
|
2981
|
+
container_id: import_v415.z.string(),
|
|
2982
|
+
outputs: import_v415.z.array(
|
|
2983
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2984
|
+
import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
|
|
2985
|
+
import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
|
|
2922
2986
|
])
|
|
2923
2987
|
).nullable()
|
|
2924
2988
|
}),
|
|
2925
|
-
|
|
2926
|
-
type:
|
|
2927
|
-
id:
|
|
2928
|
-
result:
|
|
2989
|
+
import_v415.z.object({
|
|
2990
|
+
type: import_v415.z.literal("image_generation_call"),
|
|
2991
|
+
id: import_v415.z.string(),
|
|
2992
|
+
result: import_v415.z.string()
|
|
2929
2993
|
}),
|
|
2930
|
-
|
|
2931
|
-
type:
|
|
2932
|
-
id:
|
|
2933
|
-
call_id:
|
|
2934
|
-
action:
|
|
2935
|
-
type:
|
|
2936
|
-
command:
|
|
2937
|
-
timeout_ms:
|
|
2938
|
-
user:
|
|
2939
|
-
working_directory:
|
|
2940
|
-
env:
|
|
2994
|
+
import_v415.z.object({
|
|
2995
|
+
type: import_v415.z.literal("local_shell_call"),
|
|
2996
|
+
id: import_v415.z.string(),
|
|
2997
|
+
call_id: import_v415.z.string(),
|
|
2998
|
+
action: import_v415.z.object({
|
|
2999
|
+
type: import_v415.z.literal("exec"),
|
|
3000
|
+
command: import_v415.z.array(import_v415.z.string()),
|
|
3001
|
+
timeout_ms: import_v415.z.number().optional(),
|
|
3002
|
+
user: import_v415.z.string().optional(),
|
|
3003
|
+
working_directory: import_v415.z.string().optional(),
|
|
3004
|
+
env: import_v415.z.record(import_v415.z.string(), import_v415.z.string()).optional()
|
|
2941
3005
|
})
|
|
2942
3006
|
}),
|
|
2943
|
-
|
|
2944
|
-
type:
|
|
2945
|
-
call_id:
|
|
2946
|
-
name:
|
|
2947
|
-
arguments:
|
|
2948
|
-
id:
|
|
3007
|
+
import_v415.z.object({
|
|
3008
|
+
type: import_v415.z.literal("function_call"),
|
|
3009
|
+
call_id: import_v415.z.string(),
|
|
3010
|
+
name: import_v415.z.string(),
|
|
3011
|
+
arguments: import_v415.z.string(),
|
|
3012
|
+
id: import_v415.z.string()
|
|
2949
3013
|
}),
|
|
2950
|
-
|
|
2951
|
-
type:
|
|
2952
|
-
id:
|
|
2953
|
-
status:
|
|
3014
|
+
import_v415.z.object({
|
|
3015
|
+
type: import_v415.z.literal("computer_call"),
|
|
3016
|
+
id: import_v415.z.string(),
|
|
3017
|
+
status: import_v415.z.string().optional()
|
|
2954
3018
|
}),
|
|
2955
|
-
|
|
2956
|
-
type:
|
|
2957
|
-
id:
|
|
2958
|
-
encrypted_content:
|
|
2959
|
-
summary:
|
|
2960
|
-
|
|
2961
|
-
type:
|
|
2962
|
-
text:
|
|
3019
|
+
import_v415.z.object({
|
|
3020
|
+
type: import_v415.z.literal("reasoning"),
|
|
3021
|
+
id: import_v415.z.string(),
|
|
3022
|
+
encrypted_content: import_v415.z.string().nullish(),
|
|
3023
|
+
summary: import_v415.z.array(
|
|
3024
|
+
import_v415.z.object({
|
|
3025
|
+
type: import_v415.z.literal("summary_text"),
|
|
3026
|
+
text: import_v415.z.string()
|
|
2963
3027
|
})
|
|
2964
3028
|
)
|
|
2965
3029
|
})
|
|
2966
3030
|
])
|
|
2967
3031
|
).optional(),
|
|
2968
|
-
service_tier:
|
|
2969
|
-
incomplete_details:
|
|
2970
|
-
usage:
|
|
2971
|
-
input_tokens:
|
|
2972
|
-
input_tokens_details:
|
|
2973
|
-
output_tokens:
|
|
2974
|
-
output_tokens_details:
|
|
3032
|
+
service_tier: import_v415.z.string().nullish(),
|
|
3033
|
+
incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
|
|
3034
|
+
usage: import_v415.z.object({
|
|
3035
|
+
input_tokens: import_v415.z.number(),
|
|
3036
|
+
input_tokens_details: import_v415.z.object({ cached_tokens: import_v415.z.number().nullish() }).nullish(),
|
|
3037
|
+
output_tokens: import_v415.z.number(),
|
|
3038
|
+
output_tokens_details: import_v415.z.object({ reasoning_tokens: import_v415.z.number().nullish() }).nullish()
|
|
2975
3039
|
}).optional()
|
|
2976
3040
|
})
|
|
2977
3041
|
)
|
|
2978
3042
|
);
|
|
2979
3043
|
|
|
2980
3044
|
// src/responses/openai-responses-options.ts
|
|
2981
|
-
var
|
|
2982
|
-
var
|
|
3045
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
3046
|
+
var import_v416 = require("zod/v4");
|
|
2983
3047
|
var TOP_LOGPROBS_MAX = 20;
|
|
2984
3048
|
var openaiResponsesReasoningModelIds = [
|
|
2985
3049
|
"o1",
|
|
@@ -3061,19 +3125,19 @@ var openaiResponsesModelIds = [
|
|
|
3061
3125
|
"gpt-5-chat-latest",
|
|
3062
3126
|
...openaiResponsesReasoningModelIds
|
|
3063
3127
|
];
|
|
3064
|
-
var openaiResponsesProviderOptionsSchema = (0,
|
|
3065
|
-
() => (0,
|
|
3066
|
-
|
|
3067
|
-
conversation:
|
|
3068
|
-
include:
|
|
3069
|
-
|
|
3128
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3129
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
3130
|
+
import_v416.z.object({
|
|
3131
|
+
conversation: import_v416.z.string().nullish(),
|
|
3132
|
+
include: import_v416.z.array(
|
|
3133
|
+
import_v416.z.enum([
|
|
3070
3134
|
"reasoning.encrypted_content",
|
|
3071
3135
|
// handled internally by default, only needed for unknown reasoning models
|
|
3072
3136
|
"file_search_call.results",
|
|
3073
3137
|
"message.output_text.logprobs"
|
|
3074
3138
|
])
|
|
3075
3139
|
).nullish(),
|
|
3076
|
-
instructions:
|
|
3140
|
+
instructions: import_v416.z.string().nullish(),
|
|
3077
3141
|
/**
|
|
3078
3142
|
* Return the log probabilities of the tokens.
|
|
3079
3143
|
*
|
|
@@ -3086,17 +3150,17 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazyValid
|
|
|
3086
3150
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3087
3151
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3088
3152
|
*/
|
|
3089
|
-
logprobs:
|
|
3153
|
+
logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3090
3154
|
/**
|
|
3091
3155
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3092
3156
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3093
3157
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3094
3158
|
*/
|
|
3095
|
-
maxToolCalls:
|
|
3096
|
-
metadata:
|
|
3097
|
-
parallelToolCalls:
|
|
3098
|
-
previousResponseId:
|
|
3099
|
-
promptCacheKey:
|
|
3159
|
+
maxToolCalls: import_v416.z.number().nullish(),
|
|
3160
|
+
metadata: import_v416.z.any().nullish(),
|
|
3161
|
+
parallelToolCalls: import_v416.z.boolean().nullish(),
|
|
3162
|
+
previousResponseId: import_v416.z.string().nullish(),
|
|
3163
|
+
promptCacheKey: import_v416.z.string().nullish(),
|
|
3100
3164
|
/**
|
|
3101
3165
|
* The retention policy for the prompt cache.
|
|
3102
3166
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -3105,7 +3169,7 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazyValid
|
|
|
3105
3169
|
*
|
|
3106
3170
|
* @default 'in_memory'
|
|
3107
3171
|
*/
|
|
3108
|
-
promptCacheRetention:
|
|
3172
|
+
promptCacheRetention: import_v416.z.enum(["in_memory", "24h"]).nullish(),
|
|
3109
3173
|
/**
|
|
3110
3174
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3111
3175
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -3116,15 +3180,15 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazyValid
|
|
|
3116
3180
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
3117
3181
|
* an error.
|
|
3118
3182
|
*/
|
|
3119
|
-
reasoningEffort:
|
|
3120
|
-
reasoningSummary:
|
|
3121
|
-
safetyIdentifier:
|
|
3122
|
-
serviceTier:
|
|
3123
|
-
store:
|
|
3124
|
-
strictJsonSchema:
|
|
3125
|
-
textVerbosity:
|
|
3126
|
-
truncation:
|
|
3127
|
-
user:
|
|
3183
|
+
reasoningEffort: import_v416.z.string().nullish(),
|
|
3184
|
+
reasoningSummary: import_v416.z.string().nullish(),
|
|
3185
|
+
safetyIdentifier: import_v416.z.string().nullish(),
|
|
3186
|
+
serviceTier: import_v416.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3187
|
+
store: import_v416.z.boolean().nullish(),
|
|
3188
|
+
strictJsonSchema: import_v416.z.boolean().nullish(),
|
|
3189
|
+
textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
|
|
3190
|
+
truncation: import_v416.z.enum(["auto", "disabled"]).nullish(),
|
|
3191
|
+
user: import_v416.z.string().nullish()
|
|
3128
3192
|
})
|
|
3129
3193
|
)
|
|
3130
3194
|
);
|
|
@@ -3133,41 +3197,41 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazyValid
|
|
|
3133
3197
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3134
3198
|
|
|
3135
3199
|
// src/tool/code-interpreter.ts
|
|
3136
|
-
var
|
|
3137
|
-
var
|
|
3138
|
-
var codeInterpreterInputSchema = (0,
|
|
3139
|
-
() => (0,
|
|
3140
|
-
|
|
3141
|
-
code:
|
|
3142
|
-
containerId:
|
|
3200
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
3201
|
+
var import_v417 = require("zod/v4");
|
|
3202
|
+
var codeInterpreterInputSchema = (0, import_provider_utils24.lazySchema)(
|
|
3203
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3204
|
+
import_v417.z.object({
|
|
3205
|
+
code: import_v417.z.string().nullish(),
|
|
3206
|
+
containerId: import_v417.z.string()
|
|
3143
3207
|
})
|
|
3144
3208
|
)
|
|
3145
3209
|
);
|
|
3146
|
-
var codeInterpreterOutputSchema = (0,
|
|
3147
|
-
() => (0,
|
|
3148
|
-
|
|
3149
|
-
outputs:
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3210
|
+
var codeInterpreterOutputSchema = (0, import_provider_utils24.lazySchema)(
|
|
3211
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3212
|
+
import_v417.z.object({
|
|
3213
|
+
outputs: import_v417.z.array(
|
|
3214
|
+
import_v417.z.discriminatedUnion("type", [
|
|
3215
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
3216
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
3153
3217
|
])
|
|
3154
3218
|
).nullish()
|
|
3155
3219
|
})
|
|
3156
3220
|
)
|
|
3157
3221
|
);
|
|
3158
|
-
var codeInterpreterArgsSchema = (0,
|
|
3159
|
-
() => (0,
|
|
3160
|
-
|
|
3161
|
-
container:
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
fileIds:
|
|
3222
|
+
var codeInterpreterArgsSchema = (0, import_provider_utils24.lazySchema)(
|
|
3223
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3224
|
+
import_v417.z.object({
|
|
3225
|
+
container: import_v417.z.union([
|
|
3226
|
+
import_v417.z.string(),
|
|
3227
|
+
import_v417.z.object({
|
|
3228
|
+
fileIds: import_v417.z.array(import_v417.z.string()).optional()
|
|
3165
3229
|
})
|
|
3166
3230
|
]).optional()
|
|
3167
3231
|
})
|
|
3168
3232
|
)
|
|
3169
3233
|
);
|
|
3170
|
-
var codeInterpreterToolFactory = (0,
|
|
3234
|
+
var codeInterpreterToolFactory = (0, import_provider_utils24.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3171
3235
|
id: "openai.code_interpreter",
|
|
3172
3236
|
name: "code_interpreter",
|
|
3173
3237
|
inputSchema: codeInterpreterInputSchema,
|
|
@@ -3178,115 +3242,63 @@ var codeInterpreter = (args = {}) => {
|
|
|
3178
3242
|
};
|
|
3179
3243
|
|
|
3180
3244
|
// src/tool/file-search.ts
|
|
3181
|
-
var
|
|
3182
|
-
var
|
|
3183
|
-
var comparisonFilterSchema =
|
|
3184
|
-
key:
|
|
3185
|
-
type:
|
|
3186
|
-
value:
|
|
3245
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
3246
|
+
var import_v418 = require("zod/v4");
|
|
3247
|
+
var comparisonFilterSchema = import_v418.z.object({
|
|
3248
|
+
key: import_v418.z.string(),
|
|
3249
|
+
type: import_v418.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
3250
|
+
value: import_v418.z.union([import_v418.z.string(), import_v418.z.number(), import_v418.z.boolean(), import_v418.z.array(import_v418.z.string())])
|
|
3187
3251
|
});
|
|
3188
|
-
var compoundFilterSchema =
|
|
3189
|
-
type:
|
|
3190
|
-
filters:
|
|
3191
|
-
|
|
3252
|
+
var compoundFilterSchema = import_v418.z.object({
|
|
3253
|
+
type: import_v418.z.enum(["and", "or"]),
|
|
3254
|
+
filters: import_v418.z.array(
|
|
3255
|
+
import_v418.z.union([comparisonFilterSchema, import_v418.z.lazy(() => compoundFilterSchema)])
|
|
3192
3256
|
)
|
|
3193
3257
|
});
|
|
3194
|
-
var fileSearchArgsSchema = (0,
|
|
3195
|
-
() => (0,
|
|
3196
|
-
|
|
3197
|
-
vectorStoreIds:
|
|
3198
|
-
maxNumResults:
|
|
3199
|
-
ranking:
|
|
3200
|
-
ranker:
|
|
3201
|
-
scoreThreshold:
|
|
3258
|
+
var fileSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
3259
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
3260
|
+
import_v418.z.object({
|
|
3261
|
+
vectorStoreIds: import_v418.z.array(import_v418.z.string()),
|
|
3262
|
+
maxNumResults: import_v418.z.number().optional(),
|
|
3263
|
+
ranking: import_v418.z.object({
|
|
3264
|
+
ranker: import_v418.z.string().optional(),
|
|
3265
|
+
scoreThreshold: import_v418.z.number().optional()
|
|
3202
3266
|
}).optional(),
|
|
3203
|
-
filters:
|
|
3267
|
+
filters: import_v418.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
3204
3268
|
})
|
|
3205
3269
|
)
|
|
3206
3270
|
);
|
|
3207
|
-
var fileSearchOutputSchema = (0,
|
|
3208
|
-
() => (0,
|
|
3209
|
-
|
|
3210
|
-
queries:
|
|
3211
|
-
results:
|
|
3212
|
-
|
|
3213
|
-
attributes:
|
|
3214
|
-
fileId:
|
|
3215
|
-
filename:
|
|
3216
|
-
score:
|
|
3217
|
-
text:
|
|
3271
|
+
var fileSearchOutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3272
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
3273
|
+
import_v418.z.object({
|
|
3274
|
+
queries: import_v418.z.array(import_v418.z.string()),
|
|
3275
|
+
results: import_v418.z.array(
|
|
3276
|
+
import_v418.z.object({
|
|
3277
|
+
attributes: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()),
|
|
3278
|
+
fileId: import_v418.z.string(),
|
|
3279
|
+
filename: import_v418.z.string(),
|
|
3280
|
+
score: import_v418.z.number(),
|
|
3281
|
+
text: import_v418.z.string()
|
|
3218
3282
|
})
|
|
3219
3283
|
).nullable()
|
|
3220
3284
|
})
|
|
3221
3285
|
)
|
|
3222
3286
|
);
|
|
3223
|
-
var fileSearch = (0,
|
|
3287
|
+
var fileSearch = (0, import_provider_utils25.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3224
3288
|
id: "openai.file_search",
|
|
3225
3289
|
name: "file_search",
|
|
3226
|
-
inputSchema:
|
|
3290
|
+
inputSchema: import_v418.z.object({}),
|
|
3227
3291
|
outputSchema: fileSearchOutputSchema
|
|
3228
3292
|
});
|
|
3229
3293
|
|
|
3230
3294
|
// src/tool/web-search.ts
|
|
3231
|
-
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
3232
|
-
var import_v418 = require("zod/v4");
|
|
3233
|
-
var webSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
3234
|
-
() => (0, import_provider_utils25.zodSchema)(
|
|
3235
|
-
import_v418.z.object({
|
|
3236
|
-
externalWebAccess: import_v418.z.boolean().optional(),
|
|
3237
|
-
filters: import_v418.z.object({ allowedDomains: import_v418.z.array(import_v418.z.string()).optional() }).optional(),
|
|
3238
|
-
searchContextSize: import_v418.z.enum(["low", "medium", "high"]).optional(),
|
|
3239
|
-
userLocation: import_v418.z.object({
|
|
3240
|
-
type: import_v418.z.literal("approximate"),
|
|
3241
|
-
country: import_v418.z.string().optional(),
|
|
3242
|
-
city: import_v418.z.string().optional(),
|
|
3243
|
-
region: import_v418.z.string().optional(),
|
|
3244
|
-
timezone: import_v418.z.string().optional()
|
|
3245
|
-
}).optional()
|
|
3246
|
-
})
|
|
3247
|
-
)
|
|
3248
|
-
);
|
|
3249
|
-
var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(() => (0, import_provider_utils25.zodSchema)(import_v418.z.object({})));
|
|
3250
|
-
var webSearchOutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3251
|
-
() => (0, import_provider_utils25.zodSchema)(
|
|
3252
|
-
import_v418.z.object({
|
|
3253
|
-
action: import_v418.z.discriminatedUnion("type", [
|
|
3254
|
-
import_v418.z.object({
|
|
3255
|
-
type: import_v418.z.literal("search"),
|
|
3256
|
-
query: import_v418.z.string().optional()
|
|
3257
|
-
}),
|
|
3258
|
-
import_v418.z.object({
|
|
3259
|
-
type: import_v418.z.literal("openPage"),
|
|
3260
|
-
url: import_v418.z.string().nullish()
|
|
3261
|
-
}),
|
|
3262
|
-
import_v418.z.object({
|
|
3263
|
-
type: import_v418.z.literal("findInPage"),
|
|
3264
|
-
url: import_v418.z.string().nullish(),
|
|
3265
|
-
pattern: import_v418.z.string().nullish()
|
|
3266
|
-
})
|
|
3267
|
-
]).optional(),
|
|
3268
|
-
sources: import_v418.z.array(
|
|
3269
|
-
import_v418.z.discriminatedUnion("type", [
|
|
3270
|
-
import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
|
|
3271
|
-
import_v418.z.object({ type: import_v418.z.literal("api"), name: import_v418.z.string() })
|
|
3272
|
-
])
|
|
3273
|
-
).optional()
|
|
3274
|
-
})
|
|
3275
|
-
)
|
|
3276
|
-
);
|
|
3277
|
-
var webSearchToolFactory = (0, import_provider_utils25.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3278
|
-
id: "openai.web_search",
|
|
3279
|
-
name: "web_search",
|
|
3280
|
-
inputSchema: webSearchInputSchema,
|
|
3281
|
-
outputSchema: webSearchOutputSchema
|
|
3282
|
-
});
|
|
3283
|
-
|
|
3284
|
-
// src/tool/web-search-preview.ts
|
|
3285
3295
|
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
3286
3296
|
var import_v419 = require("zod/v4");
|
|
3287
|
-
var
|
|
3297
|
+
var webSearchArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
3288
3298
|
() => (0, import_provider_utils26.zodSchema)(
|
|
3289
3299
|
import_v419.z.object({
|
|
3300
|
+
externalWebAccess: import_v419.z.boolean().optional(),
|
|
3301
|
+
filters: import_v419.z.object({ allowedDomains: import_v419.z.array(import_v419.z.string()).optional() }).optional(),
|
|
3290
3302
|
searchContextSize: import_v419.z.enum(["low", "medium", "high"]).optional(),
|
|
3291
3303
|
userLocation: import_v419.z.object({
|
|
3292
3304
|
type: import_v419.z.literal("approximate"),
|
|
@@ -3298,10 +3310,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
3298
3310
|
})
|
|
3299
3311
|
)
|
|
3300
3312
|
);
|
|
3301
|
-
var
|
|
3302
|
-
|
|
3303
|
-
);
|
|
3304
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3313
|
+
var webSearchInputSchema = (0, import_provider_utils26.lazySchema)(() => (0, import_provider_utils26.zodSchema)(import_v419.z.object({})));
|
|
3314
|
+
var webSearchOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3305
3315
|
() => (0, import_provider_utils26.zodSchema)(
|
|
3306
3316
|
import_v419.z.object({
|
|
3307
3317
|
action: import_v419.z.discriminatedUnion("type", [
|
|
@@ -3318,11 +3328,65 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
3318
3328
|
url: import_v419.z.string().nullish(),
|
|
3319
3329
|
pattern: import_v419.z.string().nullish()
|
|
3320
3330
|
})
|
|
3331
|
+
]).optional(),
|
|
3332
|
+
sources: import_v419.z.array(
|
|
3333
|
+
import_v419.z.discriminatedUnion("type", [
|
|
3334
|
+
import_v419.z.object({ type: import_v419.z.literal("url"), url: import_v419.z.string() }),
|
|
3335
|
+
import_v419.z.object({ type: import_v419.z.literal("api"), name: import_v419.z.string() })
|
|
3336
|
+
])
|
|
3337
|
+
).optional()
|
|
3338
|
+
})
|
|
3339
|
+
)
|
|
3340
|
+
);
|
|
3341
|
+
var webSearchToolFactory = (0, import_provider_utils26.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3342
|
+
id: "openai.web_search",
|
|
3343
|
+
name: "web_search",
|
|
3344
|
+
inputSchema: webSearchInputSchema,
|
|
3345
|
+
outputSchema: webSearchOutputSchema
|
|
3346
|
+
});
|
|
3347
|
+
|
|
3348
|
+
// src/tool/web-search-preview.ts
|
|
3349
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
3350
|
+
var import_v420 = require("zod/v4");
|
|
3351
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils27.lazySchema)(
|
|
3352
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
3353
|
+
import_v420.z.object({
|
|
3354
|
+
searchContextSize: import_v420.z.enum(["low", "medium", "high"]).optional(),
|
|
3355
|
+
userLocation: import_v420.z.object({
|
|
3356
|
+
type: import_v420.z.literal("approximate"),
|
|
3357
|
+
country: import_v420.z.string().optional(),
|
|
3358
|
+
city: import_v420.z.string().optional(),
|
|
3359
|
+
region: import_v420.z.string().optional(),
|
|
3360
|
+
timezone: import_v420.z.string().optional()
|
|
3361
|
+
}).optional()
|
|
3362
|
+
})
|
|
3363
|
+
)
|
|
3364
|
+
);
|
|
3365
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils27.lazySchema)(
|
|
3366
|
+
() => (0, import_provider_utils27.zodSchema)(import_v420.z.object({}))
|
|
3367
|
+
);
|
|
3368
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
3369
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
3370
|
+
import_v420.z.object({
|
|
3371
|
+
action: import_v420.z.discriminatedUnion("type", [
|
|
3372
|
+
import_v420.z.object({
|
|
3373
|
+
type: import_v420.z.literal("search"),
|
|
3374
|
+
query: import_v420.z.string().optional()
|
|
3375
|
+
}),
|
|
3376
|
+
import_v420.z.object({
|
|
3377
|
+
type: import_v420.z.literal("openPage"),
|
|
3378
|
+
url: import_v420.z.string().nullish()
|
|
3379
|
+
}),
|
|
3380
|
+
import_v420.z.object({
|
|
3381
|
+
type: import_v420.z.literal("findInPage"),
|
|
3382
|
+
url: import_v420.z.string().nullish(),
|
|
3383
|
+
pattern: import_v420.z.string().nullish()
|
|
3384
|
+
})
|
|
3321
3385
|
]).optional()
|
|
3322
3386
|
})
|
|
3323
3387
|
)
|
|
3324
3388
|
);
|
|
3325
|
-
var webSearchPreview = (0,
|
|
3389
|
+
var webSearchPreview = (0, import_provider_utils27.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3326
3390
|
id: "openai.web_search_preview",
|
|
3327
3391
|
name: "web_search_preview",
|
|
3328
3392
|
inputSchema: webSearchPreviewInputSchema,
|
|
@@ -3330,32 +3394,32 @@ var webSearchPreview = (0, import_provider_utils26.createProviderDefinedToolFact
|
|
|
3330
3394
|
});
|
|
3331
3395
|
|
|
3332
3396
|
// src/tool/image-generation.ts
|
|
3333
|
-
var
|
|
3334
|
-
var
|
|
3335
|
-
var imageGenerationArgsSchema = (0,
|
|
3336
|
-
() => (0,
|
|
3337
|
-
|
|
3338
|
-
background:
|
|
3339
|
-
inputFidelity:
|
|
3340
|
-
inputImageMask:
|
|
3341
|
-
fileId:
|
|
3342
|
-
imageUrl:
|
|
3397
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
3398
|
+
var import_v421 = require("zod/v4");
|
|
3399
|
+
var imageGenerationArgsSchema = (0, import_provider_utils28.lazySchema)(
|
|
3400
|
+
() => (0, import_provider_utils28.zodSchema)(
|
|
3401
|
+
import_v421.z.object({
|
|
3402
|
+
background: import_v421.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
3403
|
+
inputFidelity: import_v421.z.enum(["low", "high"]).optional(),
|
|
3404
|
+
inputImageMask: import_v421.z.object({
|
|
3405
|
+
fileId: import_v421.z.string().optional(),
|
|
3406
|
+
imageUrl: import_v421.z.string().optional()
|
|
3343
3407
|
}).optional(),
|
|
3344
|
-
model:
|
|
3345
|
-
moderation:
|
|
3346
|
-
outputCompression:
|
|
3347
|
-
outputFormat:
|
|
3348
|
-
partialImages:
|
|
3349
|
-
quality:
|
|
3350
|
-
size:
|
|
3408
|
+
model: import_v421.z.string().optional(),
|
|
3409
|
+
moderation: import_v421.z.enum(["auto"]).optional(),
|
|
3410
|
+
outputCompression: import_v421.z.number().int().min(0).max(100).optional(),
|
|
3411
|
+
outputFormat: import_v421.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
3412
|
+
partialImages: import_v421.z.number().int().min(0).max(3).optional(),
|
|
3413
|
+
quality: import_v421.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
3414
|
+
size: import_v421.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
3351
3415
|
}).strict()
|
|
3352
3416
|
)
|
|
3353
3417
|
);
|
|
3354
|
-
var imageGenerationInputSchema = (0,
|
|
3355
|
-
var imageGenerationOutputSchema = (0,
|
|
3356
|
-
() => (0,
|
|
3418
|
+
var imageGenerationInputSchema = (0, import_provider_utils28.lazySchema)(() => (0, import_provider_utils28.zodSchema)(import_v421.z.object({})));
|
|
3419
|
+
var imageGenerationOutputSchema = (0, import_provider_utils28.lazySchema)(
|
|
3420
|
+
() => (0, import_provider_utils28.zodSchema)(import_v421.z.object({ result: import_v421.z.string() }))
|
|
3357
3421
|
);
|
|
3358
|
-
var imageGenerationToolFactory = (0,
|
|
3422
|
+
var imageGenerationToolFactory = (0, import_provider_utils28.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3359
3423
|
id: "openai.image_generation",
|
|
3360
3424
|
name: "image_generation",
|
|
3361
3425
|
inputSchema: imageGenerationInputSchema,
|
|
@@ -3366,7 +3430,7 @@ var imageGeneration = (args = {}) => {
|
|
|
3366
3430
|
};
|
|
3367
3431
|
|
|
3368
3432
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3369
|
-
var
|
|
3433
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
3370
3434
|
async function prepareResponsesTools({
|
|
3371
3435
|
tools,
|
|
3372
3436
|
toolChoice,
|
|
@@ -3392,7 +3456,7 @@ async function prepareResponsesTools({
|
|
|
3392
3456
|
case "provider-defined": {
|
|
3393
3457
|
switch (tool.id) {
|
|
3394
3458
|
case "openai.file_search": {
|
|
3395
|
-
const args = await (0,
|
|
3459
|
+
const args = await (0, import_provider_utils29.validateTypes)({
|
|
3396
3460
|
value: tool.args,
|
|
3397
3461
|
schema: fileSearchArgsSchema
|
|
3398
3462
|
});
|
|
@@ -3415,7 +3479,7 @@ async function prepareResponsesTools({
|
|
|
3415
3479
|
break;
|
|
3416
3480
|
}
|
|
3417
3481
|
case "openai.web_search_preview": {
|
|
3418
|
-
const args = await (0,
|
|
3482
|
+
const args = await (0, import_provider_utils29.validateTypes)({
|
|
3419
3483
|
value: tool.args,
|
|
3420
3484
|
schema: webSearchPreviewArgsSchema
|
|
3421
3485
|
});
|
|
@@ -3427,7 +3491,7 @@ async function prepareResponsesTools({
|
|
|
3427
3491
|
break;
|
|
3428
3492
|
}
|
|
3429
3493
|
case "openai.web_search": {
|
|
3430
|
-
const args = await (0,
|
|
3494
|
+
const args = await (0, import_provider_utils29.validateTypes)({
|
|
3431
3495
|
value: tool.args,
|
|
3432
3496
|
schema: webSearchArgsSchema
|
|
3433
3497
|
});
|
|
@@ -3441,7 +3505,7 @@ async function prepareResponsesTools({
|
|
|
3441
3505
|
break;
|
|
3442
3506
|
}
|
|
3443
3507
|
case "openai.code_interpreter": {
|
|
3444
|
-
const args = await (0,
|
|
3508
|
+
const args = await (0, import_provider_utils29.validateTypes)({
|
|
3445
3509
|
value: tool.args,
|
|
3446
3510
|
schema: codeInterpreterArgsSchema
|
|
3447
3511
|
});
|
|
@@ -3452,7 +3516,7 @@ async function prepareResponsesTools({
|
|
|
3452
3516
|
break;
|
|
3453
3517
|
}
|
|
3454
3518
|
case "openai.image_generation": {
|
|
3455
|
-
const args = await (0,
|
|
3519
|
+
const args = await (0, import_provider_utils29.validateTypes)({
|
|
3456
3520
|
value: tool.args,
|
|
3457
3521
|
schema: imageGenerationArgsSchema
|
|
3458
3522
|
});
|
|
@@ -3558,7 +3622,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3558
3622
|
if (stopSequences != null) {
|
|
3559
3623
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
3560
3624
|
}
|
|
3561
|
-
const openaiOptions = await (0,
|
|
3625
|
+
const openaiOptions = await (0, import_provider_utils30.parseProviderOptions)({
|
|
3562
3626
|
provider: "openai",
|
|
3563
3627
|
providerOptions,
|
|
3564
3628
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -3746,12 +3810,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3746
3810
|
responseHeaders,
|
|
3747
3811
|
value: response,
|
|
3748
3812
|
rawValue: rawResponse
|
|
3749
|
-
} = await (0,
|
|
3813
|
+
} = await (0, import_provider_utils30.postJsonToApi)({
|
|
3750
3814
|
url,
|
|
3751
|
-
headers: (0,
|
|
3815
|
+
headers: (0, import_provider_utils30.combineHeaders)(this.config.headers(), options.headers),
|
|
3752
3816
|
body,
|
|
3753
3817
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3754
|
-
successfulResponseHandler: (0,
|
|
3818
|
+
successfulResponseHandler: (0, import_provider_utils30.createJsonResponseHandler)(
|
|
3755
3819
|
openaiResponsesResponseSchema
|
|
3756
3820
|
),
|
|
3757
3821
|
abortSignal: options.abortSignal,
|
|
@@ -3846,7 +3910,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3846
3910
|
content.push({
|
|
3847
3911
|
type: "source",
|
|
3848
3912
|
sourceType: "url",
|
|
3849
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
3913
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils30.generateId)(),
|
|
3850
3914
|
url: annotation.url,
|
|
3851
3915
|
title: annotation.title
|
|
3852
3916
|
});
|
|
@@ -3854,7 +3918,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3854
3918
|
content.push({
|
|
3855
3919
|
type: "source",
|
|
3856
3920
|
sourceType: "document",
|
|
3857
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
3921
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils30.generateId)(),
|
|
3858
3922
|
mediaType: "text/plain",
|
|
3859
3923
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3860
3924
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
@@ -3870,7 +3934,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3870
3934
|
content.push({
|
|
3871
3935
|
type: "source",
|
|
3872
3936
|
sourceType: "document",
|
|
3873
|
-
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
3937
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils30.generateId)(),
|
|
3874
3938
|
mediaType: "text/plain",
|
|
3875
3939
|
title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
|
|
3876
3940
|
filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
|
|
@@ -3886,7 +3950,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3886
3950
|
content.push({
|
|
3887
3951
|
type: "source",
|
|
3888
3952
|
sourceType: "document",
|
|
3889
|
-
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0,
|
|
3953
|
+
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils30.generateId)(),
|
|
3890
3954
|
mediaType: "application/octet-stream",
|
|
3891
3955
|
title: annotation.file_id,
|
|
3892
3956
|
filename: annotation.file_id,
|
|
@@ -4048,18 +4112,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4048
4112
|
webSearchToolName,
|
|
4049
4113
|
store
|
|
4050
4114
|
} = await this.getArgs(options);
|
|
4051
|
-
const { responseHeaders, value: response } = await (0,
|
|
4115
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils30.postJsonToApi)({
|
|
4052
4116
|
url: this.config.url({
|
|
4053
4117
|
path: "/responses",
|
|
4054
4118
|
modelId: this.modelId
|
|
4055
4119
|
}),
|
|
4056
|
-
headers: (0,
|
|
4120
|
+
headers: (0, import_provider_utils30.combineHeaders)(this.config.headers(), options.headers),
|
|
4057
4121
|
body: {
|
|
4058
4122
|
...body,
|
|
4059
4123
|
stream: true
|
|
4060
4124
|
},
|
|
4061
4125
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4062
|
-
successfulResponseHandler: (0,
|
|
4126
|
+
successfulResponseHandler: (0, import_provider_utils30.createEventSourceResponseHandler)(
|
|
4063
4127
|
openaiResponsesChunkSchema
|
|
4064
4128
|
),
|
|
4065
4129
|
abortSignal: options.abortSignal,
|
|
@@ -4487,7 +4551,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4487
4551
|
controller.enqueue({
|
|
4488
4552
|
type: "source",
|
|
4489
4553
|
sourceType: "url",
|
|
4490
|
-
id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0,
|
|
4554
|
+
id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils30.generateId)(),
|
|
4491
4555
|
url: value.annotation.url,
|
|
4492
4556
|
title: value.annotation.title
|
|
4493
4557
|
});
|
|
@@ -4495,7 +4559,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4495
4559
|
controller.enqueue({
|
|
4496
4560
|
type: "source",
|
|
4497
4561
|
sourceType: "document",
|
|
4498
|
-
id: (_u = (_t = (_s = self.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0,
|
|
4562
|
+
id: (_u = (_t = (_s = self.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils30.generateId)(),
|
|
4499
4563
|
mediaType: "text/plain",
|
|
4500
4564
|
title: (_w = (_v = value.annotation.quote) != null ? _v : value.annotation.filename) != null ? _w : "Document",
|
|
4501
4565
|
filename: (_x = value.annotation.filename) != null ? _x : value.annotation.file_id,
|
|
@@ -4618,6 +4682,8 @@ function mapWebSearchOutput(action) {
|
|
|
4618
4682
|
openaiChatLanguageModelOptions,
|
|
4619
4683
|
openaiCompletionProviderOptions,
|
|
4620
4684
|
openaiEmbeddingProviderOptions,
|
|
4685
|
+
openaiImageModelGenerationOptions,
|
|
4686
|
+
openaiImageModelOptions,
|
|
4621
4687
|
openaiSpeechProviderOptionsSchema,
|
|
4622
4688
|
webSearchPreview,
|
|
4623
4689
|
webSearchPreviewArgsSchema,
|