@ai-sdk/openai 2.0.30 → 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 +8 -0
- package/dist/index.d.mts +42 -12
- package/dist/index.d.ts +42 -12
- package/dist/index.js +481 -361
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +450 -330
- 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 +384 -281
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +373 -270
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
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,14 +1986,14 @@ 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
1991
|
// src/responses/convert-to-openai-responses-input.ts
|
|
1948
1992
|
import {
|
|
1949
1993
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError4
|
|
1950
1994
|
} from "@ai-sdk/provider";
|
|
1951
1995
|
import { convertToBase64 as convertToBase642, parseProviderOptions as parseProviderOptions4 } from "@ai-sdk/provider-utils";
|
|
1952
|
-
import { z as
|
|
1996
|
+
import { z as z14 } from "zod/v4";
|
|
1953
1997
|
function isFileId(data, prefixes) {
|
|
1954
1998
|
if (!prefixes) return false;
|
|
1955
1999
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -1957,7 +2001,8 @@ function isFileId(data, prefixes) {
|
|
|
1957
2001
|
async function convertToOpenAIResponsesInput({
|
|
1958
2002
|
prompt,
|
|
1959
2003
|
systemMessageMode,
|
|
1960
|
-
fileIdPrefixes
|
|
2004
|
+
fileIdPrefixes,
|
|
2005
|
+
store
|
|
1961
2006
|
}) {
|
|
1962
2007
|
var _a, _b, _c, _d, _e, _f;
|
|
1963
2008
|
const input = [];
|
|
@@ -2062,10 +2107,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2062
2107
|
break;
|
|
2063
2108
|
}
|
|
2064
2109
|
case "tool-result": {
|
|
2065
|
-
|
|
2066
|
-
type: "
|
|
2067
|
-
|
|
2068
|
-
|
|
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
|
+
}
|
|
2069
2118
|
break;
|
|
2070
2119
|
}
|
|
2071
2120
|
case "reasoning": {
|
|
@@ -2140,9 +2189,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2140
2189
|
}
|
|
2141
2190
|
return { input, warnings };
|
|
2142
2191
|
}
|
|
2143
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2144
|
-
itemId:
|
|
2145
|
-
reasoningEncryptedContent:
|
|
2192
|
+
var openaiResponsesReasoningProviderOptionsSchema = z14.object({
|
|
2193
|
+
itemId: z14.string().nullish(),
|
|
2194
|
+
reasoningEncryptedContent: z14.string().nullish()
|
|
2146
2195
|
});
|
|
2147
2196
|
|
|
2148
2197
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2229,8 +2278,23 @@ function prepareResponsesTools({
|
|
|
2229
2278
|
});
|
|
2230
2279
|
break;
|
|
2231
2280
|
}
|
|
2232
|
-
|
|
2233
|
-
|
|
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
|
+
});
|
|
2234
2298
|
break;
|
|
2235
2299
|
}
|
|
2236
2300
|
}
|
|
@@ -2253,7 +2317,7 @@ function prepareResponsesTools({
|
|
|
2253
2317
|
case "tool":
|
|
2254
2318
|
return {
|
|
2255
2319
|
tools: openaiTools2,
|
|
2256
|
-
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 },
|
|
2257
2321
|
toolWarnings
|
|
2258
2322
|
};
|
|
2259
2323
|
default: {
|
|
@@ -2266,47 +2330,52 @@ function prepareResponsesTools({
|
|
|
2266
2330
|
}
|
|
2267
2331
|
|
|
2268
2332
|
// src/responses/openai-responses-language-model.ts
|
|
2269
|
-
var webSearchCallItem =
|
|
2270
|
-
type:
|
|
2271
|
-
id:
|
|
2272
|
-
status:
|
|
2273
|
-
action:
|
|
2274
|
-
|
|
2275
|
-
type:
|
|
2276
|
-
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()
|
|
2277
2341
|
}),
|
|
2278
|
-
|
|
2279
|
-
type:
|
|
2280
|
-
url:
|
|
2342
|
+
z15.object({
|
|
2343
|
+
type: z15.literal("open_page"),
|
|
2344
|
+
url: z15.string()
|
|
2281
2345
|
}),
|
|
2282
|
-
|
|
2283
|
-
type:
|
|
2284
|
-
url:
|
|
2285
|
-
pattern:
|
|
2346
|
+
z15.object({
|
|
2347
|
+
type: z15.literal("find"),
|
|
2348
|
+
url: z15.string(),
|
|
2349
|
+
pattern: z15.string()
|
|
2286
2350
|
})
|
|
2287
2351
|
]).nullish()
|
|
2288
2352
|
});
|
|
2289
|
-
var codeInterpreterCallItem =
|
|
2290
|
-
type:
|
|
2291
|
-
id:
|
|
2292
|
-
code:
|
|
2293
|
-
container_id:
|
|
2294
|
-
outputs:
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
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() })
|
|
2298
2362
|
])
|
|
2299
2363
|
).nullable()
|
|
2300
2364
|
});
|
|
2365
|
+
var imageGenerationCallItem = z15.object({
|
|
2366
|
+
type: z15.literal("image_generation_call"),
|
|
2367
|
+
id: z15.string(),
|
|
2368
|
+
result: z15.string()
|
|
2369
|
+
});
|
|
2301
2370
|
var TOP_LOGPROBS_MAX = 20;
|
|
2302
|
-
var LOGPROBS_SCHEMA =
|
|
2303
|
-
|
|
2304
|
-
token:
|
|
2305
|
-
logprob:
|
|
2306
|
-
top_logprobs:
|
|
2307
|
-
|
|
2308
|
-
token:
|
|
2309
|
-
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()
|
|
2310
2379
|
})
|
|
2311
2380
|
)
|
|
2312
2381
|
})
|
|
@@ -2339,7 +2408,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2339
2408
|
toolChoice,
|
|
2340
2409
|
responseFormat
|
|
2341
2410
|
}) {
|
|
2342
|
-
var _a, _b, _c, _d;
|
|
2411
|
+
var _a, _b, _c, _d, _e;
|
|
2343
2412
|
const warnings = [];
|
|
2344
2413
|
const modelConfig = getResponsesModelConfig(this.modelId);
|
|
2345
2414
|
if (topK != null) {
|
|
@@ -2363,28 +2432,29 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2363
2432
|
if (stopSequences != null) {
|
|
2364
2433
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
2365
2434
|
}
|
|
2366
|
-
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
2367
|
-
prompt,
|
|
2368
|
-
systemMessageMode: modelConfig.systemMessageMode,
|
|
2369
|
-
fileIdPrefixes: this.config.fileIdPrefixes
|
|
2370
|
-
});
|
|
2371
|
-
warnings.push(...inputWarnings);
|
|
2372
2435
|
const openaiOptions = await parseProviderOptions5({
|
|
2373
2436
|
provider: "openai",
|
|
2374
2437
|
providerOptions,
|
|
2375
2438
|
schema: openaiResponsesProviderOptionsSchema
|
|
2376
2439
|
});
|
|
2377
|
-
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;
|
|
2378
2448
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
2379
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;
|
|
2380
2450
|
include = topLogprobs ? Array.isArray(include) ? [...include, "message.output_text.logprobs"] : ["message.output_text.logprobs"] : include;
|
|
2381
|
-
const webSearchToolName = (
|
|
2451
|
+
const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
|
|
2382
2452
|
(tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
2383
|
-
)) == null ? void 0 :
|
|
2453
|
+
)) == null ? void 0 : _c.name;
|
|
2384
2454
|
include = webSearchToolName ? Array.isArray(include) ? [...include, "web_search_call.action.sources"] : ["web_search_call.action.sources"] : include;
|
|
2385
|
-
const codeInterpreterToolName = (
|
|
2455
|
+
const codeInterpreterToolName = (_d = tools == null ? void 0 : tools.find(
|
|
2386
2456
|
(tool) => tool.type === "provider-defined" && tool.id === "openai.code_interpreter"
|
|
2387
|
-
)) == null ? void 0 :
|
|
2457
|
+
)) == null ? void 0 : _d.name;
|
|
2388
2458
|
include = codeInterpreterToolName ? Array.isArray(include) ? [...include, "code_interpreter_call.outputs"] : ["code_interpreter_call.outputs"] : include;
|
|
2389
2459
|
const baseArgs = {
|
|
2390
2460
|
model: this.modelId,
|
|
@@ -2398,7 +2468,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2398
2468
|
format: responseFormat.schema != null ? {
|
|
2399
2469
|
type: "json_schema",
|
|
2400
2470
|
strict: strictJsonSchema,
|
|
2401
|
-
name: (
|
|
2471
|
+
name: (_e = responseFormat.name) != null ? _e : "response",
|
|
2402
2472
|
description: responseFormat.description,
|
|
2403
2473
|
schema: responseFormat.schema
|
|
2404
2474
|
} : { type: "json_object" }
|
|
@@ -2409,6 +2479,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2409
2479
|
}
|
|
2410
2480
|
},
|
|
2411
2481
|
// provider options:
|
|
2482
|
+
max_tool_calls: openaiOptions == null ? void 0 : openaiOptions.maxToolCalls,
|
|
2412
2483
|
metadata: openaiOptions == null ? void 0 : openaiOptions.metadata,
|
|
2413
2484
|
parallel_tool_calls: openaiOptions == null ? void 0 : openaiOptions.parallelToolCalls,
|
|
2414
2485
|
previous_response_id: openaiOptions == null ? void 0 : openaiOptions.previousResponseId,
|
|
@@ -2524,45 +2595,45 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2524
2595
|
body,
|
|
2525
2596
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2526
2597
|
successfulResponseHandler: createJsonResponseHandler5(
|
|
2527
|
-
|
|
2528
|
-
id:
|
|
2529
|
-
created_at:
|
|
2530
|
-
error:
|
|
2531
|
-
code:
|
|
2532
|
-
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()
|
|
2533
2604
|
}).nullish(),
|
|
2534
|
-
model:
|
|
2535
|
-
output:
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
type:
|
|
2539
|
-
role:
|
|
2540
|
-
id:
|
|
2541
|
-
content:
|
|
2542
|
-
|
|
2543
|
-
type:
|
|
2544
|
-
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(),
|
|
2545
2616
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2546
|
-
annotations:
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
type:
|
|
2550
|
-
start_index:
|
|
2551
|
-
end_index:
|
|
2552
|
-
url:
|
|
2553
|
-
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()
|
|
2554
2625
|
}),
|
|
2555
|
-
|
|
2556
|
-
type:
|
|
2557
|
-
file_id:
|
|
2558
|
-
filename:
|
|
2559
|
-
index:
|
|
2560
|
-
start_index:
|
|
2561
|
-
end_index:
|
|
2562
|
-
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()
|
|
2563
2634
|
}),
|
|
2564
|
-
|
|
2565
|
-
type:
|
|
2635
|
+
z15.object({
|
|
2636
|
+
type: z15.literal("container_file_citation")
|
|
2566
2637
|
})
|
|
2567
2638
|
])
|
|
2568
2639
|
)
|
|
@@ -2570,50 +2641,51 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2570
2641
|
)
|
|
2571
2642
|
}),
|
|
2572
2643
|
codeInterpreterCallItem,
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
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()
|
|
2579
2651
|
}),
|
|
2580
2652
|
webSearchCallItem,
|
|
2581
|
-
|
|
2582
|
-
type:
|
|
2583
|
-
id:
|
|
2584
|
-
status:
|
|
2653
|
+
z15.object({
|
|
2654
|
+
type: z15.literal("computer_call"),
|
|
2655
|
+
id: z15.string(),
|
|
2656
|
+
status: z15.string().optional()
|
|
2585
2657
|
}),
|
|
2586
|
-
|
|
2587
|
-
type:
|
|
2588
|
-
id:
|
|
2589
|
-
status:
|
|
2590
|
-
queries:
|
|
2591
|
-
results:
|
|
2592
|
-
|
|
2593
|
-
attributes:
|
|
2594
|
-
file_id:
|
|
2595
|
-
filename:
|
|
2596
|
-
score:
|
|
2597
|
-
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()
|
|
2598
2670
|
})
|
|
2599
2671
|
})
|
|
2600
2672
|
).nullish()
|
|
2601
2673
|
}),
|
|
2602
|
-
|
|
2603
|
-
type:
|
|
2604
|
-
id:
|
|
2605
|
-
encrypted_content:
|
|
2606
|
-
summary:
|
|
2607
|
-
|
|
2608
|
-
type:
|
|
2609
|
-
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()
|
|
2610
2682
|
})
|
|
2611
2683
|
)
|
|
2612
2684
|
})
|
|
2613
2685
|
])
|
|
2614
2686
|
),
|
|
2615
|
-
service_tier:
|
|
2616
|
-
incomplete_details:
|
|
2687
|
+
service_tier: z15.string().nullish(),
|
|
2688
|
+
incomplete_details: z15.object({ reason: z15.string() }).nullable(),
|
|
2617
2689
|
usage: usageSchema2
|
|
2618
2690
|
})
|
|
2619
2691
|
),
|
|
@@ -2654,6 +2726,25 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2654
2726
|
}
|
|
2655
2727
|
break;
|
|
2656
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
|
+
}
|
|
2657
2748
|
case "message": {
|
|
2658
2749
|
for (const contentPart of part.content) {
|
|
2659
2750
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -2917,6 +3008,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2917
3008
|
id: value.item.id,
|
|
2918
3009
|
toolName: "file_search"
|
|
2919
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
|
+
});
|
|
2920
3019
|
} else if (value.item.type === "message") {
|
|
2921
3020
|
controller.enqueue({
|
|
2922
3021
|
type: "text-start",
|
|
@@ -3050,6 +3149,16 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3050
3149
|
},
|
|
3051
3150
|
providerExecuted: true
|
|
3052
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
|
+
});
|
|
3053
3162
|
} else if (value.item.type === "message") {
|
|
3054
3163
|
controller.enqueue({
|
|
3055
3164
|
type: "text-end",
|
|
@@ -3186,177 +3295,182 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3186
3295
|
};
|
|
3187
3296
|
}
|
|
3188
3297
|
};
|
|
3189
|
-
var usageSchema2 =
|
|
3190
|
-
input_tokens:
|
|
3191
|
-
input_tokens_details:
|
|
3192
|
-
output_tokens:
|
|
3193
|
-
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()
|
|
3194
3303
|
});
|
|
3195
|
-
var textDeltaChunkSchema =
|
|
3196
|
-
type:
|
|
3197
|
-
item_id:
|
|
3198
|
-
delta:
|
|
3304
|
+
var textDeltaChunkSchema = z15.object({
|
|
3305
|
+
type: z15.literal("response.output_text.delta"),
|
|
3306
|
+
item_id: z15.string(),
|
|
3307
|
+
delta: z15.string(),
|
|
3199
3308
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3200
3309
|
});
|
|
3201
|
-
var errorChunkSchema =
|
|
3202
|
-
type:
|
|
3203
|
-
code:
|
|
3204
|
-
message:
|
|
3205
|
-
param:
|
|
3206
|
-
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()
|
|
3207
3316
|
});
|
|
3208
|
-
var responseFinishedChunkSchema =
|
|
3209
|
-
type:
|
|
3210
|
-
response:
|
|
3211
|
-
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(),
|
|
3212
3321
|
usage: usageSchema2,
|
|
3213
|
-
service_tier:
|
|
3322
|
+
service_tier: z15.string().nullish()
|
|
3214
3323
|
})
|
|
3215
3324
|
});
|
|
3216
|
-
var responseCreatedChunkSchema =
|
|
3217
|
-
type:
|
|
3218
|
-
response:
|
|
3219
|
-
id:
|
|
3220
|
-
created_at:
|
|
3221
|
-
model:
|
|
3222
|
-
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()
|
|
3223
3332
|
})
|
|
3224
3333
|
});
|
|
3225
|
-
var responseOutputItemAddedSchema =
|
|
3226
|
-
type:
|
|
3227
|
-
output_index:
|
|
3228
|
-
item:
|
|
3229
|
-
|
|
3230
|
-
type:
|
|
3231
|
-
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()
|
|
3232
3341
|
}),
|
|
3233
|
-
|
|
3234
|
-
type:
|
|
3235
|
-
id:
|
|
3236
|
-
encrypted_content:
|
|
3342
|
+
z15.object({
|
|
3343
|
+
type: z15.literal("reasoning"),
|
|
3344
|
+
id: z15.string(),
|
|
3345
|
+
encrypted_content: z15.string().nullish()
|
|
3237
3346
|
}),
|
|
3238
|
-
|
|
3239
|
-
type:
|
|
3240
|
-
id:
|
|
3241
|
-
call_id:
|
|
3242
|
-
name:
|
|
3243
|
-
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()
|
|
3244
3353
|
}),
|
|
3245
|
-
|
|
3246
|
-
type:
|
|
3247
|
-
id:
|
|
3248
|
-
status:
|
|
3249
|
-
action:
|
|
3250
|
-
type:
|
|
3251
|
-
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()
|
|
3252
3361
|
}).nullish()
|
|
3253
3362
|
}),
|
|
3254
|
-
|
|
3255
|
-
type:
|
|
3256
|
-
id:
|
|
3257
|
-
status:
|
|
3363
|
+
z15.object({
|
|
3364
|
+
type: z15.literal("computer_call"),
|
|
3365
|
+
id: z15.string(),
|
|
3366
|
+
status: z15.string()
|
|
3258
3367
|
}),
|
|
3259
|
-
|
|
3260
|
-
type:
|
|
3261
|
-
id:
|
|
3262
|
-
status:
|
|
3263
|
-
queries:
|
|
3264
|
-
results:
|
|
3265
|
-
|
|
3266
|
-
attributes:
|
|
3267
|
-
file_id:
|
|
3268
|
-
filename:
|
|
3269
|
-
score:
|
|
3270
|
-
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()
|
|
3271
3380
|
})
|
|
3272
3381
|
})
|
|
3273
3382
|
).optional()
|
|
3383
|
+
}),
|
|
3384
|
+
z15.object({
|
|
3385
|
+
type: z15.literal("image_generation_call"),
|
|
3386
|
+
id: z15.string()
|
|
3274
3387
|
})
|
|
3275
3388
|
])
|
|
3276
3389
|
});
|
|
3277
|
-
var responseOutputItemDoneSchema =
|
|
3278
|
-
type:
|
|
3279
|
-
output_index:
|
|
3280
|
-
item:
|
|
3281
|
-
|
|
3282
|
-
type:
|
|
3283
|
-
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()
|
|
3284
3397
|
}),
|
|
3285
|
-
|
|
3286
|
-
type:
|
|
3287
|
-
id:
|
|
3288
|
-
encrypted_content:
|
|
3398
|
+
z15.object({
|
|
3399
|
+
type: z15.literal("reasoning"),
|
|
3400
|
+
id: z15.string(),
|
|
3401
|
+
encrypted_content: z15.string().nullish()
|
|
3289
3402
|
}),
|
|
3290
|
-
|
|
3291
|
-
type:
|
|
3292
|
-
id:
|
|
3293
|
-
call_id:
|
|
3294
|
-
name:
|
|
3295
|
-
arguments:
|
|
3296
|
-
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")
|
|
3297
3410
|
}),
|
|
3298
3411
|
codeInterpreterCallItem,
|
|
3412
|
+
imageGenerationCallItem,
|
|
3299
3413
|
webSearchCallItem,
|
|
3300
|
-
|
|
3301
|
-
type:
|
|
3302
|
-
id:
|
|
3303
|
-
status:
|
|
3414
|
+
z15.object({
|
|
3415
|
+
type: z15.literal("computer_call"),
|
|
3416
|
+
id: z15.string(),
|
|
3417
|
+
status: z15.literal("completed")
|
|
3304
3418
|
}),
|
|
3305
|
-
|
|
3306
|
-
type:
|
|
3307
|
-
id:
|
|
3308
|
-
status:
|
|
3309
|
-
queries:
|
|
3310
|
-
results:
|
|
3311
|
-
|
|
3312
|
-
attributes:
|
|
3313
|
-
file_id:
|
|
3314
|
-
filename:
|
|
3315
|
-
score:
|
|
3316
|
-
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()
|
|
3317
3431
|
})
|
|
3318
3432
|
})
|
|
3319
3433
|
).nullish()
|
|
3320
3434
|
})
|
|
3321
3435
|
])
|
|
3322
3436
|
});
|
|
3323
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3324
|
-
type:
|
|
3325
|
-
item_id:
|
|
3326
|
-
output_index:
|
|
3327
|
-
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()
|
|
3328
3442
|
});
|
|
3329
|
-
var responseAnnotationAddedSchema =
|
|
3330
|
-
type:
|
|
3331
|
-
annotation:
|
|
3332
|
-
|
|
3333
|
-
type:
|
|
3334
|
-
url:
|
|
3335
|
-
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()
|
|
3336
3450
|
}),
|
|
3337
|
-
|
|
3338
|
-
type:
|
|
3339
|
-
file_id:
|
|
3340
|
-
filename:
|
|
3341
|
-
index:
|
|
3342
|
-
start_index:
|
|
3343
|
-
end_index:
|
|
3344
|
-
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()
|
|
3345
3459
|
})
|
|
3346
3460
|
])
|
|
3347
3461
|
});
|
|
3348
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3349
|
-
type:
|
|
3350
|
-
item_id:
|
|
3351
|
-
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()
|
|
3352
3466
|
});
|
|
3353
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3354
|
-
type:
|
|
3355
|
-
item_id:
|
|
3356
|
-
summary_index:
|
|
3357
|
-
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()
|
|
3358
3472
|
});
|
|
3359
|
-
var openaiResponsesChunkSchema =
|
|
3473
|
+
var openaiResponsesChunkSchema = z15.union([
|
|
3360
3474
|
textDeltaChunkSchema,
|
|
3361
3475
|
responseFinishedChunkSchema,
|
|
3362
3476
|
responseCreatedChunkSchema,
|
|
@@ -3367,7 +3481,7 @@ var openaiResponsesChunkSchema = z14.union([
|
|
|
3367
3481
|
responseReasoningSummaryPartAddedSchema,
|
|
3368
3482
|
responseReasoningSummaryTextDeltaSchema,
|
|
3369
3483
|
errorChunkSchema,
|
|
3370
|
-
|
|
3484
|
+
z15.object({ type: z15.string() }).loose()
|
|
3371
3485
|
// fallback for unknown chunks
|
|
3372
3486
|
]);
|
|
3373
3487
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3440,27 +3554,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3440
3554
|
isReasoningModel: false
|
|
3441
3555
|
};
|
|
3442
3556
|
}
|
|
3443
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
previousResponseId: z14.string().nullish(),
|
|
3447
|
-
store: z14.boolean().nullish(),
|
|
3448
|
-
user: z14.string().nullish(),
|
|
3449
|
-
reasoningEffort: z14.string().nullish(),
|
|
3450
|
-
strictJsonSchema: z14.boolean().nullish(),
|
|
3451
|
-
instructions: z14.string().nullish(),
|
|
3452
|
-
reasoningSummary: z14.string().nullish(),
|
|
3453
|
-
serviceTier: z14.enum(["auto", "flex", "priority"]).nullish(),
|
|
3454
|
-
include: z14.array(
|
|
3455
|
-
z14.enum([
|
|
3557
|
+
var openaiResponsesProviderOptionsSchema = z15.object({
|
|
3558
|
+
include: z15.array(
|
|
3559
|
+
z15.enum([
|
|
3456
3560
|
"reasoning.encrypted_content",
|
|
3457
3561
|
"file_search_call.results",
|
|
3458
3562
|
"message.output_text.logprobs"
|
|
3459
3563
|
])
|
|
3460
3564
|
).nullish(),
|
|
3461
|
-
|
|
3462
|
-
promptCacheKey: z14.string().nullish(),
|
|
3463
|
-
safetyIdentifier: z14.string().nullish(),
|
|
3565
|
+
instructions: z15.string().nullish(),
|
|
3464
3566
|
/**
|
|
3465
3567
|
* Return the log probabilities of the tokens.
|
|
3466
3568
|
*
|
|
@@ -3473,7 +3575,25 @@ var openaiResponsesProviderOptionsSchema = z14.object({
|
|
|
3473
3575
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3474
3576
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3475
3577
|
*/
|
|
3476
|
-
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()
|
|
3477
3597
|
});
|
|
3478
3598
|
|
|
3479
3599
|
// src/speech/openai-speech-model.ts
|
|
@@ -3483,10 +3603,10 @@ import {
|
|
|
3483
3603
|
parseProviderOptions as parseProviderOptions6,
|
|
3484
3604
|
postJsonToApi as postJsonToApi6
|
|
3485
3605
|
} from "@ai-sdk/provider-utils";
|
|
3486
|
-
import { z as
|
|
3487
|
-
var OpenAIProviderOptionsSchema =
|
|
3488
|
-
instructions:
|
|
3489
|
-
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()
|
|
3490
3610
|
});
|
|
3491
3611
|
var OpenAISpeechModel = class {
|
|
3492
3612
|
constructor(modelId, config) {
|
|
@@ -3597,33 +3717,33 @@ import {
|
|
|
3597
3717
|
parseProviderOptions as parseProviderOptions7,
|
|
3598
3718
|
postFormDataToApi
|
|
3599
3719
|
} from "@ai-sdk/provider-utils";
|
|
3600
|
-
import { z as
|
|
3720
|
+
import { z as z18 } from "zod/v4";
|
|
3601
3721
|
|
|
3602
3722
|
// src/transcription/openai-transcription-options.ts
|
|
3603
|
-
import { z as
|
|
3604
|
-
var openAITranscriptionProviderOptions =
|
|
3723
|
+
import { z as z17 } from "zod/v4";
|
|
3724
|
+
var openAITranscriptionProviderOptions = z17.object({
|
|
3605
3725
|
/**
|
|
3606
3726
|
* Additional information to include in the transcription response.
|
|
3607
3727
|
*/
|
|
3608
|
-
include:
|
|
3728
|
+
include: z17.array(z17.string()).optional(),
|
|
3609
3729
|
/**
|
|
3610
3730
|
* The language of the input audio in ISO-639-1 format.
|
|
3611
3731
|
*/
|
|
3612
|
-
language:
|
|
3732
|
+
language: z17.string().optional(),
|
|
3613
3733
|
/**
|
|
3614
3734
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
3615
3735
|
*/
|
|
3616
|
-
prompt:
|
|
3736
|
+
prompt: z17.string().optional(),
|
|
3617
3737
|
/**
|
|
3618
3738
|
* The sampling temperature, between 0 and 1.
|
|
3619
3739
|
* @default 0
|
|
3620
3740
|
*/
|
|
3621
|
-
temperature:
|
|
3741
|
+
temperature: z17.number().min(0).max(1).default(0).optional(),
|
|
3622
3742
|
/**
|
|
3623
3743
|
* The timestamp granularities to populate for this transcription.
|
|
3624
3744
|
* @default ['segment']
|
|
3625
3745
|
*/
|
|
3626
|
-
timestampGranularities:
|
|
3746
|
+
timestampGranularities: z17.array(z17.enum(["word", "segment"])).default(["segment"]).optional()
|
|
3627
3747
|
});
|
|
3628
3748
|
|
|
3629
3749
|
// src/transcription/openai-transcription-model.ts
|
|
@@ -3792,29 +3912,29 @@ var OpenAITranscriptionModel = class {
|
|
|
3792
3912
|
};
|
|
3793
3913
|
}
|
|
3794
3914
|
};
|
|
3795
|
-
var openaiTranscriptionResponseSchema =
|
|
3796
|
-
text:
|
|
3797
|
-
language:
|
|
3798
|
-
duration:
|
|
3799
|
-
words:
|
|
3800
|
-
|
|
3801
|
-
word:
|
|
3802
|
-
start:
|
|
3803
|
-
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()
|
|
3804
3924
|
})
|
|
3805
3925
|
).nullish(),
|
|
3806
|
-
segments:
|
|
3807
|
-
|
|
3808
|
-
id:
|
|
3809
|
-
seek:
|
|
3810
|
-
start:
|
|
3811
|
-
end:
|
|
3812
|
-
text:
|
|
3813
|
-
tokens:
|
|
3814
|
-
temperature:
|
|
3815
|
-
avg_logprob:
|
|
3816
|
-
compression_ratio:
|
|
3817
|
-
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()
|
|
3818
3938
|
})
|
|
3819
3939
|
).nullish()
|
|
3820
3940
|
});
|