@ai-sdk/openai 3.0.136 → 3.0.137
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 +6 -0
- package/dist/index.d.mts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +85 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +11 -2
- package/dist/internal/index.d.ts +11 -2
- package/dist/internal/index.js +84 -19
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +70 -3
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +24 -0
- package/package.json +3 -3
- package/src/image/openai-image-model-options.ts +44 -0
- package/src/image/openai-image-model.ts +44 -4
|
@@ -127,7 +127,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV3 {
|
|
|
127
127
|
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3['doEmbed']>>>;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'gpt-image-2.5-flare' | 'gpt-image-2.5-flare-2026-09-08' | 'gpt-image-2.5-sunburst' | 'gpt-image-2.5-sunburst-2026-09-08' | 'chatgpt-image-latest' | (string & {});
|
|
130
|
+
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'gpt-image-2.6-flare' | 'gpt-image-2.6-sunburst' | 'gpt-image-2.5-flare' | 'gpt-image-2.5-flare-2026-09-08' | 'gpt-image-2.5-sunburst' | 'gpt-image-2.5-sunburst-2026-09-08' | 'chatgpt-image-latest' | (string & {});
|
|
131
131
|
declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
132
132
|
declare function hasDefaultResponseFormat(modelId: string): boolean;
|
|
133
133
|
declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
|
|
@@ -135,17 +135,23 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
135
135
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
136
136
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
137
137
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
138
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
138
139
|
outputCompression?: number | undefined;
|
|
139
140
|
user?: string | undefined;
|
|
141
|
+
safetyIdentifier?: string | undefined;
|
|
140
142
|
}>;
|
|
141
143
|
type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
|
|
142
144
|
declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
143
145
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
144
146
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
145
|
-
|
|
147
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
146
148
|
outputCompression?: number | undefined;
|
|
147
149
|
user?: string | undefined;
|
|
150
|
+
safetyIdentifier?: string | undefined;
|
|
148
151
|
style?: "vivid" | "natural" | undefined;
|
|
152
|
+
outputFormat?: "png" | "jpeg" | "webp" | "gif" | undefined;
|
|
153
|
+
frameCount?: number | undefined;
|
|
154
|
+
frameDurationMs?: number | undefined;
|
|
149
155
|
moderation?: "low" | "auto" | undefined;
|
|
150
156
|
}>;
|
|
151
157
|
type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
|
|
@@ -153,9 +159,12 @@ declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
153
159
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
154
160
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
155
161
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
162
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
156
163
|
outputCompression?: number | undefined;
|
|
157
164
|
user?: string | undefined;
|
|
165
|
+
safetyIdentifier?: string | undefined;
|
|
158
166
|
inputFidelity?: "low" | "high" | undefined;
|
|
167
|
+
markup?: string | undefined;
|
|
159
168
|
}>;
|
|
160
169
|
type OpenAIImageModelEditOptions = InferSchema<typeof openaiImageModelEditOptions>;
|
|
161
170
|
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -127,7 +127,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV3 {
|
|
|
127
127
|
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3['doEmbed']>>>;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'gpt-image-2.5-flare' | 'gpt-image-2.5-flare-2026-09-08' | 'gpt-image-2.5-sunburst' | 'gpt-image-2.5-sunburst-2026-09-08' | 'chatgpt-image-latest' | (string & {});
|
|
130
|
+
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'gpt-image-2.6-flare' | 'gpt-image-2.6-sunburst' | 'gpt-image-2.5-flare' | 'gpt-image-2.5-flare-2026-09-08' | 'gpt-image-2.5-sunburst' | 'gpt-image-2.5-sunburst-2026-09-08' | 'chatgpt-image-latest' | (string & {});
|
|
131
131
|
declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
132
132
|
declare function hasDefaultResponseFormat(modelId: string): boolean;
|
|
133
133
|
declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
|
|
@@ -135,17 +135,23 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
135
135
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
136
136
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
137
137
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
138
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
138
139
|
outputCompression?: number | undefined;
|
|
139
140
|
user?: string | undefined;
|
|
141
|
+
safetyIdentifier?: string | undefined;
|
|
140
142
|
}>;
|
|
141
143
|
type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
|
|
142
144
|
declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
143
145
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
144
146
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
145
|
-
|
|
147
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
146
148
|
outputCompression?: number | undefined;
|
|
147
149
|
user?: string | undefined;
|
|
150
|
+
safetyIdentifier?: string | undefined;
|
|
148
151
|
style?: "vivid" | "natural" | undefined;
|
|
152
|
+
outputFormat?: "png" | "jpeg" | "webp" | "gif" | undefined;
|
|
153
|
+
frameCount?: number | undefined;
|
|
154
|
+
frameDurationMs?: number | undefined;
|
|
149
155
|
moderation?: "low" | "auto" | undefined;
|
|
150
156
|
}>;
|
|
151
157
|
type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
|
|
@@ -153,9 +159,12 @@ declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
153
159
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
154
160
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
155
161
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
162
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
156
163
|
outputCompression?: number | undefined;
|
|
157
164
|
user?: string | undefined;
|
|
165
|
+
safetyIdentifier?: string | undefined;
|
|
158
166
|
inputFidelity?: "low" | "high" | undefined;
|
|
167
|
+
markup?: string | undefined;
|
|
159
168
|
}>;
|
|
160
169
|
type OpenAIImageModelEditOptions = InferSchema<typeof openaiImageModelEditOptions>;
|
|
161
170
|
|
package/dist/internal/index.js
CHANGED
|
@@ -2105,6 +2105,7 @@ var OpenAIEmbeddingModel = class {
|
|
|
2105
2105
|
};
|
|
2106
2106
|
|
|
2107
2107
|
// src/image/openai-image-model.ts
|
|
2108
|
+
var import_provider7 = require("@ai-sdk/provider");
|
|
2108
2109
|
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2109
2110
|
|
|
2110
2111
|
// src/image/openai-image-api.ts
|
|
@@ -2147,6 +2148,8 @@ var modelMaxImagesPerCall = {
|
|
|
2147
2148
|
"gpt-image-1-mini": 10,
|
|
2148
2149
|
"gpt-image-1.5": 10,
|
|
2149
2150
|
"gpt-image-2": 10,
|
|
2151
|
+
"gpt-image-2.6-flare": 10,
|
|
2152
|
+
"gpt-image-2.6-sunburst": 10,
|
|
2150
2153
|
"gpt-image-2.5-flare": 10,
|
|
2151
2154
|
"gpt-image-2.5-flare-2026-09-08": 10,
|
|
2152
2155
|
"gpt-image-2.5-sunburst": 10,
|
|
@@ -2182,6 +2185,11 @@ var baseImageModelOptionsObject = () => import_v49.z.object({
|
|
|
2182
2185
|
* Format in which the generated image(s) are returned.
|
|
2183
2186
|
*/
|
|
2184
2187
|
outputFormat: import_v49.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
2188
|
+
/**
|
|
2189
|
+
* How much detail the model puts into the image. Supported by GPT Image
|
|
2190
|
+
* 2.6 models. The API defaults to `high`.
|
|
2191
|
+
*/
|
|
2192
|
+
complexity: import_v49.z.enum(["low", "medium", "high"]).optional(),
|
|
2185
2193
|
/**
|
|
2186
2194
|
* Compression level (0-100) for the generated image(s). Applies to the
|
|
2187
2195
|
* `jpeg` and `webp` output formats.
|
|
@@ -2191,7 +2199,13 @@ var baseImageModelOptionsObject = () => import_v49.z.object({
|
|
|
2191
2199
|
* A unique identifier representing your end-user, which can help OpenAI
|
|
2192
2200
|
* to monitor and detect abuse.
|
|
2193
2201
|
*/
|
|
2194
|
-
user: import_v49.z.string().optional()
|
|
2202
|
+
user: import_v49.z.string().optional(),
|
|
2203
|
+
/**
|
|
2204
|
+
* A stable identifier used to help detect users of your application that
|
|
2205
|
+
* may be violating OpenAI's usage policies. Should be a hashed username
|
|
2206
|
+
* or email address.
|
|
2207
|
+
*/
|
|
2208
|
+
safetyIdentifier: import_v49.z.string().max(128).optional()
|
|
2195
2209
|
});
|
|
2196
2210
|
var openaiImageModelOptions = (0, import_provider_utils13.lazySchema)(
|
|
2197
2211
|
() => (0, import_provider_utils13.zodSchema)(baseImageModelOptionsObject())
|
|
@@ -2205,6 +2219,22 @@ var openaiImageModelGenerationOptions = (0, import_provider_utils13.lazySchema)(
|
|
|
2205
2219
|
* looking images.
|
|
2206
2220
|
*/
|
|
2207
2221
|
style: import_v49.z.enum(["vivid", "natural"]).optional(),
|
|
2222
|
+
/**
|
|
2223
|
+
* Format in which the generated image(s) are returned. `gif` produces
|
|
2224
|
+
* an animated GIF and is supported by GPT Image 2.6 models.
|
|
2225
|
+
*/
|
|
2226
|
+
outputFormat: import_v49.z.enum(["png", "jpeg", "webp", "gif"]).optional(),
|
|
2227
|
+
/**
|
|
2228
|
+
* Number of frames (2-64) of an animated GIF. Only applies to the `gif`
|
|
2229
|
+
* output format. The API defaults to 9.
|
|
2230
|
+
*/
|
|
2231
|
+
frameCount: import_v49.z.number().int().min(2).max(64).optional(),
|
|
2232
|
+
/**
|
|
2233
|
+
* Duration of each frame in milliseconds (20-2000) of an animated GIF.
|
|
2234
|
+
* The API rounds it to the nearest 10 ms. Only applies to the `gif`
|
|
2235
|
+
* output format. The API defaults to 200.
|
|
2236
|
+
*/
|
|
2237
|
+
frameDurationMs: import_v49.z.number().int().min(20).max(2e3).optional(),
|
|
2208
2238
|
/**
|
|
2209
2239
|
* Content moderation level for the generated image(s). `low` applies
|
|
2210
2240
|
* less restrictive filtering.
|
|
@@ -2219,7 +2249,14 @@ var openaiImageModelEditOptions = (0, import_provider_utils13.lazySchema)(
|
|
|
2219
2249
|
/**
|
|
2220
2250
|
* Fidelity of the output image(s) to the input image(s).
|
|
2221
2251
|
*/
|
|
2222
|
-
inputFidelity: import_v49.z.enum(["high", "low"]).optional()
|
|
2252
|
+
inputFidelity: import_v49.z.enum(["high", "low"]).optional(),
|
|
2253
|
+
/**
|
|
2254
|
+
* A transparent PNG overlaid on the first input image to mark up the
|
|
2255
|
+
* regions to change, as an HTTPS URL or a base64 data URL. It must match
|
|
2256
|
+
* the dimensions of the first image. Supported by GPT Image 2.5 and 2.6
|
|
2257
|
+
* models. Cannot be combined with a `mask`.
|
|
2258
|
+
*/
|
|
2259
|
+
markup: import_v49.z.string().optional()
|
|
2223
2260
|
})
|
|
2224
2261
|
)
|
|
2225
2262
|
);
|
|
@@ -2268,6 +2305,12 @@ var OpenAIImageModel = class {
|
|
|
2268
2305
|
providerOptions,
|
|
2269
2306
|
schema: openaiImageModelEditOptions
|
|
2270
2307
|
})) != null ? _d : {};
|
|
2308
|
+
if (mask != null && openaiOptions2.markup != null) {
|
|
2309
|
+
throw new import_provider7.InvalidArgumentError({
|
|
2310
|
+
argument: "providerOptions.openai.markup",
|
|
2311
|
+
message: "`markup` cannot be combined with `mask`."
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2271
2314
|
const { value: response2, responseHeaders: responseHeaders2 } = await (0, import_provider_utils14.postFormDataToApi)({
|
|
2272
2315
|
url: this.config.url({
|
|
2273
2316
|
path: "/images/edits",
|
|
@@ -2292,14 +2335,17 @@ var OpenAIImageModel = class {
|
|
|
2292
2335
|
)
|
|
2293
2336
|
),
|
|
2294
2337
|
mask: mask != null ? await fileToBlob(mask) : void 0,
|
|
2338
|
+
markup: openaiOptions2.markup != null ? await markupToBlob(openaiOptions2.markup) : void 0,
|
|
2295
2339
|
n,
|
|
2296
2340
|
size,
|
|
2297
2341
|
quality: openaiOptions2.quality,
|
|
2298
2342
|
background: openaiOptions2.background,
|
|
2299
2343
|
output_format: openaiOptions2.outputFormat,
|
|
2300
2344
|
output_compression: openaiOptions2.outputCompression,
|
|
2345
|
+
complexity: openaiOptions2.complexity,
|
|
2301
2346
|
input_fidelity: openaiOptions2.inputFidelity,
|
|
2302
|
-
user: openaiOptions2.user
|
|
2347
|
+
user: openaiOptions2.user,
|
|
2348
|
+
safety_identifier: openaiOptions2.safetyIdentifier
|
|
2303
2349
|
}),
|
|
2304
2350
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2305
2351
|
successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
|
|
@@ -2365,7 +2411,11 @@ var OpenAIImageModel = class {
|
|
|
2365
2411
|
moderation: openaiOptions.moderation,
|
|
2366
2412
|
output_format: openaiOptions.outputFormat,
|
|
2367
2413
|
output_compression: openaiOptions.outputCompression,
|
|
2414
|
+
complexity: openaiOptions.complexity,
|
|
2415
|
+
frame_count: openaiOptions.frameCount,
|
|
2416
|
+
frame_duration_ms: openaiOptions.frameDurationMs,
|
|
2368
2417
|
user: openaiOptions.user,
|
|
2418
|
+
safety_identifier: openaiOptions.safetyIdentifier,
|
|
2369
2419
|
...!hasDefaultResponseFormat(this.modelId) ? { response_format: "b64_json" } : {}
|
|
2370
2420
|
},
|
|
2371
2421
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
@@ -2428,6 +2478,21 @@ function distributeTokenDetails(details, index, total) {
|
|
|
2428
2478
|
}
|
|
2429
2479
|
return result;
|
|
2430
2480
|
}
|
|
2481
|
+
async function markupToBlob(markup) {
|
|
2482
|
+
const dataUrl = /^data:([^;,]*)(;base64)?,(.*)$/s.exec(markup);
|
|
2483
|
+
if (dataUrl == null) {
|
|
2484
|
+
return (0, import_provider_utils14.downloadBlob)(markup);
|
|
2485
|
+
}
|
|
2486
|
+
if (dataUrl[2] == null) {
|
|
2487
|
+
throw new import_provider7.InvalidArgumentError({
|
|
2488
|
+
argument: "providerOptions.openai.markup",
|
|
2489
|
+
message: "`markup` data URLs must be base64 encoded."
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
return new Blob([(0, import_provider_utils14.convertBase64ToUint8Array)(dataUrl[3])], {
|
|
2493
|
+
type: dataUrl[1] || "image/png"
|
|
2494
|
+
});
|
|
2495
|
+
}
|
|
2431
2496
|
async function fileToBlob(file) {
|
|
2432
2497
|
if (!file) return void 0;
|
|
2433
2498
|
if (file.type === "url") {
|
|
@@ -2808,7 +2873,7 @@ var OpenAISpeechModel = class {
|
|
|
2808
2873
|
};
|
|
2809
2874
|
|
|
2810
2875
|
// src/responses/openai-responses-language-model.ts
|
|
2811
|
-
var
|
|
2876
|
+
var import_provider11 = require("@ai-sdk/provider");
|
|
2812
2877
|
var import_provider_utils36 = require("@ai-sdk/provider-utils");
|
|
2813
2878
|
|
|
2814
2879
|
// src/responses/convert-openai-responses-usage.ts
|
|
@@ -2852,7 +2917,7 @@ function convertOpenAIResponsesUsage(usage) {
|
|
|
2852
2917
|
}
|
|
2853
2918
|
|
|
2854
2919
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2855
|
-
var
|
|
2920
|
+
var import_provider9 = require("@ai-sdk/provider");
|
|
2856
2921
|
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
2857
2922
|
var import_v419 = require("zod/v4");
|
|
2858
2923
|
|
|
@@ -3417,7 +3482,7 @@ var webSearchToolFactory = (0, import_provider_utils25.createProviderToolFactory
|
|
|
3417
3482
|
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
3418
3483
|
|
|
3419
3484
|
// src/responses/expand-parallel-tool-call.ts
|
|
3420
|
-
var
|
|
3485
|
+
var import_provider8 = require("@ai-sdk/provider");
|
|
3421
3486
|
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
3422
3487
|
var parallelToolName = "parallel";
|
|
3423
3488
|
var recipientNamePrefix = "functions.";
|
|
@@ -3427,7 +3492,7 @@ function getParallelToolCallMetadata({
|
|
|
3427
3492
|
}) {
|
|
3428
3493
|
var _a2;
|
|
3429
3494
|
const metadata = (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.parallelToolCall;
|
|
3430
|
-
if (!(0,
|
|
3495
|
+
if (!(0, import_provider8.isJSONObject)(metadata) || typeof metadata.itemId !== "string" || typeof metadata.toolCallId !== "string" || typeof metadata.toolName !== "string" || typeof metadata.input !== "string" || typeof metadata.index !== "number" || !Number.isInteger(metadata.index) || typeof metadata.count !== "number" || !Number.isInteger(metadata.count) || metadata.index < 0 || metadata.count <= metadata.index) {
|
|
3431
3496
|
return void 0;
|
|
3432
3497
|
}
|
|
3433
3498
|
return metadata;
|
|
@@ -3448,7 +3513,7 @@ async function expandParallelToolCall({
|
|
|
3448
3513
|
return void 0;
|
|
3449
3514
|
}
|
|
3450
3515
|
const parsedInput = await (0, import_provider_utils26.safeParseJSON)({ text: toolCall.input });
|
|
3451
|
-
if (!parsedInput.success || !(0,
|
|
3516
|
+
if (!parsedInput.success || !(0, import_provider8.isJSONObject)(parsedInput.value)) {
|
|
3452
3517
|
return void 0;
|
|
3453
3518
|
}
|
|
3454
3519
|
const toolUses = parsedInput.value.tool_uses;
|
|
@@ -3458,12 +3523,12 @@ async function expandParallelToolCall({
|
|
|
3458
3523
|
const availableToolNames = new Set(tools.map((tool) => tool.name));
|
|
3459
3524
|
const expandedToolCalls = [];
|
|
3460
3525
|
for (const [index, toolUse] of toolUses.entries()) {
|
|
3461
|
-
if (!(0,
|
|
3526
|
+
if (!(0, import_provider8.isJSONObject)(toolUse)) {
|
|
3462
3527
|
return void 0;
|
|
3463
3528
|
}
|
|
3464
3529
|
const recipientName = toolUse.recipient_name;
|
|
3465
3530
|
const parameters = toolUse.parameters;
|
|
3466
|
-
if (typeof recipientName !== "string" || !recipientName.startsWith(recipientNamePrefix) || !(0,
|
|
3531
|
+
if (typeof recipientName !== "string" || !recipientName.startsWith(recipientNamePrefix) || !(0, import_provider8.isJSONObject)(parameters)) {
|
|
3467
3532
|
return void 0;
|
|
3468
3533
|
}
|
|
3469
3534
|
const toolName = recipientName.slice(recipientNamePrefix.length);
|
|
@@ -3791,7 +3856,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3791
3856
|
if (effort != null) {
|
|
3792
3857
|
const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
|
|
3793
3858
|
if (unsupportedReason != null) {
|
|
3794
|
-
throw new
|
|
3859
|
+
throw new import_provider9.UnsupportedFunctionalityError({
|
|
3795
3860
|
functionality: "Message-level reasoningEffortUpdate",
|
|
3796
3861
|
message: unsupportedReason
|
|
3797
3862
|
});
|
|
@@ -3903,7 +3968,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3903
3968
|
};
|
|
3904
3969
|
}
|
|
3905
3970
|
if (mediaType !== "application/pdf" && !passThroughUnsupportedFiles) {
|
|
3906
|
-
throw new
|
|
3971
|
+
throw new import_provider9.UnsupportedFunctionalityError({
|
|
3907
3972
|
functionality: `file part media type ${mediaType}`
|
|
3908
3973
|
});
|
|
3909
3974
|
}
|
|
@@ -5518,7 +5583,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils28.lazySchema)(
|
|
|
5518
5583
|
);
|
|
5519
5584
|
|
|
5520
5585
|
// src/responses/openai-responses-prepare-tools.ts
|
|
5521
|
-
var
|
|
5586
|
+
var import_provider10 = require("@ai-sdk/provider");
|
|
5522
5587
|
var import_provider_utils35 = require("@ai-sdk/provider-utils");
|
|
5523
5588
|
|
|
5524
5589
|
// src/tool/code-interpreter.ts
|
|
@@ -5850,7 +5915,7 @@ async function prepareResponsesTools({
|
|
|
5850
5915
|
namespaceTools.set(namespace.name, namespaceTool);
|
|
5851
5916
|
openaiTools.push(namespaceTool);
|
|
5852
5917
|
} else if (namespaceTool.description !== namespace.description) {
|
|
5853
|
-
throw new
|
|
5918
|
+
throw new import_provider10.UnsupportedFunctionalityError({
|
|
5854
5919
|
functionality: `conflicting descriptions for OpenAI tool namespace "${namespace.name}"`
|
|
5855
5920
|
});
|
|
5856
5921
|
}
|
|
@@ -6104,7 +6169,7 @@ async function prepareResponsesTools({
|
|
|
6104
6169
|
allowedToolEntries.push(resolution.entry);
|
|
6105
6170
|
}
|
|
6106
6171
|
if (allowedToolEntries.length === 0) {
|
|
6107
|
-
throw new
|
|
6172
|
+
throw new import_provider10.UnsupportedFunctionalityError({
|
|
6108
6173
|
functionality: `allowedTools with only tools that cannot be allow-listed (${droppedToolNames.join(
|
|
6109
6174
|
", "
|
|
6110
6175
|
)})`
|
|
@@ -6139,7 +6204,7 @@ async function prepareResponsesTools({
|
|
|
6139
6204
|
}
|
|
6140
6205
|
default: {
|
|
6141
6206
|
const _exhaustiveCheck = type;
|
|
6142
|
-
throw new
|
|
6207
|
+
throw new import_provider10.UnsupportedFunctionalityError({
|
|
6143
6208
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
6144
6209
|
});
|
|
6145
6210
|
}
|
|
@@ -6447,7 +6512,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6447
6512
|
}
|
|
6448
6513
|
for (let i = 1; i < input.length; i++) {
|
|
6449
6514
|
if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
|
|
6450
|
-
throw new
|
|
6515
|
+
throw new import_provider11.UnsupportedFunctionalityError({
|
|
6451
6516
|
functionality: "Adjacent reasoning effort configuration updates"
|
|
6452
6517
|
});
|
|
6453
6518
|
}
|
|
@@ -6676,7 +6741,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6676
6741
|
fetch: this.config.fetch
|
|
6677
6742
|
});
|
|
6678
6743
|
if (response.error) {
|
|
6679
|
-
throw new
|
|
6744
|
+
throw new import_provider11.APICallError({
|
|
6680
6745
|
message: response.error.message,
|
|
6681
6746
|
url,
|
|
6682
6747
|
requestBodyValues: body,
|
|
@@ -8196,7 +8261,7 @@ function createOpenAIResponsesChatCompletionsMismatchError({
|
|
|
8196
8261
|
requestBodyValues,
|
|
8197
8262
|
responseHeaders
|
|
8198
8263
|
}) {
|
|
8199
|
-
return new
|
|
8264
|
+
return new import_provider11.APICallError({
|
|
8200
8265
|
message: "Received a Chat Completions stream while using the OpenAI Responses API. The default OpenAI provider model uses the Responses API. If your custom baseURL targets a Chat Completions-compatible endpoint, use openai.chat('model-id') or createOpenAI(...).chat('model-id') instead. You can also use @ai-sdk/openai-compatible for OpenAI-compatible providers.",
|
|
8201
8266
|
url,
|
|
8202
8267
|
requestBodyValues,
|