@ai-sdk/openai 2.1.0-beta.6 → 2.1.0-beta.8
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 +19 -0
- package/dist/index.d.mts +27 -7
- package/dist/index.d.ts +27 -7
- package/dist/index.js +559 -369
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +524 -334
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +226 -15
- package/dist/internal/index.d.ts +226 -15
- package/dist/internal/index.js +582 -380
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +555 -361
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -405,7 +405,7 @@ function prepareChatTools({
|
|
|
405
405
|
// src/chat/openai-chat-language-model.ts
|
|
406
406
|
var OpenAIChatLanguageModel = class {
|
|
407
407
|
constructor(modelId, config) {
|
|
408
|
-
this.specificationVersion = "
|
|
408
|
+
this.specificationVersion = "v3";
|
|
409
409
|
this.supportedUrls = {
|
|
410
410
|
"image/*": [/^https?:\/\/.*$/]
|
|
411
411
|
};
|
|
@@ -1223,7 +1223,7 @@ var openaiCompletionProviderOptions = z4.object({
|
|
|
1223
1223
|
// src/completion/openai-completion-language-model.ts
|
|
1224
1224
|
var OpenAICompletionLanguageModel = class {
|
|
1225
1225
|
constructor(modelId, config) {
|
|
1226
|
-
this.specificationVersion = "
|
|
1226
|
+
this.specificationVersion = "v3";
|
|
1227
1227
|
this.supportedUrls = {
|
|
1228
1228
|
// No URLs are supported for completion models.
|
|
1229
1229
|
};
|
|
@@ -1793,39 +1793,62 @@ var imageGeneration = (args = {}) => {
|
|
|
1793
1793
|
return imageGenerationToolFactory(args);
|
|
1794
1794
|
};
|
|
1795
1795
|
|
|
1796
|
+
// src/tool/local-shell.ts
|
|
1797
|
+
import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4 } from "@ai-sdk/provider-utils";
|
|
1798
|
+
import { z as z12 } from "zod/v4";
|
|
1799
|
+
var localShellInputSchema = z12.object({
|
|
1800
|
+
action: z12.object({
|
|
1801
|
+
type: z12.literal("exec"),
|
|
1802
|
+
command: z12.array(z12.string()),
|
|
1803
|
+
timeoutMs: z12.number().optional(),
|
|
1804
|
+
user: z12.string().optional(),
|
|
1805
|
+
workingDirectory: z12.string().optional(),
|
|
1806
|
+
env: z12.record(z12.string(), z12.string()).optional()
|
|
1807
|
+
})
|
|
1808
|
+
});
|
|
1809
|
+
var localShellOutputSchema = z12.object({
|
|
1810
|
+
output: z12.string()
|
|
1811
|
+
});
|
|
1812
|
+
var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
1813
|
+
id: "openai.local_shell",
|
|
1814
|
+
name: "local_shell",
|
|
1815
|
+
inputSchema: localShellInputSchema,
|
|
1816
|
+
outputSchema: localShellOutputSchema
|
|
1817
|
+
});
|
|
1818
|
+
|
|
1796
1819
|
// src/tool/web-search.ts
|
|
1797
1820
|
import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
|
|
1798
|
-
import { z as
|
|
1799
|
-
var webSearchArgsSchema =
|
|
1800
|
-
filters:
|
|
1801
|
-
allowedDomains:
|
|
1821
|
+
import { z as z13 } from "zod/v4";
|
|
1822
|
+
var webSearchArgsSchema = z13.object({
|
|
1823
|
+
filters: z13.object({
|
|
1824
|
+
allowedDomains: z13.array(z13.string()).optional()
|
|
1802
1825
|
}).optional(),
|
|
1803
|
-
searchContextSize:
|
|
1804
|
-
userLocation:
|
|
1805
|
-
type:
|
|
1806
|
-
country:
|
|
1807
|
-
city:
|
|
1808
|
-
region:
|
|
1809
|
-
timezone:
|
|
1826
|
+
searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
|
|
1827
|
+
userLocation: z13.object({
|
|
1828
|
+
type: z13.literal("approximate"),
|
|
1829
|
+
country: z13.string().optional(),
|
|
1830
|
+
city: z13.string().optional(),
|
|
1831
|
+
region: z13.string().optional(),
|
|
1832
|
+
timezone: z13.string().optional()
|
|
1810
1833
|
}).optional()
|
|
1811
1834
|
});
|
|
1812
1835
|
var webSearchToolFactory = createProviderDefinedToolFactory({
|
|
1813
1836
|
id: "openai.web_search",
|
|
1814
1837
|
name: "web_search",
|
|
1815
|
-
inputSchema:
|
|
1816
|
-
action:
|
|
1817
|
-
|
|
1818
|
-
type:
|
|
1819
|
-
query:
|
|
1838
|
+
inputSchema: z13.object({
|
|
1839
|
+
action: z13.discriminatedUnion("type", [
|
|
1840
|
+
z13.object({
|
|
1841
|
+
type: z13.literal("search"),
|
|
1842
|
+
query: z13.string().nullish()
|
|
1820
1843
|
}),
|
|
1821
|
-
|
|
1822
|
-
type:
|
|
1823
|
-
url:
|
|
1844
|
+
z13.object({
|
|
1845
|
+
type: z13.literal("open_page"),
|
|
1846
|
+
url: z13.string()
|
|
1824
1847
|
}),
|
|
1825
|
-
|
|
1826
|
-
type:
|
|
1827
|
-
url:
|
|
1828
|
-
pattern:
|
|
1848
|
+
z13.object({
|
|
1849
|
+
type: z13.literal("find"),
|
|
1850
|
+
url: z13.string(),
|
|
1851
|
+
pattern: z13.string()
|
|
1829
1852
|
})
|
|
1830
1853
|
]).nullish()
|
|
1831
1854
|
})
|
|
@@ -1836,58 +1859,58 @@ var webSearch = (args = {}) => {
|
|
|
1836
1859
|
|
|
1837
1860
|
// src/tool/web-search-preview.ts
|
|
1838
1861
|
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
|
|
1839
|
-
import { z as
|
|
1840
|
-
var webSearchPreviewArgsSchema =
|
|
1862
|
+
import { z as z14 } from "zod/v4";
|
|
1863
|
+
var webSearchPreviewArgsSchema = z14.object({
|
|
1841
1864
|
/**
|
|
1842
1865
|
* Search context size to use for the web search.
|
|
1843
1866
|
* - high: Most comprehensive context, highest cost, slower response
|
|
1844
1867
|
* - medium: Balanced context, cost, and latency (default)
|
|
1845
1868
|
* - low: Least context, lowest cost, fastest response
|
|
1846
1869
|
*/
|
|
1847
|
-
searchContextSize:
|
|
1870
|
+
searchContextSize: z14.enum(["low", "medium", "high"]).optional(),
|
|
1848
1871
|
/**
|
|
1849
1872
|
* User location information to provide geographically relevant search results.
|
|
1850
1873
|
*/
|
|
1851
|
-
userLocation:
|
|
1874
|
+
userLocation: z14.object({
|
|
1852
1875
|
/**
|
|
1853
1876
|
* Type of location (always 'approximate')
|
|
1854
1877
|
*/
|
|
1855
|
-
type:
|
|
1878
|
+
type: z14.literal("approximate"),
|
|
1856
1879
|
/**
|
|
1857
1880
|
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
1858
1881
|
*/
|
|
1859
|
-
country:
|
|
1882
|
+
country: z14.string().optional(),
|
|
1860
1883
|
/**
|
|
1861
1884
|
* City name (free text, e.g., 'Minneapolis')
|
|
1862
1885
|
*/
|
|
1863
|
-
city:
|
|
1886
|
+
city: z14.string().optional(),
|
|
1864
1887
|
/**
|
|
1865
1888
|
* Region name (free text, e.g., 'Minnesota')
|
|
1866
1889
|
*/
|
|
1867
|
-
region:
|
|
1890
|
+
region: z14.string().optional(),
|
|
1868
1891
|
/**
|
|
1869
1892
|
* IANA timezone (e.g., 'America/Chicago')
|
|
1870
1893
|
*/
|
|
1871
|
-
timezone:
|
|
1894
|
+
timezone: z14.string().optional()
|
|
1872
1895
|
}).optional()
|
|
1873
1896
|
});
|
|
1874
1897
|
var webSearchPreview = createProviderDefinedToolFactory2({
|
|
1875
1898
|
id: "openai.web_search_preview",
|
|
1876
1899
|
name: "web_search_preview",
|
|
1877
|
-
inputSchema:
|
|
1878
|
-
action:
|
|
1879
|
-
|
|
1880
|
-
type:
|
|
1881
|
-
query:
|
|
1900
|
+
inputSchema: z14.object({
|
|
1901
|
+
action: z14.discriminatedUnion("type", [
|
|
1902
|
+
z14.object({
|
|
1903
|
+
type: z14.literal("search"),
|
|
1904
|
+
query: z14.string().nullish()
|
|
1882
1905
|
}),
|
|
1883
|
-
|
|
1884
|
-
type:
|
|
1885
|
-
url:
|
|
1906
|
+
z14.object({
|
|
1907
|
+
type: z14.literal("open_page"),
|
|
1908
|
+
url: z14.string()
|
|
1886
1909
|
}),
|
|
1887
|
-
|
|
1888
|
-
type:
|
|
1889
|
-
url:
|
|
1890
|
-
pattern:
|
|
1910
|
+
z14.object({
|
|
1911
|
+
type: z14.literal("find"),
|
|
1912
|
+
url: z14.string(),
|
|
1913
|
+
pattern: z14.string()
|
|
1891
1914
|
})
|
|
1892
1915
|
]).nullish()
|
|
1893
1916
|
})
|
|
@@ -1932,6 +1955,15 @@ var openaiTools = {
|
|
|
1932
1955
|
* @param background - Transparent or opaque
|
|
1933
1956
|
*/
|
|
1934
1957
|
imageGeneration,
|
|
1958
|
+
/**
|
|
1959
|
+
* Local shell is a tool that allows agents to run shell commands locally
|
|
1960
|
+
* on a machine you or the user provides.
|
|
1961
|
+
*
|
|
1962
|
+
* Supported models: `gpt-5-codex` and `codex-mini-latest`
|
|
1963
|
+
*
|
|
1964
|
+
* Must have name `local_shell`.
|
|
1965
|
+
*/
|
|
1966
|
+
localShell,
|
|
1935
1967
|
/**
|
|
1936
1968
|
* Web search allows models to access up-to-date information from the internet
|
|
1937
1969
|
* and provide answers with sourced citations.
|
|
@@ -1969,14 +2001,14 @@ import {
|
|
|
1969
2001
|
parseProviderOptions as parseProviderOptions5,
|
|
1970
2002
|
postJsonToApi as postJsonToApi5
|
|
1971
2003
|
} from "@ai-sdk/provider-utils";
|
|
1972
|
-
import { z as
|
|
2004
|
+
import { z as z16 } from "zod/v4";
|
|
1973
2005
|
|
|
1974
2006
|
// src/responses/convert-to-openai-responses-input.ts
|
|
1975
2007
|
import {
|
|
1976
2008
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError4
|
|
1977
2009
|
} from "@ai-sdk/provider";
|
|
1978
2010
|
import { convertToBase64 as convertToBase642, parseProviderOptions as parseProviderOptions4 } from "@ai-sdk/provider-utils";
|
|
1979
|
-
import { z as
|
|
2011
|
+
import { z as z15 } from "zod/v4";
|
|
1980
2012
|
function isFileId(data, prefixes) {
|
|
1981
2013
|
if (!prefixes) return false;
|
|
1982
2014
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -1985,9 +2017,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
1985
2017
|
prompt,
|
|
1986
2018
|
systemMessageMode,
|
|
1987
2019
|
fileIdPrefixes,
|
|
1988
|
-
store
|
|
2020
|
+
store,
|
|
2021
|
+
hasLocalShellTool = false
|
|
1989
2022
|
}) {
|
|
1990
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2023
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1991
2024
|
const input = [];
|
|
1992
2025
|
const warnings = [];
|
|
1993
2026
|
for (const { role, content } of prompt) {
|
|
@@ -2080,12 +2113,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2080
2113
|
if (part.providerExecuted) {
|
|
2081
2114
|
break;
|
|
2082
2115
|
}
|
|
2116
|
+
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2117
|
+
const parsedInput = localShellInputSchema.parse(part.input);
|
|
2118
|
+
input.push({
|
|
2119
|
+
type: "local_shell_call",
|
|
2120
|
+
call_id: part.toolCallId,
|
|
2121
|
+
id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
|
|
2122
|
+
action: {
|
|
2123
|
+
type: "exec",
|
|
2124
|
+
command: parsedInput.action.command,
|
|
2125
|
+
timeout_ms: parsedInput.action.timeoutMs,
|
|
2126
|
+
user: parsedInput.action.user,
|
|
2127
|
+
working_directory: parsedInput.action.workingDirectory,
|
|
2128
|
+
env: parsedInput.action.env
|
|
2129
|
+
}
|
|
2130
|
+
});
|
|
2131
|
+
break;
|
|
2132
|
+
}
|
|
2083
2133
|
input.push({
|
|
2084
2134
|
type: "function_call",
|
|
2085
2135
|
call_id: part.toolCallId,
|
|
2086
2136
|
name: part.toolName,
|
|
2087
2137
|
arguments: JSON.stringify(part.input),
|
|
2088
|
-
id: (
|
|
2138
|
+
id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
|
|
2089
2139
|
});
|
|
2090
2140
|
break;
|
|
2091
2141
|
}
|
|
@@ -2159,6 +2209,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2159
2209
|
case "tool": {
|
|
2160
2210
|
for (const part of content) {
|
|
2161
2211
|
const output = part.output;
|
|
2212
|
+
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2213
|
+
input.push({
|
|
2214
|
+
type: "local_shell_call_output",
|
|
2215
|
+
call_id: part.toolCallId,
|
|
2216
|
+
output: localShellOutputSchema.parse(output.value).output
|
|
2217
|
+
});
|
|
2218
|
+
break;
|
|
2219
|
+
}
|
|
2162
2220
|
let contentValue;
|
|
2163
2221
|
switch (output.type) {
|
|
2164
2222
|
case "text":
|
|
@@ -2187,9 +2245,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2187
2245
|
}
|
|
2188
2246
|
return { input, warnings };
|
|
2189
2247
|
}
|
|
2190
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2191
|
-
itemId:
|
|
2192
|
-
reasoningEncryptedContent:
|
|
2248
|
+
var openaiResponsesReasoningProviderOptionsSchema = z15.object({
|
|
2249
|
+
itemId: z15.string().nullish(),
|
|
2250
|
+
reasoningEncryptedContent: z15.string().nullish()
|
|
2193
2251
|
});
|
|
2194
2252
|
|
|
2195
2253
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2252,6 +2310,12 @@ function prepareResponsesTools({
|
|
|
2252
2310
|
});
|
|
2253
2311
|
break;
|
|
2254
2312
|
}
|
|
2313
|
+
case "openai.local_shell": {
|
|
2314
|
+
openaiTools2.push({
|
|
2315
|
+
type: "local_shell"
|
|
2316
|
+
});
|
|
2317
|
+
break;
|
|
2318
|
+
}
|
|
2255
2319
|
case "openai.web_search_preview": {
|
|
2256
2320
|
const args = webSearchPreviewArgsSchema.parse(tool.args);
|
|
2257
2321
|
openaiTools2.push({
|
|
@@ -2331,73 +2395,86 @@ function prepareResponsesTools({
|
|
|
2331
2395
|
}
|
|
2332
2396
|
|
|
2333
2397
|
// src/responses/openai-responses-language-model.ts
|
|
2334
|
-
var webSearchCallItem =
|
|
2335
|
-
type:
|
|
2336
|
-
id:
|
|
2337
|
-
status:
|
|
2338
|
-
action:
|
|
2339
|
-
|
|
2340
|
-
type:
|
|
2341
|
-
query:
|
|
2398
|
+
var webSearchCallItem = z16.object({
|
|
2399
|
+
type: z16.literal("web_search_call"),
|
|
2400
|
+
id: z16.string(),
|
|
2401
|
+
status: z16.string(),
|
|
2402
|
+
action: z16.discriminatedUnion("type", [
|
|
2403
|
+
z16.object({
|
|
2404
|
+
type: z16.literal("search"),
|
|
2405
|
+
query: z16.string().nullish()
|
|
2342
2406
|
}),
|
|
2343
|
-
|
|
2344
|
-
type:
|
|
2345
|
-
url:
|
|
2407
|
+
z16.object({
|
|
2408
|
+
type: z16.literal("open_page"),
|
|
2409
|
+
url: z16.string()
|
|
2346
2410
|
}),
|
|
2347
|
-
|
|
2348
|
-
type:
|
|
2349
|
-
url:
|
|
2350
|
-
pattern:
|
|
2411
|
+
z16.object({
|
|
2412
|
+
type: z16.literal("find"),
|
|
2413
|
+
url: z16.string(),
|
|
2414
|
+
pattern: z16.string()
|
|
2351
2415
|
})
|
|
2352
2416
|
]).nullish()
|
|
2353
2417
|
});
|
|
2354
|
-
var fileSearchCallItem =
|
|
2355
|
-
type:
|
|
2356
|
-
id:
|
|
2357
|
-
queries:
|
|
2358
|
-
results:
|
|
2359
|
-
|
|
2360
|
-
attributes:
|
|
2361
|
-
file_id:
|
|
2362
|
-
filename:
|
|
2363
|
-
score:
|
|
2364
|
-
text:
|
|
2418
|
+
var fileSearchCallItem = z16.object({
|
|
2419
|
+
type: z16.literal("file_search_call"),
|
|
2420
|
+
id: z16.string(),
|
|
2421
|
+
queries: z16.array(z16.string()),
|
|
2422
|
+
results: z16.array(
|
|
2423
|
+
z16.object({
|
|
2424
|
+
attributes: z16.record(z16.string(), z16.unknown()),
|
|
2425
|
+
file_id: z16.string(),
|
|
2426
|
+
filename: z16.string(),
|
|
2427
|
+
score: z16.number(),
|
|
2428
|
+
text: z16.string()
|
|
2365
2429
|
})
|
|
2366
2430
|
).nullish()
|
|
2367
2431
|
});
|
|
2368
|
-
var codeInterpreterCallItem =
|
|
2369
|
-
type:
|
|
2370
|
-
id:
|
|
2371
|
-
code:
|
|
2372
|
-
container_id:
|
|
2373
|
-
outputs:
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2432
|
+
var codeInterpreterCallItem = z16.object({
|
|
2433
|
+
type: z16.literal("code_interpreter_call"),
|
|
2434
|
+
id: z16.string(),
|
|
2435
|
+
code: z16.string().nullable(),
|
|
2436
|
+
container_id: z16.string(),
|
|
2437
|
+
outputs: z16.array(
|
|
2438
|
+
z16.discriminatedUnion("type", [
|
|
2439
|
+
z16.object({ type: z16.literal("logs"), logs: z16.string() }),
|
|
2440
|
+
z16.object({ type: z16.literal("image"), url: z16.string() })
|
|
2377
2441
|
])
|
|
2378
2442
|
).nullable()
|
|
2379
2443
|
});
|
|
2380
|
-
var
|
|
2381
|
-
type:
|
|
2382
|
-
id:
|
|
2383
|
-
|
|
2444
|
+
var localShellCallItem = z16.object({
|
|
2445
|
+
type: z16.literal("local_shell_call"),
|
|
2446
|
+
id: z16.string(),
|
|
2447
|
+
call_id: z16.string(),
|
|
2448
|
+
action: z16.object({
|
|
2449
|
+
type: z16.literal("exec"),
|
|
2450
|
+
command: z16.array(z16.string()),
|
|
2451
|
+
timeout_ms: z16.number().optional(),
|
|
2452
|
+
user: z16.string().optional(),
|
|
2453
|
+
working_directory: z16.string().optional(),
|
|
2454
|
+
env: z16.record(z16.string(), z16.string()).optional()
|
|
2455
|
+
})
|
|
2456
|
+
});
|
|
2457
|
+
var imageGenerationCallItem = z16.object({
|
|
2458
|
+
type: z16.literal("image_generation_call"),
|
|
2459
|
+
id: z16.string(),
|
|
2460
|
+
result: z16.string()
|
|
2384
2461
|
});
|
|
2385
2462
|
var TOP_LOGPROBS_MAX = 20;
|
|
2386
|
-
var LOGPROBS_SCHEMA =
|
|
2387
|
-
|
|
2388
|
-
token:
|
|
2389
|
-
logprob:
|
|
2390
|
-
top_logprobs:
|
|
2391
|
-
|
|
2392
|
-
token:
|
|
2393
|
-
logprob:
|
|
2463
|
+
var LOGPROBS_SCHEMA = z16.array(
|
|
2464
|
+
z16.object({
|
|
2465
|
+
token: z16.string(),
|
|
2466
|
+
logprob: z16.number(),
|
|
2467
|
+
top_logprobs: z16.array(
|
|
2468
|
+
z16.object({
|
|
2469
|
+
token: z16.string(),
|
|
2470
|
+
logprob: z16.number()
|
|
2394
2471
|
})
|
|
2395
2472
|
)
|
|
2396
2473
|
})
|
|
2397
2474
|
);
|
|
2398
2475
|
var OpenAIResponsesLanguageModel = class {
|
|
2399
2476
|
constructor(modelId, config) {
|
|
2400
|
-
this.specificationVersion = "
|
|
2477
|
+
this.specificationVersion = "v3";
|
|
2401
2478
|
this.supportedUrls = {
|
|
2402
2479
|
"image/*": [/^https?:\/\/.*$/],
|
|
2403
2480
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -2456,7 +2533,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2456
2533
|
prompt,
|
|
2457
2534
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
2458
2535
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
2459
|
-
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
|
|
2536
|
+
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
2537
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
2460
2538
|
});
|
|
2461
2539
|
warnings.push(...inputWarnings);
|
|
2462
2540
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
@@ -2621,45 +2699,45 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2621
2699
|
body,
|
|
2622
2700
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2623
2701
|
successfulResponseHandler: createJsonResponseHandler5(
|
|
2624
|
-
|
|
2625
|
-
id:
|
|
2626
|
-
created_at:
|
|
2627
|
-
error:
|
|
2628
|
-
code:
|
|
2629
|
-
message:
|
|
2702
|
+
z16.object({
|
|
2703
|
+
id: z16.string(),
|
|
2704
|
+
created_at: z16.number(),
|
|
2705
|
+
error: z16.object({
|
|
2706
|
+
code: z16.string(),
|
|
2707
|
+
message: z16.string()
|
|
2630
2708
|
}).nullish(),
|
|
2631
|
-
model:
|
|
2632
|
-
output:
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
type:
|
|
2636
|
-
role:
|
|
2637
|
-
id:
|
|
2638
|
-
content:
|
|
2639
|
-
|
|
2640
|
-
type:
|
|
2641
|
-
text:
|
|
2709
|
+
model: z16.string(),
|
|
2710
|
+
output: z16.array(
|
|
2711
|
+
z16.discriminatedUnion("type", [
|
|
2712
|
+
z16.object({
|
|
2713
|
+
type: z16.literal("message"),
|
|
2714
|
+
role: z16.literal("assistant"),
|
|
2715
|
+
id: z16.string(),
|
|
2716
|
+
content: z16.array(
|
|
2717
|
+
z16.object({
|
|
2718
|
+
type: z16.literal("output_text"),
|
|
2719
|
+
text: z16.string(),
|
|
2642
2720
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2643
|
-
annotations:
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
type:
|
|
2647
|
-
start_index:
|
|
2648
|
-
end_index:
|
|
2649
|
-
url:
|
|
2650
|
-
title:
|
|
2721
|
+
annotations: z16.array(
|
|
2722
|
+
z16.discriminatedUnion("type", [
|
|
2723
|
+
z16.object({
|
|
2724
|
+
type: z16.literal("url_citation"),
|
|
2725
|
+
start_index: z16.number(),
|
|
2726
|
+
end_index: z16.number(),
|
|
2727
|
+
url: z16.string(),
|
|
2728
|
+
title: z16.string()
|
|
2651
2729
|
}),
|
|
2652
|
-
|
|
2653
|
-
type:
|
|
2654
|
-
file_id:
|
|
2655
|
-
filename:
|
|
2656
|
-
index:
|
|
2657
|
-
start_index:
|
|
2658
|
-
end_index:
|
|
2659
|
-
quote:
|
|
2730
|
+
z16.object({
|
|
2731
|
+
type: z16.literal("file_citation"),
|
|
2732
|
+
file_id: z16.string(),
|
|
2733
|
+
filename: z16.string().nullish(),
|
|
2734
|
+
index: z16.number().nullish(),
|
|
2735
|
+
start_index: z16.number().nullish(),
|
|
2736
|
+
end_index: z16.number().nullish(),
|
|
2737
|
+
quote: z16.string().nullish()
|
|
2660
2738
|
}),
|
|
2661
|
-
|
|
2662
|
-
type:
|
|
2739
|
+
z16.object({
|
|
2740
|
+
type: z16.literal("container_file_citation")
|
|
2663
2741
|
})
|
|
2664
2742
|
])
|
|
2665
2743
|
)
|
|
@@ -2670,33 +2748,34 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2670
2748
|
fileSearchCallItem,
|
|
2671
2749
|
codeInterpreterCallItem,
|
|
2672
2750
|
imageGenerationCallItem,
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2751
|
+
localShellCallItem,
|
|
2752
|
+
z16.object({
|
|
2753
|
+
type: z16.literal("function_call"),
|
|
2754
|
+
call_id: z16.string(),
|
|
2755
|
+
name: z16.string(),
|
|
2756
|
+
arguments: z16.string(),
|
|
2757
|
+
id: z16.string()
|
|
2679
2758
|
}),
|
|
2680
|
-
|
|
2681
|
-
type:
|
|
2682
|
-
id:
|
|
2683
|
-
status:
|
|
2759
|
+
z16.object({
|
|
2760
|
+
type: z16.literal("computer_call"),
|
|
2761
|
+
id: z16.string(),
|
|
2762
|
+
status: z16.string().optional()
|
|
2684
2763
|
}),
|
|
2685
|
-
|
|
2686
|
-
type:
|
|
2687
|
-
id:
|
|
2688
|
-
encrypted_content:
|
|
2689
|
-
summary:
|
|
2690
|
-
|
|
2691
|
-
type:
|
|
2692
|
-
text:
|
|
2764
|
+
z16.object({
|
|
2765
|
+
type: z16.literal("reasoning"),
|
|
2766
|
+
id: z16.string(),
|
|
2767
|
+
encrypted_content: z16.string().nullish(),
|
|
2768
|
+
summary: z16.array(
|
|
2769
|
+
z16.object({
|
|
2770
|
+
type: z16.literal("summary_text"),
|
|
2771
|
+
text: z16.string()
|
|
2693
2772
|
})
|
|
2694
2773
|
)
|
|
2695
2774
|
})
|
|
2696
2775
|
])
|
|
2697
2776
|
),
|
|
2698
|
-
service_tier:
|
|
2699
|
-
incomplete_details:
|
|
2777
|
+
service_tier: z16.string().nullish(),
|
|
2778
|
+
incomplete_details: z16.object({ reason: z16.string() }).nullish(),
|
|
2700
2779
|
usage: usageSchema2
|
|
2701
2780
|
})
|
|
2702
2781
|
),
|
|
@@ -2756,6 +2835,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2756
2835
|
});
|
|
2757
2836
|
break;
|
|
2758
2837
|
}
|
|
2838
|
+
case "local_shell_call": {
|
|
2839
|
+
content.push({
|
|
2840
|
+
type: "tool-call",
|
|
2841
|
+
toolCallId: part.call_id,
|
|
2842
|
+
toolName: "local_shell",
|
|
2843
|
+
input: JSON.stringify({ action: part.action }),
|
|
2844
|
+
providerMetadata: {
|
|
2845
|
+
openai: {
|
|
2846
|
+
itemId: part.id
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
});
|
|
2850
|
+
break;
|
|
2851
|
+
}
|
|
2759
2852
|
case "message": {
|
|
2760
2853
|
for (const contentPart of part.content) {
|
|
2761
2854
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -3013,6 +3106,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3013
3106
|
id: value.item.id,
|
|
3014
3107
|
toolName: "computer_use"
|
|
3015
3108
|
});
|
|
3109
|
+
} else if (value.item.type === "code_interpreter_call") {
|
|
3110
|
+
ongoingToolCalls[value.output_index] = {
|
|
3111
|
+
toolName: "code_interpreter",
|
|
3112
|
+
toolCallId: value.item.id,
|
|
3113
|
+
codeInterpreter: {
|
|
3114
|
+
containerId: value.item.container_id
|
|
3115
|
+
}
|
|
3116
|
+
};
|
|
3117
|
+
controller.enqueue({
|
|
3118
|
+
type: "tool-input-start",
|
|
3119
|
+
id: value.item.id,
|
|
3120
|
+
toolName: "code_interpreter"
|
|
3121
|
+
});
|
|
3122
|
+
controller.enqueue({
|
|
3123
|
+
type: "tool-input-delta",
|
|
3124
|
+
id: value.item.id,
|
|
3125
|
+
delta: `{"containerId":"${value.item.container_id}","code":"`
|
|
3126
|
+
});
|
|
3016
3127
|
} else if (value.item.type === "file_search_call") {
|
|
3017
3128
|
controller.enqueue({
|
|
3018
3129
|
type: "tool-call",
|
|
@@ -3136,16 +3247,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3136
3247
|
providerExecuted: true
|
|
3137
3248
|
});
|
|
3138
3249
|
} else if (value.item.type === "code_interpreter_call") {
|
|
3139
|
-
|
|
3140
|
-
type: "tool-call",
|
|
3141
|
-
toolCallId: value.item.id,
|
|
3142
|
-
toolName: "code_interpreter",
|
|
3143
|
-
input: JSON.stringify({
|
|
3144
|
-
code: value.item.code,
|
|
3145
|
-
containerId: value.item.container_id
|
|
3146
|
-
}),
|
|
3147
|
-
providerExecuted: true
|
|
3148
|
-
});
|
|
3250
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3149
3251
|
controller.enqueue({
|
|
3150
3252
|
type: "tool-result",
|
|
3151
3253
|
toolCallId: value.item.id,
|
|
@@ -3165,6 +3267,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3165
3267
|
},
|
|
3166
3268
|
providerExecuted: true
|
|
3167
3269
|
});
|
|
3270
|
+
} else if (value.item.type === "local_shell_call") {
|
|
3271
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
3272
|
+
controller.enqueue({
|
|
3273
|
+
type: "tool-call",
|
|
3274
|
+
toolCallId: value.item.call_id,
|
|
3275
|
+
toolName: "local_shell",
|
|
3276
|
+
input: JSON.stringify({
|
|
3277
|
+
action: {
|
|
3278
|
+
type: "exec",
|
|
3279
|
+
command: value.item.action.command,
|
|
3280
|
+
timeoutMs: value.item.action.timeout_ms,
|
|
3281
|
+
user: value.item.action.user,
|
|
3282
|
+
workingDirectory: value.item.action.working_directory,
|
|
3283
|
+
env: value.item.action.env
|
|
3284
|
+
}
|
|
3285
|
+
}),
|
|
3286
|
+
providerMetadata: {
|
|
3287
|
+
openai: { itemId: value.item.id }
|
|
3288
|
+
}
|
|
3289
|
+
});
|
|
3168
3290
|
} else if (value.item.type === "message") {
|
|
3169
3291
|
controller.enqueue({
|
|
3170
3292
|
type: "text-end",
|
|
@@ -3195,6 +3317,40 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3195
3317
|
delta: value.delta
|
|
3196
3318
|
});
|
|
3197
3319
|
}
|
|
3320
|
+
} else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
|
|
3321
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3322
|
+
if (toolCall != null) {
|
|
3323
|
+
controller.enqueue({
|
|
3324
|
+
type: "tool-input-delta",
|
|
3325
|
+
id: toolCall.toolCallId,
|
|
3326
|
+
// The delta is code, which is embedding in a JSON string.
|
|
3327
|
+
// To escape it, we use JSON.stringify and slice to remove the outer quotes.
|
|
3328
|
+
delta: JSON.stringify(value.delta).slice(1, -1)
|
|
3329
|
+
});
|
|
3330
|
+
}
|
|
3331
|
+
} else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
|
|
3332
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
3333
|
+
if (toolCall != null) {
|
|
3334
|
+
controller.enqueue({
|
|
3335
|
+
type: "tool-input-delta",
|
|
3336
|
+
id: toolCall.toolCallId,
|
|
3337
|
+
delta: '"}'
|
|
3338
|
+
});
|
|
3339
|
+
controller.enqueue({
|
|
3340
|
+
type: "tool-input-end",
|
|
3341
|
+
id: toolCall.toolCallId
|
|
3342
|
+
});
|
|
3343
|
+
controller.enqueue({
|
|
3344
|
+
type: "tool-call",
|
|
3345
|
+
toolCallId: toolCall.toolCallId,
|
|
3346
|
+
toolName: "code_interpreter",
|
|
3347
|
+
input: JSON.stringify({
|
|
3348
|
+
code: value.code,
|
|
3349
|
+
containerId: toolCall.codeInterpreter.containerId
|
|
3350
|
+
}),
|
|
3351
|
+
providerExecuted: true
|
|
3352
|
+
});
|
|
3353
|
+
}
|
|
3198
3354
|
} else if (isResponseCreatedChunk(value)) {
|
|
3199
3355
|
responseId = value.response.id;
|
|
3200
3356
|
controller.enqueue({
|
|
@@ -3301,166 +3457,194 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3301
3457
|
};
|
|
3302
3458
|
}
|
|
3303
3459
|
};
|
|
3304
|
-
var usageSchema2 =
|
|
3305
|
-
input_tokens:
|
|
3306
|
-
input_tokens_details:
|
|
3307
|
-
output_tokens:
|
|
3308
|
-
output_tokens_details:
|
|
3460
|
+
var usageSchema2 = z16.object({
|
|
3461
|
+
input_tokens: z16.number(),
|
|
3462
|
+
input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
|
|
3463
|
+
output_tokens: z16.number(),
|
|
3464
|
+
output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
|
|
3309
3465
|
});
|
|
3310
|
-
var textDeltaChunkSchema =
|
|
3311
|
-
type:
|
|
3312
|
-
item_id:
|
|
3313
|
-
delta:
|
|
3466
|
+
var textDeltaChunkSchema = z16.object({
|
|
3467
|
+
type: z16.literal("response.output_text.delta"),
|
|
3468
|
+
item_id: z16.string(),
|
|
3469
|
+
delta: z16.string(),
|
|
3314
3470
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3315
3471
|
});
|
|
3316
|
-
var errorChunkSchema =
|
|
3317
|
-
type:
|
|
3318
|
-
code:
|
|
3319
|
-
message:
|
|
3320
|
-
param:
|
|
3321
|
-
sequence_number:
|
|
3472
|
+
var errorChunkSchema = z16.object({
|
|
3473
|
+
type: z16.literal("error"),
|
|
3474
|
+
code: z16.string(),
|
|
3475
|
+
message: z16.string(),
|
|
3476
|
+
param: z16.string().nullish(),
|
|
3477
|
+
sequence_number: z16.number()
|
|
3322
3478
|
});
|
|
3323
|
-
var responseFinishedChunkSchema =
|
|
3324
|
-
type:
|
|
3325
|
-
response:
|
|
3326
|
-
incomplete_details:
|
|
3479
|
+
var responseFinishedChunkSchema = z16.object({
|
|
3480
|
+
type: z16.enum(["response.completed", "response.incomplete"]),
|
|
3481
|
+
response: z16.object({
|
|
3482
|
+
incomplete_details: z16.object({ reason: z16.string() }).nullish(),
|
|
3327
3483
|
usage: usageSchema2,
|
|
3328
|
-
service_tier:
|
|
3484
|
+
service_tier: z16.string().nullish()
|
|
3329
3485
|
})
|
|
3330
3486
|
});
|
|
3331
|
-
var responseCreatedChunkSchema =
|
|
3332
|
-
type:
|
|
3333
|
-
response:
|
|
3334
|
-
id:
|
|
3335
|
-
created_at:
|
|
3336
|
-
model:
|
|
3337
|
-
service_tier:
|
|
3487
|
+
var responseCreatedChunkSchema = z16.object({
|
|
3488
|
+
type: z16.literal("response.created"),
|
|
3489
|
+
response: z16.object({
|
|
3490
|
+
id: z16.string(),
|
|
3491
|
+
created_at: z16.number(),
|
|
3492
|
+
model: z16.string(),
|
|
3493
|
+
service_tier: z16.string().nullish()
|
|
3338
3494
|
})
|
|
3339
3495
|
});
|
|
3340
|
-
var responseOutputItemAddedSchema =
|
|
3341
|
-
type:
|
|
3342
|
-
output_index:
|
|
3343
|
-
item:
|
|
3344
|
-
|
|
3345
|
-
type:
|
|
3346
|
-
id:
|
|
3496
|
+
var responseOutputItemAddedSchema = z16.object({
|
|
3497
|
+
type: z16.literal("response.output_item.added"),
|
|
3498
|
+
output_index: z16.number(),
|
|
3499
|
+
item: z16.discriminatedUnion("type", [
|
|
3500
|
+
z16.object({
|
|
3501
|
+
type: z16.literal("message"),
|
|
3502
|
+
id: z16.string()
|
|
3347
3503
|
}),
|
|
3348
|
-
|
|
3349
|
-
type:
|
|
3350
|
-
id:
|
|
3351
|
-
encrypted_content:
|
|
3504
|
+
z16.object({
|
|
3505
|
+
type: z16.literal("reasoning"),
|
|
3506
|
+
id: z16.string(),
|
|
3507
|
+
encrypted_content: z16.string().nullish()
|
|
3352
3508
|
}),
|
|
3353
|
-
|
|
3354
|
-
type:
|
|
3355
|
-
id:
|
|
3356
|
-
call_id:
|
|
3357
|
-
name:
|
|
3358
|
-
arguments:
|
|
3509
|
+
z16.object({
|
|
3510
|
+
type: z16.literal("function_call"),
|
|
3511
|
+
id: z16.string(),
|
|
3512
|
+
call_id: z16.string(),
|
|
3513
|
+
name: z16.string(),
|
|
3514
|
+
arguments: z16.string()
|
|
3359
3515
|
}),
|
|
3360
|
-
|
|
3361
|
-
type:
|
|
3362
|
-
id:
|
|
3363
|
-
status:
|
|
3364
|
-
action:
|
|
3365
|
-
type:
|
|
3366
|
-
query:
|
|
3516
|
+
z16.object({
|
|
3517
|
+
type: z16.literal("web_search_call"),
|
|
3518
|
+
id: z16.string(),
|
|
3519
|
+
status: z16.string(),
|
|
3520
|
+
action: z16.object({
|
|
3521
|
+
type: z16.literal("search"),
|
|
3522
|
+
query: z16.string().optional()
|
|
3367
3523
|
}).nullish()
|
|
3368
3524
|
}),
|
|
3369
|
-
|
|
3370
|
-
type:
|
|
3371
|
-
id:
|
|
3372
|
-
status:
|
|
3525
|
+
z16.object({
|
|
3526
|
+
type: z16.literal("computer_call"),
|
|
3527
|
+
id: z16.string(),
|
|
3528
|
+
status: z16.string()
|
|
3529
|
+
}),
|
|
3530
|
+
z16.object({
|
|
3531
|
+
type: z16.literal("file_search_call"),
|
|
3532
|
+
id: z16.string()
|
|
3373
3533
|
}),
|
|
3374
|
-
|
|
3375
|
-
type:
|
|
3376
|
-
id:
|
|
3534
|
+
z16.object({
|
|
3535
|
+
type: z16.literal("image_generation_call"),
|
|
3536
|
+
id: z16.string()
|
|
3377
3537
|
}),
|
|
3378
|
-
|
|
3379
|
-
type:
|
|
3380
|
-
id:
|
|
3538
|
+
z16.object({
|
|
3539
|
+
type: z16.literal("code_interpreter_call"),
|
|
3540
|
+
id: z16.string(),
|
|
3541
|
+
container_id: z16.string(),
|
|
3542
|
+
code: z16.string().nullable(),
|
|
3543
|
+
outputs: z16.array(
|
|
3544
|
+
z16.discriminatedUnion("type", [
|
|
3545
|
+
z16.object({ type: z16.literal("logs"), logs: z16.string() }),
|
|
3546
|
+
z16.object({ type: z16.literal("image"), url: z16.string() })
|
|
3547
|
+
])
|
|
3548
|
+
).nullable(),
|
|
3549
|
+
status: z16.string()
|
|
3381
3550
|
})
|
|
3382
3551
|
])
|
|
3383
3552
|
});
|
|
3384
|
-
var responseOutputItemDoneSchema =
|
|
3385
|
-
type:
|
|
3386
|
-
output_index:
|
|
3387
|
-
item:
|
|
3388
|
-
|
|
3389
|
-
type:
|
|
3390
|
-
id:
|
|
3553
|
+
var responseOutputItemDoneSchema = z16.object({
|
|
3554
|
+
type: z16.literal("response.output_item.done"),
|
|
3555
|
+
output_index: z16.number(),
|
|
3556
|
+
item: z16.discriminatedUnion("type", [
|
|
3557
|
+
z16.object({
|
|
3558
|
+
type: z16.literal("message"),
|
|
3559
|
+
id: z16.string()
|
|
3391
3560
|
}),
|
|
3392
|
-
|
|
3393
|
-
type:
|
|
3394
|
-
id:
|
|
3395
|
-
encrypted_content:
|
|
3561
|
+
z16.object({
|
|
3562
|
+
type: z16.literal("reasoning"),
|
|
3563
|
+
id: z16.string(),
|
|
3564
|
+
encrypted_content: z16.string().nullish()
|
|
3396
3565
|
}),
|
|
3397
|
-
|
|
3398
|
-
type:
|
|
3399
|
-
id:
|
|
3400
|
-
call_id:
|
|
3401
|
-
name:
|
|
3402
|
-
arguments:
|
|
3403
|
-
status:
|
|
3566
|
+
z16.object({
|
|
3567
|
+
type: z16.literal("function_call"),
|
|
3568
|
+
id: z16.string(),
|
|
3569
|
+
call_id: z16.string(),
|
|
3570
|
+
name: z16.string(),
|
|
3571
|
+
arguments: z16.string(),
|
|
3572
|
+
status: z16.literal("completed")
|
|
3404
3573
|
}),
|
|
3405
3574
|
codeInterpreterCallItem,
|
|
3406
3575
|
imageGenerationCallItem,
|
|
3407
3576
|
webSearchCallItem,
|
|
3408
3577
|
fileSearchCallItem,
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3578
|
+
localShellCallItem,
|
|
3579
|
+
z16.object({
|
|
3580
|
+
type: z16.literal("computer_call"),
|
|
3581
|
+
id: z16.string(),
|
|
3582
|
+
status: z16.literal("completed")
|
|
3413
3583
|
})
|
|
3414
3584
|
])
|
|
3415
3585
|
});
|
|
3416
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3417
|
-
type:
|
|
3418
|
-
item_id:
|
|
3419
|
-
output_index:
|
|
3420
|
-
delta:
|
|
3586
|
+
var responseFunctionCallArgumentsDeltaSchema = z16.object({
|
|
3587
|
+
type: z16.literal("response.function_call_arguments.delta"),
|
|
3588
|
+
item_id: z16.string(),
|
|
3589
|
+
output_index: z16.number(),
|
|
3590
|
+
delta: z16.string()
|
|
3591
|
+
});
|
|
3592
|
+
var responseCodeInterpreterCallCodeDeltaSchema = z16.object({
|
|
3593
|
+
type: z16.literal("response.code_interpreter_call_code.delta"),
|
|
3594
|
+
item_id: z16.string(),
|
|
3595
|
+
output_index: z16.number(),
|
|
3596
|
+
delta: z16.string()
|
|
3597
|
+
});
|
|
3598
|
+
var responseCodeInterpreterCallCodeDoneSchema = z16.object({
|
|
3599
|
+
type: z16.literal("response.code_interpreter_call_code.done"),
|
|
3600
|
+
item_id: z16.string(),
|
|
3601
|
+
output_index: z16.number(),
|
|
3602
|
+
code: z16.string()
|
|
3421
3603
|
});
|
|
3422
|
-
var responseAnnotationAddedSchema =
|
|
3423
|
-
type:
|
|
3424
|
-
annotation:
|
|
3425
|
-
|
|
3426
|
-
type:
|
|
3427
|
-
url:
|
|
3428
|
-
title:
|
|
3604
|
+
var responseAnnotationAddedSchema = z16.object({
|
|
3605
|
+
type: z16.literal("response.output_text.annotation.added"),
|
|
3606
|
+
annotation: z16.discriminatedUnion("type", [
|
|
3607
|
+
z16.object({
|
|
3608
|
+
type: z16.literal("url_citation"),
|
|
3609
|
+
url: z16.string(),
|
|
3610
|
+
title: z16.string()
|
|
3429
3611
|
}),
|
|
3430
|
-
|
|
3431
|
-
type:
|
|
3432
|
-
file_id:
|
|
3433
|
-
filename:
|
|
3434
|
-
index:
|
|
3435
|
-
start_index:
|
|
3436
|
-
end_index:
|
|
3437
|
-
quote:
|
|
3612
|
+
z16.object({
|
|
3613
|
+
type: z16.literal("file_citation"),
|
|
3614
|
+
file_id: z16.string(),
|
|
3615
|
+
filename: z16.string().nullish(),
|
|
3616
|
+
index: z16.number().nullish(),
|
|
3617
|
+
start_index: z16.number().nullish(),
|
|
3618
|
+
end_index: z16.number().nullish(),
|
|
3619
|
+
quote: z16.string().nullish()
|
|
3438
3620
|
})
|
|
3439
3621
|
])
|
|
3440
3622
|
});
|
|
3441
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3442
|
-
type:
|
|
3443
|
-
item_id:
|
|
3444
|
-
summary_index:
|
|
3623
|
+
var responseReasoningSummaryPartAddedSchema = z16.object({
|
|
3624
|
+
type: z16.literal("response.reasoning_summary_part.added"),
|
|
3625
|
+
item_id: z16.string(),
|
|
3626
|
+
summary_index: z16.number()
|
|
3445
3627
|
});
|
|
3446
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3447
|
-
type:
|
|
3448
|
-
item_id:
|
|
3449
|
-
summary_index:
|
|
3450
|
-
delta:
|
|
3628
|
+
var responseReasoningSummaryTextDeltaSchema = z16.object({
|
|
3629
|
+
type: z16.literal("response.reasoning_summary_text.delta"),
|
|
3630
|
+
item_id: z16.string(),
|
|
3631
|
+
summary_index: z16.number(),
|
|
3632
|
+
delta: z16.string()
|
|
3451
3633
|
});
|
|
3452
|
-
var openaiResponsesChunkSchema =
|
|
3634
|
+
var openaiResponsesChunkSchema = z16.union([
|
|
3453
3635
|
textDeltaChunkSchema,
|
|
3454
3636
|
responseFinishedChunkSchema,
|
|
3455
3637
|
responseCreatedChunkSchema,
|
|
3456
3638
|
responseOutputItemAddedSchema,
|
|
3457
3639
|
responseOutputItemDoneSchema,
|
|
3458
3640
|
responseFunctionCallArgumentsDeltaSchema,
|
|
3641
|
+
responseCodeInterpreterCallCodeDeltaSchema,
|
|
3642
|
+
responseCodeInterpreterCallCodeDoneSchema,
|
|
3459
3643
|
responseAnnotationAddedSchema,
|
|
3460
3644
|
responseReasoningSummaryPartAddedSchema,
|
|
3461
3645
|
responseReasoningSummaryTextDeltaSchema,
|
|
3462
3646
|
errorChunkSchema,
|
|
3463
|
-
|
|
3647
|
+
z16.object({ type: z16.string() }).loose()
|
|
3464
3648
|
// fallback for unknown chunks
|
|
3465
3649
|
]);
|
|
3466
3650
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3481,6 +3665,12 @@ function isResponseCreatedChunk(chunk) {
|
|
|
3481
3665
|
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
3482
3666
|
return chunk.type === "response.function_call_arguments.delta";
|
|
3483
3667
|
}
|
|
3668
|
+
function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
|
|
3669
|
+
return chunk.type === "response.code_interpreter_call_code.delta";
|
|
3670
|
+
}
|
|
3671
|
+
function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
|
|
3672
|
+
return chunk.type === "response.code_interpreter_call_code.done";
|
|
3673
|
+
}
|
|
3484
3674
|
function isResponseOutputItemAddedChunk(chunk) {
|
|
3485
3675
|
return chunk.type === "response.output_item.added";
|
|
3486
3676
|
}
|
|
@@ -3533,15 +3723,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3533
3723
|
isReasoningModel: false
|
|
3534
3724
|
};
|
|
3535
3725
|
}
|
|
3536
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3537
|
-
include:
|
|
3538
|
-
|
|
3726
|
+
var openaiResponsesProviderOptionsSchema = z16.object({
|
|
3727
|
+
include: z16.array(
|
|
3728
|
+
z16.enum([
|
|
3539
3729
|
"reasoning.encrypted_content",
|
|
3540
3730
|
"file_search_call.results",
|
|
3541
3731
|
"message.output_text.logprobs"
|
|
3542
3732
|
])
|
|
3543
3733
|
).nullish(),
|
|
3544
|
-
instructions:
|
|
3734
|
+
instructions: z16.string().nullish(),
|
|
3545
3735
|
/**
|
|
3546
3736
|
* Return the log probabilities of the tokens.
|
|
3547
3737
|
*
|
|
@@ -3554,25 +3744,25 @@ var openaiResponsesProviderOptionsSchema = z15.object({
|
|
|
3554
3744
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3555
3745
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3556
3746
|
*/
|
|
3557
|
-
logprobs:
|
|
3747
|
+
logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3558
3748
|
/**
|
|
3559
3749
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3560
3750
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3561
3751
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3562
3752
|
*/
|
|
3563
|
-
maxToolCalls:
|
|
3564
|
-
metadata:
|
|
3565
|
-
parallelToolCalls:
|
|
3566
|
-
previousResponseId:
|
|
3567
|
-
promptCacheKey:
|
|
3568
|
-
reasoningEffort:
|
|
3569
|
-
reasoningSummary:
|
|
3570
|
-
safetyIdentifier:
|
|
3571
|
-
serviceTier:
|
|
3572
|
-
store:
|
|
3573
|
-
strictJsonSchema:
|
|
3574
|
-
textVerbosity:
|
|
3575
|
-
user:
|
|
3753
|
+
maxToolCalls: z16.number().nullish(),
|
|
3754
|
+
metadata: z16.any().nullish(),
|
|
3755
|
+
parallelToolCalls: z16.boolean().nullish(),
|
|
3756
|
+
previousResponseId: z16.string().nullish(),
|
|
3757
|
+
promptCacheKey: z16.string().nullish(),
|
|
3758
|
+
reasoningEffort: z16.string().nullish(),
|
|
3759
|
+
reasoningSummary: z16.string().nullish(),
|
|
3760
|
+
safetyIdentifier: z16.string().nullish(),
|
|
3761
|
+
serviceTier: z16.enum(["auto", "flex", "priority"]).nullish(),
|
|
3762
|
+
store: z16.boolean().nullish(),
|
|
3763
|
+
strictJsonSchema: z16.boolean().nullish(),
|
|
3764
|
+
textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
|
|
3765
|
+
user: z16.string().nullish()
|
|
3576
3766
|
});
|
|
3577
3767
|
|
|
3578
3768
|
// src/speech/openai-speech-model.ts
|
|
@@ -3582,10 +3772,10 @@ import {
|
|
|
3582
3772
|
parseProviderOptions as parseProviderOptions6,
|
|
3583
3773
|
postJsonToApi as postJsonToApi6
|
|
3584
3774
|
} from "@ai-sdk/provider-utils";
|
|
3585
|
-
import { z as
|
|
3586
|
-
var OpenAIProviderOptionsSchema =
|
|
3587
|
-
instructions:
|
|
3588
|
-
speed:
|
|
3775
|
+
import { z as z17 } from "zod/v4";
|
|
3776
|
+
var OpenAIProviderOptionsSchema = z17.object({
|
|
3777
|
+
instructions: z17.string().nullish(),
|
|
3778
|
+
speed: z17.number().min(0.25).max(4).default(1).nullish()
|
|
3589
3779
|
});
|
|
3590
3780
|
var OpenAISpeechModel = class {
|
|
3591
3781
|
constructor(modelId, config) {
|
|
@@ -3696,33 +3886,33 @@ import {
|
|
|
3696
3886
|
parseProviderOptions as parseProviderOptions7,
|
|
3697
3887
|
postFormDataToApi
|
|
3698
3888
|
} from "@ai-sdk/provider-utils";
|
|
3699
|
-
import { z as
|
|
3889
|
+
import { z as z19 } from "zod/v4";
|
|
3700
3890
|
|
|
3701
3891
|
// src/transcription/openai-transcription-options.ts
|
|
3702
|
-
import { z as
|
|
3703
|
-
var openAITranscriptionProviderOptions =
|
|
3892
|
+
import { z as z18 } from "zod/v4";
|
|
3893
|
+
var openAITranscriptionProviderOptions = z18.object({
|
|
3704
3894
|
/**
|
|
3705
3895
|
* Additional information to include in the transcription response.
|
|
3706
3896
|
*/
|
|
3707
|
-
include:
|
|
3897
|
+
include: z18.array(z18.string()).optional(),
|
|
3708
3898
|
/**
|
|
3709
3899
|
* The language of the input audio in ISO-639-1 format.
|
|
3710
3900
|
*/
|
|
3711
|
-
language:
|
|
3901
|
+
language: z18.string().optional(),
|
|
3712
3902
|
/**
|
|
3713
3903
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
3714
3904
|
*/
|
|
3715
|
-
prompt:
|
|
3905
|
+
prompt: z18.string().optional(),
|
|
3716
3906
|
/**
|
|
3717
3907
|
* The sampling temperature, between 0 and 1.
|
|
3718
3908
|
* @default 0
|
|
3719
3909
|
*/
|
|
3720
|
-
temperature:
|
|
3910
|
+
temperature: z18.number().min(0).max(1).default(0).optional(),
|
|
3721
3911
|
/**
|
|
3722
3912
|
* The timestamp granularities to populate for this transcription.
|
|
3723
3913
|
* @default ['segment']
|
|
3724
3914
|
*/
|
|
3725
|
-
timestampGranularities:
|
|
3915
|
+
timestampGranularities: z18.array(z18.enum(["word", "segment"])).default(["segment"]).optional()
|
|
3726
3916
|
});
|
|
3727
3917
|
|
|
3728
3918
|
// src/transcription/openai-transcription-model.ts
|
|
@@ -3891,35 +4081,35 @@ var OpenAITranscriptionModel = class {
|
|
|
3891
4081
|
};
|
|
3892
4082
|
}
|
|
3893
4083
|
};
|
|
3894
|
-
var openaiTranscriptionResponseSchema =
|
|
3895
|
-
text:
|
|
3896
|
-
language:
|
|
3897
|
-
duration:
|
|
3898
|
-
words:
|
|
3899
|
-
|
|
3900
|
-
word:
|
|
3901
|
-
start:
|
|
3902
|
-
end:
|
|
4084
|
+
var openaiTranscriptionResponseSchema = z19.object({
|
|
4085
|
+
text: z19.string(),
|
|
4086
|
+
language: z19.string().nullish(),
|
|
4087
|
+
duration: z19.number().nullish(),
|
|
4088
|
+
words: z19.array(
|
|
4089
|
+
z19.object({
|
|
4090
|
+
word: z19.string(),
|
|
4091
|
+
start: z19.number(),
|
|
4092
|
+
end: z19.number()
|
|
3903
4093
|
})
|
|
3904
4094
|
).nullish(),
|
|
3905
|
-
segments:
|
|
3906
|
-
|
|
3907
|
-
id:
|
|
3908
|
-
seek:
|
|
3909
|
-
start:
|
|
3910
|
-
end:
|
|
3911
|
-
text:
|
|
3912
|
-
tokens:
|
|
3913
|
-
temperature:
|
|
3914
|
-
avg_logprob:
|
|
3915
|
-
compression_ratio:
|
|
3916
|
-
no_speech_prob:
|
|
4095
|
+
segments: z19.array(
|
|
4096
|
+
z19.object({
|
|
4097
|
+
id: z19.number(),
|
|
4098
|
+
seek: z19.number(),
|
|
4099
|
+
start: z19.number(),
|
|
4100
|
+
end: z19.number(),
|
|
4101
|
+
text: z19.string(),
|
|
4102
|
+
tokens: z19.array(z19.number()),
|
|
4103
|
+
temperature: z19.number(),
|
|
4104
|
+
avg_logprob: z19.number(),
|
|
4105
|
+
compression_ratio: z19.number(),
|
|
4106
|
+
no_speech_prob: z19.number()
|
|
3917
4107
|
})
|
|
3918
4108
|
).nullish()
|
|
3919
4109
|
});
|
|
3920
4110
|
|
|
3921
4111
|
// src/version.ts
|
|
3922
|
-
var VERSION = true ? "2.1.0-beta.
|
|
4112
|
+
var VERSION = true ? "2.1.0-beta.8" : "0.0.0-test";
|
|
3923
4113
|
|
|
3924
4114
|
// src/openai-provider.ts
|
|
3925
4115
|
function createOpenAI(options = {}) {
|