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