@ai-sdk/openai 2.0.29 → 2.0.31
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 +42 -12
- package/dist/index.d.ts +42 -12
- package/dist/index.js +466 -345
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +465 -344
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +13 -12
- package/dist/internal/index.d.ts +13 -12
- package/dist/internal/index.js +393 -289
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +388 -284
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1839,39 +1839,69 @@ var codeInterpreter = (args = {}) => {
|
|
|
1839
1839
|
return codeInterpreterToolFactory(args);
|
|
1840
1840
|
};
|
|
1841
1841
|
|
|
1842
|
+
// src/tool/image-generation.ts
|
|
1843
|
+
import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
|
|
1844
|
+
import { z as z12 } from "zod/v4";
|
|
1845
|
+
var imageGenerationArgsSchema = z12.object({
|
|
1846
|
+
background: z12.enum(["auto", "opaque", "transparent"]).optional(),
|
|
1847
|
+
inputFidelity: z12.enum(["low", "high"]).optional(),
|
|
1848
|
+
inputImageMask: z12.object({
|
|
1849
|
+
fileId: z12.string().optional(),
|
|
1850
|
+
imageUrl: z12.string().optional()
|
|
1851
|
+
}).optional(),
|
|
1852
|
+
model: z12.string().optional(),
|
|
1853
|
+
moderation: z12.enum(["auto"]).optional(),
|
|
1854
|
+
outputCompression: z12.number().int().min(0).max(100).optional(),
|
|
1855
|
+
outputFormat: z12.enum(["png", "jpeg", "webp"]).optional(),
|
|
1856
|
+
quality: z12.enum(["auto", "low", "medium", "high"]).optional(),
|
|
1857
|
+
size: z12.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
1858
|
+
}).strict();
|
|
1859
|
+
var imageGenerationOutputSchema = z12.object({
|
|
1860
|
+
result: z12.string()
|
|
1861
|
+
});
|
|
1862
|
+
var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema2({
|
|
1863
|
+
id: "openai.image_generation",
|
|
1864
|
+
name: "image_generation",
|
|
1865
|
+
inputSchema: z12.object({}),
|
|
1866
|
+
outputSchema: imageGenerationOutputSchema
|
|
1867
|
+
});
|
|
1868
|
+
var imageGeneration = (args = {}) => {
|
|
1869
|
+
return imageGenerationToolFactory(args);
|
|
1870
|
+
};
|
|
1871
|
+
|
|
1842
1872
|
// src/tool/web-search.ts
|
|
1843
1873
|
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory3 } from "@ai-sdk/provider-utils";
|
|
1844
|
-
import { z as
|
|
1845
|
-
var webSearchArgsSchema =
|
|
1846
|
-
filters:
|
|
1847
|
-
allowedDomains:
|
|
1874
|
+
import { z as z13 } from "zod/v4";
|
|
1875
|
+
var webSearchArgsSchema = z13.object({
|
|
1876
|
+
filters: z13.object({
|
|
1877
|
+
allowedDomains: z13.array(z13.string()).optional()
|
|
1848
1878
|
}).optional(),
|
|
1849
|
-
searchContextSize:
|
|
1850
|
-
userLocation:
|
|
1851
|
-
type:
|
|
1852
|
-
country:
|
|
1853
|
-
city:
|
|
1854
|
-
region:
|
|
1855
|
-
timezone:
|
|
1879
|
+
searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
|
|
1880
|
+
userLocation: z13.object({
|
|
1881
|
+
type: z13.literal("approximate"),
|
|
1882
|
+
country: z13.string().optional(),
|
|
1883
|
+
city: z13.string().optional(),
|
|
1884
|
+
region: z13.string().optional(),
|
|
1885
|
+
timezone: z13.string().optional()
|
|
1856
1886
|
}).optional()
|
|
1857
1887
|
});
|
|
1858
1888
|
var webSearchToolFactory = createProviderDefinedToolFactory3({
|
|
1859
1889
|
id: "openai.web_search",
|
|
1860
1890
|
name: "web_search",
|
|
1861
|
-
inputSchema:
|
|
1862
|
-
action:
|
|
1863
|
-
|
|
1864
|
-
type:
|
|
1865
|
-
query:
|
|
1891
|
+
inputSchema: z13.object({
|
|
1892
|
+
action: z13.discriminatedUnion("type", [
|
|
1893
|
+
z13.object({
|
|
1894
|
+
type: z13.literal("search"),
|
|
1895
|
+
query: z13.string().nullish()
|
|
1866
1896
|
}),
|
|
1867
|
-
|
|
1868
|
-
type:
|
|
1869
|
-
url:
|
|
1897
|
+
z13.object({
|
|
1898
|
+
type: z13.literal("open_page"),
|
|
1899
|
+
url: z13.string()
|
|
1870
1900
|
}),
|
|
1871
|
-
|
|
1872
|
-
type:
|
|
1873
|
-
url:
|
|
1874
|
-
pattern:
|
|
1901
|
+
z13.object({
|
|
1902
|
+
type: z13.literal("find"),
|
|
1903
|
+
url: z13.string(),
|
|
1904
|
+
pattern: z13.string()
|
|
1875
1905
|
})
|
|
1876
1906
|
]).nullish()
|
|
1877
1907
|
})
|
|
@@ -1905,6 +1935,20 @@ var openaiTools = {
|
|
|
1905
1935
|
* @param filters - The filters to use for the file search.
|
|
1906
1936
|
*/
|
|
1907
1937
|
fileSearch,
|
|
1938
|
+
/**
|
|
1939
|
+
* The image generation tool allows you to generate images using a text prompt,
|
|
1940
|
+
* and optionally image inputs. It leverages the GPT Image model,
|
|
1941
|
+
* and automatically optimizes text inputs for improved performance.
|
|
1942
|
+
*
|
|
1943
|
+
* Must have name `image_generation`.
|
|
1944
|
+
*
|
|
1945
|
+
* @param size - Image dimensions (e.g., 1024x1024, 1024x1536)
|
|
1946
|
+
* @param quality - Rendering quality (e.g. low, medium, high)
|
|
1947
|
+
* @param format - File output format
|
|
1948
|
+
* @param compression - Compression level (0-100%) for JPEG and WebP formats
|
|
1949
|
+
* @param background - Transparent or opaque
|
|
1950
|
+
*/
|
|
1951
|
+
imageGeneration,
|
|
1908
1952
|
/**
|
|
1909
1953
|
* Web search allows models to access up-to-date information from the internet
|
|
1910
1954
|
* and provide answers with sourced citations.
|
|
@@ -1942,37 +1986,37 @@ import {
|
|
|
1942
1986
|
parseProviderOptions as parseProviderOptions5,
|
|
1943
1987
|
postJsonToApi as postJsonToApi5
|
|
1944
1988
|
} from "@ai-sdk/provider-utils";
|
|
1945
|
-
import { z as
|
|
1989
|
+
import { z as z15 } from "zod/v4";
|
|
1946
1990
|
|
|
1947
|
-
// src/responses/convert-to-openai-responses-
|
|
1991
|
+
// src/responses/convert-to-openai-responses-input.ts
|
|
1948
1992
|
import {
|
|
1949
1993
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError4
|
|
1950
1994
|
} from "@ai-sdk/provider";
|
|
1951
|
-
import { parseProviderOptions as parseProviderOptions4 } from "@ai-sdk/provider-utils";
|
|
1952
|
-
import { z as
|
|
1953
|
-
import { convertToBase64 as convertToBase642 } from "@ai-sdk/provider-utils";
|
|
1995
|
+
import { convertToBase64 as convertToBase642, parseProviderOptions as parseProviderOptions4 } from "@ai-sdk/provider-utils";
|
|
1996
|
+
import { z as z14 } from "zod/v4";
|
|
1954
1997
|
function isFileId(data, prefixes) {
|
|
1955
1998
|
if (!prefixes) return false;
|
|
1956
1999
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
1957
2000
|
}
|
|
1958
|
-
async function
|
|
2001
|
+
async function convertToOpenAIResponsesInput({
|
|
1959
2002
|
prompt,
|
|
1960
2003
|
systemMessageMode,
|
|
1961
|
-
fileIdPrefixes
|
|
2004
|
+
fileIdPrefixes,
|
|
2005
|
+
store
|
|
1962
2006
|
}) {
|
|
1963
2007
|
var _a, _b, _c, _d, _e, _f;
|
|
1964
|
-
const
|
|
2008
|
+
const input = [];
|
|
1965
2009
|
const warnings = [];
|
|
1966
2010
|
for (const { role, content } of prompt) {
|
|
1967
2011
|
switch (role) {
|
|
1968
2012
|
case "system": {
|
|
1969
2013
|
switch (systemMessageMode) {
|
|
1970
2014
|
case "system": {
|
|
1971
|
-
|
|
2015
|
+
input.push({ role: "system", content });
|
|
1972
2016
|
break;
|
|
1973
2017
|
}
|
|
1974
2018
|
case "developer": {
|
|
1975
|
-
|
|
2019
|
+
input.push({ role: "developer", content });
|
|
1976
2020
|
break;
|
|
1977
2021
|
}
|
|
1978
2022
|
case "remove": {
|
|
@@ -1992,7 +2036,7 @@ async function convertToOpenAIResponsesMessages({
|
|
|
1992
2036
|
break;
|
|
1993
2037
|
}
|
|
1994
2038
|
case "user": {
|
|
1995
|
-
|
|
2039
|
+
input.push({
|
|
1996
2040
|
role: "user",
|
|
1997
2041
|
content: content.map((part, index) => {
|
|
1998
2042
|
var _a2, _b2, _c2;
|
|
@@ -2037,10 +2081,11 @@ async function convertToOpenAIResponsesMessages({
|
|
|
2037
2081
|
}
|
|
2038
2082
|
case "assistant": {
|
|
2039
2083
|
const reasoningMessages = {};
|
|
2084
|
+
const toolCallParts = {};
|
|
2040
2085
|
for (const part of content) {
|
|
2041
2086
|
switch (part.type) {
|
|
2042
2087
|
case "text": {
|
|
2043
|
-
|
|
2088
|
+
input.push({
|
|
2044
2089
|
role: "assistant",
|
|
2045
2090
|
content: [{ type: "output_text", text: part.text }],
|
|
2046
2091
|
id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
|
|
@@ -2048,10 +2093,11 @@ async function convertToOpenAIResponsesMessages({
|
|
|
2048
2093
|
break;
|
|
2049
2094
|
}
|
|
2050
2095
|
case "tool-call": {
|
|
2096
|
+
toolCallParts[part.toolCallId] = part;
|
|
2051
2097
|
if (part.providerExecuted) {
|
|
2052
2098
|
break;
|
|
2053
2099
|
}
|
|
2054
|
-
|
|
2100
|
+
input.push({
|
|
2055
2101
|
type: "function_call",
|
|
2056
2102
|
call_id: part.toolCallId,
|
|
2057
2103
|
name: part.toolName,
|
|
@@ -2061,10 +2107,14 @@ async function convertToOpenAIResponsesMessages({
|
|
|
2061
2107
|
break;
|
|
2062
2108
|
}
|
|
2063
2109
|
case "tool-result": {
|
|
2064
|
-
|
|
2065
|
-
type: "
|
|
2066
|
-
|
|
2067
|
-
|
|
2110
|
+
if (store) {
|
|
2111
|
+
input.push({ type: "item_reference", id: part.toolCallId });
|
|
2112
|
+
} else {
|
|
2113
|
+
warnings.push({
|
|
2114
|
+
type: "other",
|
|
2115
|
+
message: `Results for OpenAI tool ${part.toolName} are not sent to the API when store is false`
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2068
2118
|
break;
|
|
2069
2119
|
}
|
|
2070
2120
|
case "reasoning": {
|
|
@@ -2092,7 +2142,7 @@ async function convertToOpenAIResponsesMessages({
|
|
|
2092
2142
|
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2093
2143
|
summary: summaryParts
|
|
2094
2144
|
};
|
|
2095
|
-
|
|
2145
|
+
input.push(reasoningMessages[reasoningId]);
|
|
2096
2146
|
} else {
|
|
2097
2147
|
existingReasoningMessage.summary.push(...summaryParts);
|
|
2098
2148
|
}
|
|
@@ -2123,7 +2173,7 @@ async function convertToOpenAIResponsesMessages({
|
|
|
2123
2173
|
contentValue = JSON.stringify(output.value);
|
|
2124
2174
|
break;
|
|
2125
2175
|
}
|
|
2126
|
-
|
|
2176
|
+
input.push({
|
|
2127
2177
|
type: "function_call_output",
|
|
2128
2178
|
call_id: part.toolCallId,
|
|
2129
2179
|
output: contentValue
|
|
@@ -2137,11 +2187,11 @@ async function convertToOpenAIResponsesMessages({
|
|
|
2137
2187
|
}
|
|
2138
2188
|
}
|
|
2139
2189
|
}
|
|
2140
|
-
return {
|
|
2190
|
+
return { input, warnings };
|
|
2141
2191
|
}
|
|
2142
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2143
|
-
itemId:
|
|
2144
|
-
reasoningEncryptedContent:
|
|
2192
|
+
var openaiResponsesReasoningProviderOptionsSchema = z14.object({
|
|
2193
|
+
itemId: z14.string().nullish(),
|
|
2194
|
+
reasoningEncryptedContent: z14.string().nullish()
|
|
2145
2195
|
});
|
|
2146
2196
|
|
|
2147
2197
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2228,8 +2278,23 @@ function prepareResponsesTools({
|
|
|
2228
2278
|
});
|
|
2229
2279
|
break;
|
|
2230
2280
|
}
|
|
2231
|
-
|
|
2232
|
-
|
|
2281
|
+
case "openai.image_generation": {
|
|
2282
|
+
const args = imageGenerationArgsSchema.parse(tool.args);
|
|
2283
|
+
openaiTools2.push({
|
|
2284
|
+
type: "image_generation",
|
|
2285
|
+
background: args.background,
|
|
2286
|
+
input_fidelity: args.inputFidelity,
|
|
2287
|
+
input_image_mask: args.inputImageMask ? {
|
|
2288
|
+
file_id: args.inputImageMask.fileId,
|
|
2289
|
+
image_url: args.inputImageMask.imageUrl
|
|
2290
|
+
} : void 0,
|
|
2291
|
+
model: args.model,
|
|
2292
|
+
size: args.size,
|
|
2293
|
+
quality: args.quality,
|
|
2294
|
+
moderation: args.moderation,
|
|
2295
|
+
output_format: args.outputFormat,
|
|
2296
|
+
output_compression: args.outputCompression
|
|
2297
|
+
});
|
|
2233
2298
|
break;
|
|
2234
2299
|
}
|
|
2235
2300
|
}
|
|
@@ -2252,7 +2317,7 @@ function prepareResponsesTools({
|
|
|
2252
2317
|
case "tool":
|
|
2253
2318
|
return {
|
|
2254
2319
|
tools: openaiTools2,
|
|
2255
|
-
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
2320
|
+
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
2256
2321
|
toolWarnings
|
|
2257
2322
|
};
|
|
2258
2323
|
default: {
|
|
@@ -2265,47 +2330,52 @@ function prepareResponsesTools({
|
|
|
2265
2330
|
}
|
|
2266
2331
|
|
|
2267
2332
|
// src/responses/openai-responses-language-model.ts
|
|
2268
|
-
var webSearchCallItem =
|
|
2269
|
-
type:
|
|
2270
|
-
id:
|
|
2271
|
-
status:
|
|
2272
|
-
action:
|
|
2273
|
-
|
|
2274
|
-
type:
|
|
2275
|
-
query:
|
|
2333
|
+
var webSearchCallItem = z15.object({
|
|
2334
|
+
type: z15.literal("web_search_call"),
|
|
2335
|
+
id: z15.string(),
|
|
2336
|
+
status: z15.string(),
|
|
2337
|
+
action: z15.discriminatedUnion("type", [
|
|
2338
|
+
z15.object({
|
|
2339
|
+
type: z15.literal("search"),
|
|
2340
|
+
query: z15.string().nullish()
|
|
2276
2341
|
}),
|
|
2277
|
-
|
|
2278
|
-
type:
|
|
2279
|
-
url:
|
|
2342
|
+
z15.object({
|
|
2343
|
+
type: z15.literal("open_page"),
|
|
2344
|
+
url: z15.string()
|
|
2280
2345
|
}),
|
|
2281
|
-
|
|
2282
|
-
type:
|
|
2283
|
-
url:
|
|
2284
|
-
pattern:
|
|
2346
|
+
z15.object({
|
|
2347
|
+
type: z15.literal("find"),
|
|
2348
|
+
url: z15.string(),
|
|
2349
|
+
pattern: z15.string()
|
|
2285
2350
|
})
|
|
2286
2351
|
]).nullish()
|
|
2287
2352
|
});
|
|
2288
|
-
var codeInterpreterCallItem =
|
|
2289
|
-
type:
|
|
2290
|
-
id:
|
|
2291
|
-
code:
|
|
2292
|
-
container_id:
|
|
2293
|
-
outputs:
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2353
|
+
var codeInterpreterCallItem = z15.object({
|
|
2354
|
+
type: z15.literal("code_interpreter_call"),
|
|
2355
|
+
id: z15.string(),
|
|
2356
|
+
code: z15.string().nullable(),
|
|
2357
|
+
container_id: z15.string(),
|
|
2358
|
+
outputs: z15.array(
|
|
2359
|
+
z15.discriminatedUnion("type", [
|
|
2360
|
+
z15.object({ type: z15.literal("logs"), logs: z15.string() }),
|
|
2361
|
+
z15.object({ type: z15.literal("image"), url: z15.string() })
|
|
2297
2362
|
])
|
|
2298
2363
|
).nullable()
|
|
2299
2364
|
});
|
|
2365
|
+
var imageGenerationCallItem = z15.object({
|
|
2366
|
+
type: z15.literal("image_generation_call"),
|
|
2367
|
+
id: z15.string(),
|
|
2368
|
+
result: z15.string()
|
|
2369
|
+
});
|
|
2300
2370
|
var TOP_LOGPROBS_MAX = 20;
|
|
2301
|
-
var LOGPROBS_SCHEMA =
|
|
2302
|
-
|
|
2303
|
-
token:
|
|
2304
|
-
logprob:
|
|
2305
|
-
top_logprobs:
|
|
2306
|
-
|
|
2307
|
-
token:
|
|
2308
|
-
logprob:
|
|
2371
|
+
var LOGPROBS_SCHEMA = z15.array(
|
|
2372
|
+
z15.object({
|
|
2373
|
+
token: z15.string(),
|
|
2374
|
+
logprob: z15.number(),
|
|
2375
|
+
top_logprobs: z15.array(
|
|
2376
|
+
z15.object({
|
|
2377
|
+
token: z15.string(),
|
|
2378
|
+
logprob: z15.number()
|
|
2309
2379
|
})
|
|
2310
2380
|
)
|
|
2311
2381
|
})
|
|
@@ -2338,7 +2408,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2338
2408
|
toolChoice,
|
|
2339
2409
|
responseFormat
|
|
2340
2410
|
}) {
|
|
2341
|
-
var _a, _b, _c, _d;
|
|
2411
|
+
var _a, _b, _c, _d, _e;
|
|
2342
2412
|
const warnings = [];
|
|
2343
2413
|
const modelConfig = getResponsesModelConfig(this.modelId);
|
|
2344
2414
|
if (topK != null) {
|
|
@@ -2362,32 +2432,33 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2362
2432
|
if (stopSequences != null) {
|
|
2363
2433
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
2364
2434
|
}
|
|
2365
|
-
const { messages, warnings: messageWarnings } = await convertToOpenAIResponsesMessages({
|
|
2366
|
-
prompt,
|
|
2367
|
-
systemMessageMode: modelConfig.systemMessageMode,
|
|
2368
|
-
fileIdPrefixes: this.config.fileIdPrefixes
|
|
2369
|
-
});
|
|
2370
|
-
warnings.push(...messageWarnings);
|
|
2371
2435
|
const openaiOptions = await parseProviderOptions5({
|
|
2372
2436
|
provider: "openai",
|
|
2373
2437
|
providerOptions,
|
|
2374
2438
|
schema: openaiResponsesProviderOptionsSchema
|
|
2375
2439
|
});
|
|
2376
|
-
const
|
|
2440
|
+
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
2441
|
+
prompt,
|
|
2442
|
+
systemMessageMode: modelConfig.systemMessageMode,
|
|
2443
|
+
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
2444
|
+
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
|
|
2445
|
+
});
|
|
2446
|
+
warnings.push(...inputWarnings);
|
|
2447
|
+
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
2377
2448
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
2378
2449
|
const topLogprobs = typeof (openaiOptions == null ? void 0 : openaiOptions.logprobs) === "number" ? openaiOptions == null ? void 0 : openaiOptions.logprobs : (openaiOptions == null ? void 0 : openaiOptions.logprobs) === true ? TOP_LOGPROBS_MAX : void 0;
|
|
2379
2450
|
include = topLogprobs ? Array.isArray(include) ? [...include, "message.output_text.logprobs"] : ["message.output_text.logprobs"] : include;
|
|
2380
|
-
const webSearchToolName = (
|
|
2451
|
+
const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
|
|
2381
2452
|
(tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
2382
|
-
)) == null ? void 0 :
|
|
2453
|
+
)) == null ? void 0 : _c.name;
|
|
2383
2454
|
include = webSearchToolName ? Array.isArray(include) ? [...include, "web_search_call.action.sources"] : ["web_search_call.action.sources"] : include;
|
|
2384
|
-
const codeInterpreterToolName = (
|
|
2455
|
+
const codeInterpreterToolName = (_d = tools == null ? void 0 : tools.find(
|
|
2385
2456
|
(tool) => tool.type === "provider-defined" && tool.id === "openai.code_interpreter"
|
|
2386
|
-
)) == null ? void 0 :
|
|
2457
|
+
)) == null ? void 0 : _d.name;
|
|
2387
2458
|
include = codeInterpreterToolName ? Array.isArray(include) ? [...include, "code_interpreter_call.outputs"] : ["code_interpreter_call.outputs"] : include;
|
|
2388
2459
|
const baseArgs = {
|
|
2389
2460
|
model: this.modelId,
|
|
2390
|
-
input
|
|
2461
|
+
input,
|
|
2391
2462
|
temperature,
|
|
2392
2463
|
top_p: topP,
|
|
2393
2464
|
max_output_tokens: maxOutputTokens,
|
|
@@ -2397,7 +2468,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2397
2468
|
format: responseFormat.schema != null ? {
|
|
2398
2469
|
type: "json_schema",
|
|
2399
2470
|
strict: strictJsonSchema,
|
|
2400
|
-
name: (
|
|
2471
|
+
name: (_e = responseFormat.name) != null ? _e : "response",
|
|
2401
2472
|
description: responseFormat.description,
|
|
2402
2473
|
schema: responseFormat.schema
|
|
2403
2474
|
} : { type: "json_object" }
|
|
@@ -2408,6 +2479,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2408
2479
|
}
|
|
2409
2480
|
},
|
|
2410
2481
|
// provider options:
|
|
2482
|
+
max_tool_calls: openaiOptions == null ? void 0 : openaiOptions.maxToolCalls,
|
|
2411
2483
|
metadata: openaiOptions == null ? void 0 : openaiOptions.metadata,
|
|
2412
2484
|
parallel_tool_calls: openaiOptions == null ? void 0 : openaiOptions.parallelToolCalls,
|
|
2413
2485
|
previous_response_id: openaiOptions == null ? void 0 : openaiOptions.previousResponseId,
|
|
@@ -2523,45 +2595,45 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2523
2595
|
body,
|
|
2524
2596
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2525
2597
|
successfulResponseHandler: createJsonResponseHandler5(
|
|
2526
|
-
|
|
2527
|
-
id:
|
|
2528
|
-
created_at:
|
|
2529
|
-
error:
|
|
2530
|
-
code:
|
|
2531
|
-
message:
|
|
2598
|
+
z15.object({
|
|
2599
|
+
id: z15.string(),
|
|
2600
|
+
created_at: z15.number(),
|
|
2601
|
+
error: z15.object({
|
|
2602
|
+
code: z15.string(),
|
|
2603
|
+
message: z15.string()
|
|
2532
2604
|
}).nullish(),
|
|
2533
|
-
model:
|
|
2534
|
-
output:
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
type:
|
|
2538
|
-
role:
|
|
2539
|
-
id:
|
|
2540
|
-
content:
|
|
2541
|
-
|
|
2542
|
-
type:
|
|
2543
|
-
text:
|
|
2605
|
+
model: z15.string(),
|
|
2606
|
+
output: z15.array(
|
|
2607
|
+
z15.discriminatedUnion("type", [
|
|
2608
|
+
z15.object({
|
|
2609
|
+
type: z15.literal("message"),
|
|
2610
|
+
role: z15.literal("assistant"),
|
|
2611
|
+
id: z15.string(),
|
|
2612
|
+
content: z15.array(
|
|
2613
|
+
z15.object({
|
|
2614
|
+
type: z15.literal("output_text"),
|
|
2615
|
+
text: z15.string(),
|
|
2544
2616
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2545
|
-
annotations:
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
type:
|
|
2549
|
-
start_index:
|
|
2550
|
-
end_index:
|
|
2551
|
-
url:
|
|
2552
|
-
title:
|
|
2617
|
+
annotations: z15.array(
|
|
2618
|
+
z15.discriminatedUnion("type", [
|
|
2619
|
+
z15.object({
|
|
2620
|
+
type: z15.literal("url_citation"),
|
|
2621
|
+
start_index: z15.number(),
|
|
2622
|
+
end_index: z15.number(),
|
|
2623
|
+
url: z15.string(),
|
|
2624
|
+
title: z15.string()
|
|
2553
2625
|
}),
|
|
2554
|
-
|
|
2555
|
-
type:
|
|
2556
|
-
file_id:
|
|
2557
|
-
filename:
|
|
2558
|
-
index:
|
|
2559
|
-
start_index:
|
|
2560
|
-
end_index:
|
|
2561
|
-
quote:
|
|
2626
|
+
z15.object({
|
|
2627
|
+
type: z15.literal("file_citation"),
|
|
2628
|
+
file_id: z15.string(),
|
|
2629
|
+
filename: z15.string().nullish(),
|
|
2630
|
+
index: z15.number().nullish(),
|
|
2631
|
+
start_index: z15.number().nullish(),
|
|
2632
|
+
end_index: z15.number().nullish(),
|
|
2633
|
+
quote: z15.string().nullish()
|
|
2562
2634
|
}),
|
|
2563
|
-
|
|
2564
|
-
type:
|
|
2635
|
+
z15.object({
|
|
2636
|
+
type: z15.literal("container_file_citation")
|
|
2565
2637
|
})
|
|
2566
2638
|
])
|
|
2567
2639
|
)
|
|
@@ -2569,50 +2641,51 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2569
2641
|
)
|
|
2570
2642
|
}),
|
|
2571
2643
|
codeInterpreterCallItem,
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2644
|
+
imageGenerationCallItem,
|
|
2645
|
+
z15.object({
|
|
2646
|
+
type: z15.literal("function_call"),
|
|
2647
|
+
call_id: z15.string(),
|
|
2648
|
+
name: z15.string(),
|
|
2649
|
+
arguments: z15.string(),
|
|
2650
|
+
id: z15.string()
|
|
2578
2651
|
}),
|
|
2579
2652
|
webSearchCallItem,
|
|
2580
|
-
|
|
2581
|
-
type:
|
|
2582
|
-
id:
|
|
2583
|
-
status:
|
|
2653
|
+
z15.object({
|
|
2654
|
+
type: z15.literal("computer_call"),
|
|
2655
|
+
id: z15.string(),
|
|
2656
|
+
status: z15.string().optional()
|
|
2584
2657
|
}),
|
|
2585
|
-
|
|
2586
|
-
type:
|
|
2587
|
-
id:
|
|
2588
|
-
status:
|
|
2589
|
-
queries:
|
|
2590
|
-
results:
|
|
2591
|
-
|
|
2592
|
-
attributes:
|
|
2593
|
-
file_id:
|
|
2594
|
-
filename:
|
|
2595
|
-
score:
|
|
2596
|
-
text:
|
|
2658
|
+
z15.object({
|
|
2659
|
+
type: z15.literal("file_search_call"),
|
|
2660
|
+
id: z15.string(),
|
|
2661
|
+
status: z15.string().optional(),
|
|
2662
|
+
queries: z15.array(z15.string()).nullish(),
|
|
2663
|
+
results: z15.array(
|
|
2664
|
+
z15.object({
|
|
2665
|
+
attributes: z15.object({
|
|
2666
|
+
file_id: z15.string(),
|
|
2667
|
+
filename: z15.string(),
|
|
2668
|
+
score: z15.number(),
|
|
2669
|
+
text: z15.string()
|
|
2597
2670
|
})
|
|
2598
2671
|
})
|
|
2599
2672
|
).nullish()
|
|
2600
2673
|
}),
|
|
2601
|
-
|
|
2602
|
-
type:
|
|
2603
|
-
id:
|
|
2604
|
-
encrypted_content:
|
|
2605
|
-
summary:
|
|
2606
|
-
|
|
2607
|
-
type:
|
|
2608
|
-
text:
|
|
2674
|
+
z15.object({
|
|
2675
|
+
type: z15.literal("reasoning"),
|
|
2676
|
+
id: z15.string(),
|
|
2677
|
+
encrypted_content: z15.string().nullish(),
|
|
2678
|
+
summary: z15.array(
|
|
2679
|
+
z15.object({
|
|
2680
|
+
type: z15.literal("summary_text"),
|
|
2681
|
+
text: z15.string()
|
|
2609
2682
|
})
|
|
2610
2683
|
)
|
|
2611
2684
|
})
|
|
2612
2685
|
])
|
|
2613
2686
|
),
|
|
2614
|
-
service_tier:
|
|
2615
|
-
incomplete_details:
|
|
2687
|
+
service_tier: z15.string().nullish(),
|
|
2688
|
+
incomplete_details: z15.object({ reason: z15.string() }).nullable(),
|
|
2616
2689
|
usage: usageSchema2
|
|
2617
2690
|
})
|
|
2618
2691
|
),
|
|
@@ -2653,6 +2726,25 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2653
2726
|
}
|
|
2654
2727
|
break;
|
|
2655
2728
|
}
|
|
2729
|
+
case "image_generation_call": {
|
|
2730
|
+
content.push({
|
|
2731
|
+
type: "tool-call",
|
|
2732
|
+
toolCallId: part.id,
|
|
2733
|
+
toolName: "image_generation",
|
|
2734
|
+
input: "{}",
|
|
2735
|
+
providerExecuted: true
|
|
2736
|
+
});
|
|
2737
|
+
content.push({
|
|
2738
|
+
type: "tool-result",
|
|
2739
|
+
toolCallId: part.id,
|
|
2740
|
+
toolName: "image_generation",
|
|
2741
|
+
result: {
|
|
2742
|
+
result: part.result
|
|
2743
|
+
},
|
|
2744
|
+
providerExecuted: true
|
|
2745
|
+
});
|
|
2746
|
+
break;
|
|
2747
|
+
}
|
|
2656
2748
|
case "message": {
|
|
2657
2749
|
for (const contentPart of part.content) {
|
|
2658
2750
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -2916,6 +3008,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2916
3008
|
id: value.item.id,
|
|
2917
3009
|
toolName: "file_search"
|
|
2918
3010
|
});
|
|
3011
|
+
} else if (value.item.type === "image_generation_call") {
|
|
3012
|
+
controller.enqueue({
|
|
3013
|
+
type: "tool-call",
|
|
3014
|
+
toolCallId: value.item.id,
|
|
3015
|
+
toolName: "image_generation",
|
|
3016
|
+
input: "{}",
|
|
3017
|
+
providerExecuted: true
|
|
3018
|
+
});
|
|
2919
3019
|
} else if (value.item.type === "message") {
|
|
2920
3020
|
controller.enqueue({
|
|
2921
3021
|
type: "text-start",
|
|
@@ -3049,6 +3149,16 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3049
3149
|
},
|
|
3050
3150
|
providerExecuted: true
|
|
3051
3151
|
});
|
|
3152
|
+
} else if (value.item.type === "image_generation_call") {
|
|
3153
|
+
controller.enqueue({
|
|
3154
|
+
type: "tool-result",
|
|
3155
|
+
toolCallId: value.item.id,
|
|
3156
|
+
toolName: "image_generation",
|
|
3157
|
+
result: {
|
|
3158
|
+
result: value.item.result
|
|
3159
|
+
},
|
|
3160
|
+
providerExecuted: true
|
|
3161
|
+
});
|
|
3052
3162
|
} else if (value.item.type === "message") {
|
|
3053
3163
|
controller.enqueue({
|
|
3054
3164
|
type: "text-end",
|
|
@@ -3185,177 +3295,182 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3185
3295
|
};
|
|
3186
3296
|
}
|
|
3187
3297
|
};
|
|
3188
|
-
var usageSchema2 =
|
|
3189
|
-
input_tokens:
|
|
3190
|
-
input_tokens_details:
|
|
3191
|
-
output_tokens:
|
|
3192
|
-
output_tokens_details:
|
|
3298
|
+
var usageSchema2 = z15.object({
|
|
3299
|
+
input_tokens: z15.number(),
|
|
3300
|
+
input_tokens_details: z15.object({ cached_tokens: z15.number().nullish() }).nullish(),
|
|
3301
|
+
output_tokens: z15.number(),
|
|
3302
|
+
output_tokens_details: z15.object({ reasoning_tokens: z15.number().nullish() }).nullish()
|
|
3193
3303
|
});
|
|
3194
|
-
var textDeltaChunkSchema =
|
|
3195
|
-
type:
|
|
3196
|
-
item_id:
|
|
3197
|
-
delta:
|
|
3304
|
+
var textDeltaChunkSchema = z15.object({
|
|
3305
|
+
type: z15.literal("response.output_text.delta"),
|
|
3306
|
+
item_id: z15.string(),
|
|
3307
|
+
delta: z15.string(),
|
|
3198
3308
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3199
3309
|
});
|
|
3200
|
-
var errorChunkSchema =
|
|
3201
|
-
type:
|
|
3202
|
-
code:
|
|
3203
|
-
message:
|
|
3204
|
-
param:
|
|
3205
|
-
sequence_number:
|
|
3310
|
+
var errorChunkSchema = z15.object({
|
|
3311
|
+
type: z15.literal("error"),
|
|
3312
|
+
code: z15.string(),
|
|
3313
|
+
message: z15.string(),
|
|
3314
|
+
param: z15.string().nullish(),
|
|
3315
|
+
sequence_number: z15.number()
|
|
3206
3316
|
});
|
|
3207
|
-
var responseFinishedChunkSchema =
|
|
3208
|
-
type:
|
|
3209
|
-
response:
|
|
3210
|
-
incomplete_details:
|
|
3317
|
+
var responseFinishedChunkSchema = z15.object({
|
|
3318
|
+
type: z15.enum(["response.completed", "response.incomplete"]),
|
|
3319
|
+
response: z15.object({
|
|
3320
|
+
incomplete_details: z15.object({ reason: z15.string() }).nullish(),
|
|
3211
3321
|
usage: usageSchema2,
|
|
3212
|
-
service_tier:
|
|
3322
|
+
service_tier: z15.string().nullish()
|
|
3213
3323
|
})
|
|
3214
3324
|
});
|
|
3215
|
-
var responseCreatedChunkSchema =
|
|
3216
|
-
type:
|
|
3217
|
-
response:
|
|
3218
|
-
id:
|
|
3219
|
-
created_at:
|
|
3220
|
-
model:
|
|
3221
|
-
service_tier:
|
|
3325
|
+
var responseCreatedChunkSchema = z15.object({
|
|
3326
|
+
type: z15.literal("response.created"),
|
|
3327
|
+
response: z15.object({
|
|
3328
|
+
id: z15.string(),
|
|
3329
|
+
created_at: z15.number(),
|
|
3330
|
+
model: z15.string(),
|
|
3331
|
+
service_tier: z15.string().nullish()
|
|
3222
3332
|
})
|
|
3223
3333
|
});
|
|
3224
|
-
var responseOutputItemAddedSchema =
|
|
3225
|
-
type:
|
|
3226
|
-
output_index:
|
|
3227
|
-
item:
|
|
3228
|
-
|
|
3229
|
-
type:
|
|
3230
|
-
id:
|
|
3334
|
+
var responseOutputItemAddedSchema = z15.object({
|
|
3335
|
+
type: z15.literal("response.output_item.added"),
|
|
3336
|
+
output_index: z15.number(),
|
|
3337
|
+
item: z15.discriminatedUnion("type", [
|
|
3338
|
+
z15.object({
|
|
3339
|
+
type: z15.literal("message"),
|
|
3340
|
+
id: z15.string()
|
|
3231
3341
|
}),
|
|
3232
|
-
|
|
3233
|
-
type:
|
|
3234
|
-
id:
|
|
3235
|
-
encrypted_content:
|
|
3342
|
+
z15.object({
|
|
3343
|
+
type: z15.literal("reasoning"),
|
|
3344
|
+
id: z15.string(),
|
|
3345
|
+
encrypted_content: z15.string().nullish()
|
|
3236
3346
|
}),
|
|
3237
|
-
|
|
3238
|
-
type:
|
|
3239
|
-
id:
|
|
3240
|
-
call_id:
|
|
3241
|
-
name:
|
|
3242
|
-
arguments:
|
|
3347
|
+
z15.object({
|
|
3348
|
+
type: z15.literal("function_call"),
|
|
3349
|
+
id: z15.string(),
|
|
3350
|
+
call_id: z15.string(),
|
|
3351
|
+
name: z15.string(),
|
|
3352
|
+
arguments: z15.string()
|
|
3243
3353
|
}),
|
|
3244
|
-
|
|
3245
|
-
type:
|
|
3246
|
-
id:
|
|
3247
|
-
status:
|
|
3248
|
-
action:
|
|
3249
|
-
type:
|
|
3250
|
-
query:
|
|
3354
|
+
z15.object({
|
|
3355
|
+
type: z15.literal("web_search_call"),
|
|
3356
|
+
id: z15.string(),
|
|
3357
|
+
status: z15.string(),
|
|
3358
|
+
action: z15.object({
|
|
3359
|
+
type: z15.literal("search"),
|
|
3360
|
+
query: z15.string().optional()
|
|
3251
3361
|
}).nullish()
|
|
3252
3362
|
}),
|
|
3253
|
-
|
|
3254
|
-
type:
|
|
3255
|
-
id:
|
|
3256
|
-
status:
|
|
3363
|
+
z15.object({
|
|
3364
|
+
type: z15.literal("computer_call"),
|
|
3365
|
+
id: z15.string(),
|
|
3366
|
+
status: z15.string()
|
|
3257
3367
|
}),
|
|
3258
|
-
|
|
3259
|
-
type:
|
|
3260
|
-
id:
|
|
3261
|
-
status:
|
|
3262
|
-
queries:
|
|
3263
|
-
results:
|
|
3264
|
-
|
|
3265
|
-
attributes:
|
|
3266
|
-
file_id:
|
|
3267
|
-
filename:
|
|
3268
|
-
score:
|
|
3269
|
-
text:
|
|
3368
|
+
z15.object({
|
|
3369
|
+
type: z15.literal("file_search_call"),
|
|
3370
|
+
id: z15.string(),
|
|
3371
|
+
status: z15.string(),
|
|
3372
|
+
queries: z15.array(z15.string()).nullish(),
|
|
3373
|
+
results: z15.array(
|
|
3374
|
+
z15.object({
|
|
3375
|
+
attributes: z15.object({
|
|
3376
|
+
file_id: z15.string(),
|
|
3377
|
+
filename: z15.string(),
|
|
3378
|
+
score: z15.number(),
|
|
3379
|
+
text: z15.string()
|
|
3270
3380
|
})
|
|
3271
3381
|
})
|
|
3272
3382
|
).optional()
|
|
3383
|
+
}),
|
|
3384
|
+
z15.object({
|
|
3385
|
+
type: z15.literal("image_generation_call"),
|
|
3386
|
+
id: z15.string()
|
|
3273
3387
|
})
|
|
3274
3388
|
])
|
|
3275
3389
|
});
|
|
3276
|
-
var responseOutputItemDoneSchema =
|
|
3277
|
-
type:
|
|
3278
|
-
output_index:
|
|
3279
|
-
item:
|
|
3280
|
-
|
|
3281
|
-
type:
|
|
3282
|
-
id:
|
|
3390
|
+
var responseOutputItemDoneSchema = z15.object({
|
|
3391
|
+
type: z15.literal("response.output_item.done"),
|
|
3392
|
+
output_index: z15.number(),
|
|
3393
|
+
item: z15.discriminatedUnion("type", [
|
|
3394
|
+
z15.object({
|
|
3395
|
+
type: z15.literal("message"),
|
|
3396
|
+
id: z15.string()
|
|
3283
3397
|
}),
|
|
3284
|
-
|
|
3285
|
-
type:
|
|
3286
|
-
id:
|
|
3287
|
-
encrypted_content:
|
|
3398
|
+
z15.object({
|
|
3399
|
+
type: z15.literal("reasoning"),
|
|
3400
|
+
id: z15.string(),
|
|
3401
|
+
encrypted_content: z15.string().nullish()
|
|
3288
3402
|
}),
|
|
3289
|
-
|
|
3290
|
-
type:
|
|
3291
|
-
id:
|
|
3292
|
-
call_id:
|
|
3293
|
-
name:
|
|
3294
|
-
arguments:
|
|
3295
|
-
status:
|
|
3403
|
+
z15.object({
|
|
3404
|
+
type: z15.literal("function_call"),
|
|
3405
|
+
id: z15.string(),
|
|
3406
|
+
call_id: z15.string(),
|
|
3407
|
+
name: z15.string(),
|
|
3408
|
+
arguments: z15.string(),
|
|
3409
|
+
status: z15.literal("completed")
|
|
3296
3410
|
}),
|
|
3297
3411
|
codeInterpreterCallItem,
|
|
3412
|
+
imageGenerationCallItem,
|
|
3298
3413
|
webSearchCallItem,
|
|
3299
|
-
|
|
3300
|
-
type:
|
|
3301
|
-
id:
|
|
3302
|
-
status:
|
|
3414
|
+
z15.object({
|
|
3415
|
+
type: z15.literal("computer_call"),
|
|
3416
|
+
id: z15.string(),
|
|
3417
|
+
status: z15.literal("completed")
|
|
3303
3418
|
}),
|
|
3304
|
-
|
|
3305
|
-
type:
|
|
3306
|
-
id:
|
|
3307
|
-
status:
|
|
3308
|
-
queries:
|
|
3309
|
-
results:
|
|
3310
|
-
|
|
3311
|
-
attributes:
|
|
3312
|
-
file_id:
|
|
3313
|
-
filename:
|
|
3314
|
-
score:
|
|
3315
|
-
text:
|
|
3419
|
+
z15.object({
|
|
3420
|
+
type: z15.literal("file_search_call"),
|
|
3421
|
+
id: z15.string(),
|
|
3422
|
+
status: z15.literal("completed"),
|
|
3423
|
+
queries: z15.array(z15.string()).nullish(),
|
|
3424
|
+
results: z15.array(
|
|
3425
|
+
z15.object({
|
|
3426
|
+
attributes: z15.object({
|
|
3427
|
+
file_id: z15.string(),
|
|
3428
|
+
filename: z15.string(),
|
|
3429
|
+
score: z15.number(),
|
|
3430
|
+
text: z15.string()
|
|
3316
3431
|
})
|
|
3317
3432
|
})
|
|
3318
3433
|
).nullish()
|
|
3319
3434
|
})
|
|
3320
3435
|
])
|
|
3321
3436
|
});
|
|
3322
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3323
|
-
type:
|
|
3324
|
-
item_id:
|
|
3325
|
-
output_index:
|
|
3326
|
-
delta:
|
|
3437
|
+
var responseFunctionCallArgumentsDeltaSchema = z15.object({
|
|
3438
|
+
type: z15.literal("response.function_call_arguments.delta"),
|
|
3439
|
+
item_id: z15.string(),
|
|
3440
|
+
output_index: z15.number(),
|
|
3441
|
+
delta: z15.string()
|
|
3327
3442
|
});
|
|
3328
|
-
var responseAnnotationAddedSchema =
|
|
3329
|
-
type:
|
|
3330
|
-
annotation:
|
|
3331
|
-
|
|
3332
|
-
type:
|
|
3333
|
-
url:
|
|
3334
|
-
title:
|
|
3443
|
+
var responseAnnotationAddedSchema = z15.object({
|
|
3444
|
+
type: z15.literal("response.output_text.annotation.added"),
|
|
3445
|
+
annotation: z15.discriminatedUnion("type", [
|
|
3446
|
+
z15.object({
|
|
3447
|
+
type: z15.literal("url_citation"),
|
|
3448
|
+
url: z15.string(),
|
|
3449
|
+
title: z15.string()
|
|
3335
3450
|
}),
|
|
3336
|
-
|
|
3337
|
-
type:
|
|
3338
|
-
file_id:
|
|
3339
|
-
filename:
|
|
3340
|
-
index:
|
|
3341
|
-
start_index:
|
|
3342
|
-
end_index:
|
|
3343
|
-
quote:
|
|
3451
|
+
z15.object({
|
|
3452
|
+
type: z15.literal("file_citation"),
|
|
3453
|
+
file_id: z15.string(),
|
|
3454
|
+
filename: z15.string().nullish(),
|
|
3455
|
+
index: z15.number().nullish(),
|
|
3456
|
+
start_index: z15.number().nullish(),
|
|
3457
|
+
end_index: z15.number().nullish(),
|
|
3458
|
+
quote: z15.string().nullish()
|
|
3344
3459
|
})
|
|
3345
3460
|
])
|
|
3346
3461
|
});
|
|
3347
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3348
|
-
type:
|
|
3349
|
-
item_id:
|
|
3350
|
-
summary_index:
|
|
3462
|
+
var responseReasoningSummaryPartAddedSchema = z15.object({
|
|
3463
|
+
type: z15.literal("response.reasoning_summary_part.added"),
|
|
3464
|
+
item_id: z15.string(),
|
|
3465
|
+
summary_index: z15.number()
|
|
3351
3466
|
});
|
|
3352
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3353
|
-
type:
|
|
3354
|
-
item_id:
|
|
3355
|
-
summary_index:
|
|
3356
|
-
delta:
|
|
3467
|
+
var responseReasoningSummaryTextDeltaSchema = z15.object({
|
|
3468
|
+
type: z15.literal("response.reasoning_summary_text.delta"),
|
|
3469
|
+
item_id: z15.string(),
|
|
3470
|
+
summary_index: z15.number(),
|
|
3471
|
+
delta: z15.string()
|
|
3357
3472
|
});
|
|
3358
|
-
var openaiResponsesChunkSchema =
|
|
3473
|
+
var openaiResponsesChunkSchema = z15.union([
|
|
3359
3474
|
textDeltaChunkSchema,
|
|
3360
3475
|
responseFinishedChunkSchema,
|
|
3361
3476
|
responseCreatedChunkSchema,
|
|
@@ -3366,7 +3481,7 @@ var openaiResponsesChunkSchema = z14.union([
|
|
|
3366
3481
|
responseReasoningSummaryPartAddedSchema,
|
|
3367
3482
|
responseReasoningSummaryTextDeltaSchema,
|
|
3368
3483
|
errorChunkSchema,
|
|
3369
|
-
|
|
3484
|
+
z15.object({ type: z15.string() }).loose()
|
|
3370
3485
|
// fallback for unknown chunks
|
|
3371
3486
|
]);
|
|
3372
3487
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3439,27 +3554,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3439
3554
|
isReasoningModel: false
|
|
3440
3555
|
};
|
|
3441
3556
|
}
|
|
3442
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
previousResponseId: z14.string().nullish(),
|
|
3446
|
-
store: z14.boolean().nullish(),
|
|
3447
|
-
user: z14.string().nullish(),
|
|
3448
|
-
reasoningEffort: z14.string().nullish(),
|
|
3449
|
-
strictJsonSchema: z14.boolean().nullish(),
|
|
3450
|
-
instructions: z14.string().nullish(),
|
|
3451
|
-
reasoningSummary: z14.string().nullish(),
|
|
3452
|
-
serviceTier: z14.enum(["auto", "flex", "priority"]).nullish(),
|
|
3453
|
-
include: z14.array(
|
|
3454
|
-
z14.enum([
|
|
3557
|
+
var openaiResponsesProviderOptionsSchema = z15.object({
|
|
3558
|
+
include: z15.array(
|
|
3559
|
+
z15.enum([
|
|
3455
3560
|
"reasoning.encrypted_content",
|
|
3456
3561
|
"file_search_call.results",
|
|
3457
3562
|
"message.output_text.logprobs"
|
|
3458
3563
|
])
|
|
3459
3564
|
).nullish(),
|
|
3460
|
-
|
|
3461
|
-
promptCacheKey: z14.string().nullish(),
|
|
3462
|
-
safetyIdentifier: z14.string().nullish(),
|
|
3565
|
+
instructions: z15.string().nullish(),
|
|
3463
3566
|
/**
|
|
3464
3567
|
* Return the log probabilities of the tokens.
|
|
3465
3568
|
*
|
|
@@ -3472,7 +3575,25 @@ var openaiResponsesProviderOptionsSchema = z14.object({
|
|
|
3472
3575
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3473
3576
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3474
3577
|
*/
|
|
3475
|
-
logprobs:
|
|
3578
|
+
logprobs: z15.union([z15.boolean(), z15.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3579
|
+
/**
|
|
3580
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3581
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3582
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
3583
|
+
*/
|
|
3584
|
+
maxToolCalls: z15.number().nullish(),
|
|
3585
|
+
metadata: z15.any().nullish(),
|
|
3586
|
+
parallelToolCalls: z15.boolean().nullish(),
|
|
3587
|
+
previousResponseId: z15.string().nullish(),
|
|
3588
|
+
promptCacheKey: z15.string().nullish(),
|
|
3589
|
+
reasoningEffort: z15.string().nullish(),
|
|
3590
|
+
reasoningSummary: z15.string().nullish(),
|
|
3591
|
+
safetyIdentifier: z15.string().nullish(),
|
|
3592
|
+
serviceTier: z15.enum(["auto", "flex", "priority"]).nullish(),
|
|
3593
|
+
store: z15.boolean().nullish(),
|
|
3594
|
+
strictJsonSchema: z15.boolean().nullish(),
|
|
3595
|
+
textVerbosity: z15.enum(["low", "medium", "high"]).nullish(),
|
|
3596
|
+
user: z15.string().nullish()
|
|
3476
3597
|
});
|
|
3477
3598
|
|
|
3478
3599
|
// src/speech/openai-speech-model.ts
|
|
@@ -3482,10 +3603,10 @@ import {
|
|
|
3482
3603
|
parseProviderOptions as parseProviderOptions6,
|
|
3483
3604
|
postJsonToApi as postJsonToApi6
|
|
3484
3605
|
} from "@ai-sdk/provider-utils";
|
|
3485
|
-
import { z as
|
|
3486
|
-
var OpenAIProviderOptionsSchema =
|
|
3487
|
-
instructions:
|
|
3488
|
-
speed:
|
|
3606
|
+
import { z as z16 } from "zod/v4";
|
|
3607
|
+
var OpenAIProviderOptionsSchema = z16.object({
|
|
3608
|
+
instructions: z16.string().nullish(),
|
|
3609
|
+
speed: z16.number().min(0.25).max(4).default(1).nullish()
|
|
3489
3610
|
});
|
|
3490
3611
|
var OpenAISpeechModel = class {
|
|
3491
3612
|
constructor(modelId, config) {
|
|
@@ -3596,33 +3717,33 @@ import {
|
|
|
3596
3717
|
parseProviderOptions as parseProviderOptions7,
|
|
3597
3718
|
postFormDataToApi
|
|
3598
3719
|
} from "@ai-sdk/provider-utils";
|
|
3599
|
-
import { z as
|
|
3720
|
+
import { z as z18 } from "zod/v4";
|
|
3600
3721
|
|
|
3601
3722
|
// src/transcription/openai-transcription-options.ts
|
|
3602
|
-
import { z as
|
|
3603
|
-
var openAITranscriptionProviderOptions =
|
|
3723
|
+
import { z as z17 } from "zod/v4";
|
|
3724
|
+
var openAITranscriptionProviderOptions = z17.object({
|
|
3604
3725
|
/**
|
|
3605
3726
|
* Additional information to include in the transcription response.
|
|
3606
3727
|
*/
|
|
3607
|
-
include:
|
|
3728
|
+
include: z17.array(z17.string()).optional(),
|
|
3608
3729
|
/**
|
|
3609
3730
|
* The language of the input audio in ISO-639-1 format.
|
|
3610
3731
|
*/
|
|
3611
|
-
language:
|
|
3732
|
+
language: z17.string().optional(),
|
|
3612
3733
|
/**
|
|
3613
3734
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
3614
3735
|
*/
|
|
3615
|
-
prompt:
|
|
3736
|
+
prompt: z17.string().optional(),
|
|
3616
3737
|
/**
|
|
3617
3738
|
* The sampling temperature, between 0 and 1.
|
|
3618
3739
|
* @default 0
|
|
3619
3740
|
*/
|
|
3620
|
-
temperature:
|
|
3741
|
+
temperature: z17.number().min(0).max(1).default(0).optional(),
|
|
3621
3742
|
/**
|
|
3622
3743
|
* The timestamp granularities to populate for this transcription.
|
|
3623
3744
|
* @default ['segment']
|
|
3624
3745
|
*/
|
|
3625
|
-
timestampGranularities:
|
|
3746
|
+
timestampGranularities: z17.array(z17.enum(["word", "segment"])).default(["segment"]).optional()
|
|
3626
3747
|
});
|
|
3627
3748
|
|
|
3628
3749
|
// src/transcription/openai-transcription-model.ts
|
|
@@ -3791,29 +3912,29 @@ var OpenAITranscriptionModel = class {
|
|
|
3791
3912
|
};
|
|
3792
3913
|
}
|
|
3793
3914
|
};
|
|
3794
|
-
var openaiTranscriptionResponseSchema =
|
|
3795
|
-
text:
|
|
3796
|
-
language:
|
|
3797
|
-
duration:
|
|
3798
|
-
words:
|
|
3799
|
-
|
|
3800
|
-
word:
|
|
3801
|
-
start:
|
|
3802
|
-
end:
|
|
3915
|
+
var openaiTranscriptionResponseSchema = z18.object({
|
|
3916
|
+
text: z18.string(),
|
|
3917
|
+
language: z18.string().nullish(),
|
|
3918
|
+
duration: z18.number().nullish(),
|
|
3919
|
+
words: z18.array(
|
|
3920
|
+
z18.object({
|
|
3921
|
+
word: z18.string(),
|
|
3922
|
+
start: z18.number(),
|
|
3923
|
+
end: z18.number()
|
|
3803
3924
|
})
|
|
3804
3925
|
).nullish(),
|
|
3805
|
-
segments:
|
|
3806
|
-
|
|
3807
|
-
id:
|
|
3808
|
-
seek:
|
|
3809
|
-
start:
|
|
3810
|
-
end:
|
|
3811
|
-
text:
|
|
3812
|
-
tokens:
|
|
3813
|
-
temperature:
|
|
3814
|
-
avg_logprob:
|
|
3815
|
-
compression_ratio:
|
|
3816
|
-
no_speech_prob:
|
|
3926
|
+
segments: z18.array(
|
|
3927
|
+
z18.object({
|
|
3928
|
+
id: z18.number(),
|
|
3929
|
+
seek: z18.number(),
|
|
3930
|
+
start: z18.number(),
|
|
3931
|
+
end: z18.number(),
|
|
3932
|
+
text: z18.string(),
|
|
3933
|
+
tokens: z18.array(z18.number()),
|
|
3934
|
+
temperature: z18.number(),
|
|
3935
|
+
avg_logprob: z18.number(),
|
|
3936
|
+
compression_ratio: z18.number(),
|
|
3937
|
+
no_speech_prob: z18.number()
|
|
3817
3938
|
})
|
|
3818
3939
|
).nullish()
|
|
3819
3940
|
});
|