@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 3.0.137
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- afde897: feat(openai): support GPT Image 2.6 models with `complexity`, markup-guided edits (`markup`), animated GIF output (`outputFormat: 'gif'`, `frameCount`, `frameDurationMs`), and `safetyIdentifier` for image models
|
|
8
|
+
|
|
3
9
|
## 3.0.136
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -46,22 +46,28 @@ declare const openaiEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
46
46
|
}>;
|
|
47
47
|
type OpenAIEmbeddingModelOptions = InferSchema<typeof openaiEmbeddingModelOptions>;
|
|
48
48
|
|
|
49
|
-
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 & {});
|
|
49
|
+
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 & {});
|
|
50
50
|
declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
51
51
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
52
52
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
53
53
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
54
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
54
55
|
outputCompression?: number | undefined;
|
|
55
56
|
user?: string | undefined;
|
|
57
|
+
safetyIdentifier?: string | undefined;
|
|
56
58
|
}>;
|
|
57
59
|
type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
|
|
58
60
|
declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
59
61
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
60
62
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
61
|
-
|
|
63
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
62
64
|
outputCompression?: number | undefined;
|
|
63
65
|
user?: string | undefined;
|
|
66
|
+
safetyIdentifier?: string | undefined;
|
|
64
67
|
style?: "vivid" | "natural" | undefined;
|
|
68
|
+
outputFormat?: "png" | "jpeg" | "webp" | "gif" | undefined;
|
|
69
|
+
frameCount?: number | undefined;
|
|
70
|
+
frameDurationMs?: number | undefined;
|
|
65
71
|
moderation?: "low" | "auto" | undefined;
|
|
66
72
|
}>;
|
|
67
73
|
type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
|
|
@@ -69,9 +75,12 @@ declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
69
75
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
70
76
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
71
77
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
78
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
72
79
|
outputCompression?: number | undefined;
|
|
73
80
|
user?: string | undefined;
|
|
81
|
+
safetyIdentifier?: string | undefined;
|
|
74
82
|
inputFidelity?: "low" | "high" | undefined;
|
|
83
|
+
markup?: string | undefined;
|
|
75
84
|
}>;
|
|
76
85
|
type OpenAIImageModelEditOptions = InferSchema<typeof openaiImageModelEditOptions>;
|
|
77
86
|
|
package/dist/index.d.ts
CHANGED
|
@@ -46,22 +46,28 @@ declare const openaiEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
46
46
|
}>;
|
|
47
47
|
type OpenAIEmbeddingModelOptions = InferSchema<typeof openaiEmbeddingModelOptions>;
|
|
48
48
|
|
|
49
|
-
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 & {});
|
|
49
|
+
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 & {});
|
|
50
50
|
declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
51
51
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
52
52
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
53
53
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
54
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
54
55
|
outputCompression?: number | undefined;
|
|
55
56
|
user?: string | undefined;
|
|
57
|
+
safetyIdentifier?: string | undefined;
|
|
56
58
|
}>;
|
|
57
59
|
type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
|
|
58
60
|
declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
59
61
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
60
62
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
61
|
-
|
|
63
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
62
64
|
outputCompression?: number | undefined;
|
|
63
65
|
user?: string | undefined;
|
|
66
|
+
safetyIdentifier?: string | undefined;
|
|
64
67
|
style?: "vivid" | "natural" | undefined;
|
|
68
|
+
outputFormat?: "png" | "jpeg" | "webp" | "gif" | undefined;
|
|
69
|
+
frameCount?: number | undefined;
|
|
70
|
+
frameDurationMs?: number | undefined;
|
|
65
71
|
moderation?: "low" | "auto" | undefined;
|
|
66
72
|
}>;
|
|
67
73
|
type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
|
|
@@ -69,9 +75,12 @@ declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
69
75
|
quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
|
|
70
76
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
71
77
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
78
|
+
complexity?: "low" | "medium" | "high" | undefined;
|
|
72
79
|
outputCompression?: number | undefined;
|
|
73
80
|
user?: string | undefined;
|
|
81
|
+
safetyIdentifier?: string | undefined;
|
|
74
82
|
inputFidelity?: "low" | "high" | undefined;
|
|
83
|
+
markup?: string | undefined;
|
|
75
84
|
}>;
|
|
76
85
|
type OpenAIImageModelEditOptions = InferSchema<typeof openaiImageModelEditOptions>;
|
|
77
86
|
|
package/dist/index.js
CHANGED
|
@@ -2065,6 +2065,7 @@ var OpenAIEmbeddingModel = class {
|
|
|
2065
2065
|
};
|
|
2066
2066
|
|
|
2067
2067
|
// src/image/openai-image-model.ts
|
|
2068
|
+
var import_provider7 = require("@ai-sdk/provider");
|
|
2068
2069
|
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2069
2070
|
|
|
2070
2071
|
// src/image/openai-image-api.ts
|
|
@@ -2107,6 +2108,8 @@ var modelMaxImagesPerCall = {
|
|
|
2107
2108
|
"gpt-image-1-mini": 10,
|
|
2108
2109
|
"gpt-image-1.5": 10,
|
|
2109
2110
|
"gpt-image-2": 10,
|
|
2111
|
+
"gpt-image-2.6-flare": 10,
|
|
2112
|
+
"gpt-image-2.6-sunburst": 10,
|
|
2110
2113
|
"gpt-image-2.5-flare": 10,
|
|
2111
2114
|
"gpt-image-2.5-flare-2026-09-08": 10,
|
|
2112
2115
|
"gpt-image-2.5-sunburst": 10,
|
|
@@ -2142,6 +2145,11 @@ var baseImageModelOptionsObject = () => import_v49.z.object({
|
|
|
2142
2145
|
* Format in which the generated image(s) are returned.
|
|
2143
2146
|
*/
|
|
2144
2147
|
outputFormat: import_v49.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
2148
|
+
/**
|
|
2149
|
+
* How much detail the model puts into the image. Supported by GPT Image
|
|
2150
|
+
* 2.6 models. The API defaults to `high`.
|
|
2151
|
+
*/
|
|
2152
|
+
complexity: import_v49.z.enum(["low", "medium", "high"]).optional(),
|
|
2145
2153
|
/**
|
|
2146
2154
|
* Compression level (0-100) for the generated image(s). Applies to the
|
|
2147
2155
|
* `jpeg` and `webp` output formats.
|
|
@@ -2151,7 +2159,13 @@ var baseImageModelOptionsObject = () => import_v49.z.object({
|
|
|
2151
2159
|
* A unique identifier representing your end-user, which can help OpenAI
|
|
2152
2160
|
* to monitor and detect abuse.
|
|
2153
2161
|
*/
|
|
2154
|
-
user: import_v49.z.string().optional()
|
|
2162
|
+
user: import_v49.z.string().optional(),
|
|
2163
|
+
/**
|
|
2164
|
+
* A stable identifier used to help detect users of your application that
|
|
2165
|
+
* may be violating OpenAI's usage policies. Should be a hashed username
|
|
2166
|
+
* or email address.
|
|
2167
|
+
*/
|
|
2168
|
+
safetyIdentifier: import_v49.z.string().max(128).optional()
|
|
2155
2169
|
});
|
|
2156
2170
|
var openaiImageModelOptions = (0, import_provider_utils13.lazySchema)(
|
|
2157
2171
|
() => (0, import_provider_utils13.zodSchema)(baseImageModelOptionsObject())
|
|
@@ -2165,6 +2179,22 @@ var openaiImageModelGenerationOptions = (0, import_provider_utils13.lazySchema)(
|
|
|
2165
2179
|
* looking images.
|
|
2166
2180
|
*/
|
|
2167
2181
|
style: import_v49.z.enum(["vivid", "natural"]).optional(),
|
|
2182
|
+
/**
|
|
2183
|
+
* Format in which the generated image(s) are returned. `gif` produces
|
|
2184
|
+
* an animated GIF and is supported by GPT Image 2.6 models.
|
|
2185
|
+
*/
|
|
2186
|
+
outputFormat: import_v49.z.enum(["png", "jpeg", "webp", "gif"]).optional(),
|
|
2187
|
+
/**
|
|
2188
|
+
* Number of frames (2-64) of an animated GIF. Only applies to the `gif`
|
|
2189
|
+
* output format. The API defaults to 9.
|
|
2190
|
+
*/
|
|
2191
|
+
frameCount: import_v49.z.number().int().min(2).max(64).optional(),
|
|
2192
|
+
/**
|
|
2193
|
+
* Duration of each frame in milliseconds (20-2000) of an animated GIF.
|
|
2194
|
+
* The API rounds it to the nearest 10 ms. Only applies to the `gif`
|
|
2195
|
+
* output format. The API defaults to 200.
|
|
2196
|
+
*/
|
|
2197
|
+
frameDurationMs: import_v49.z.number().int().min(20).max(2e3).optional(),
|
|
2168
2198
|
/**
|
|
2169
2199
|
* Content moderation level for the generated image(s). `low` applies
|
|
2170
2200
|
* less restrictive filtering.
|
|
@@ -2179,7 +2209,14 @@ var openaiImageModelEditOptions = (0, import_provider_utils13.lazySchema)(
|
|
|
2179
2209
|
/**
|
|
2180
2210
|
* Fidelity of the output image(s) to the input image(s).
|
|
2181
2211
|
*/
|
|
2182
|
-
inputFidelity: import_v49.z.enum(["high", "low"]).optional()
|
|
2212
|
+
inputFidelity: import_v49.z.enum(["high", "low"]).optional(),
|
|
2213
|
+
/**
|
|
2214
|
+
* A transparent PNG overlaid on the first input image to mark up the
|
|
2215
|
+
* regions to change, as an HTTPS URL or a base64 data URL. It must match
|
|
2216
|
+
* the dimensions of the first image. Supported by GPT Image 2.5 and 2.6
|
|
2217
|
+
* models. Cannot be combined with a `mask`.
|
|
2218
|
+
*/
|
|
2219
|
+
markup: import_v49.z.string().optional()
|
|
2183
2220
|
})
|
|
2184
2221
|
)
|
|
2185
2222
|
);
|
|
@@ -2228,6 +2265,12 @@ var OpenAIImageModel = class {
|
|
|
2228
2265
|
providerOptions,
|
|
2229
2266
|
schema: openaiImageModelEditOptions
|
|
2230
2267
|
})) != null ? _d : {};
|
|
2268
|
+
if (mask != null && openaiOptions2.markup != null) {
|
|
2269
|
+
throw new import_provider7.InvalidArgumentError({
|
|
2270
|
+
argument: "providerOptions.openai.markup",
|
|
2271
|
+
message: "`markup` cannot be combined with `mask`."
|
|
2272
|
+
});
|
|
2273
|
+
}
|
|
2231
2274
|
const { value: response2, responseHeaders: responseHeaders2 } = await (0, import_provider_utils14.postFormDataToApi)({
|
|
2232
2275
|
url: this.config.url({
|
|
2233
2276
|
path: "/images/edits",
|
|
@@ -2252,14 +2295,17 @@ var OpenAIImageModel = class {
|
|
|
2252
2295
|
)
|
|
2253
2296
|
),
|
|
2254
2297
|
mask: mask != null ? await fileToBlob(mask) : void 0,
|
|
2298
|
+
markup: openaiOptions2.markup != null ? await markupToBlob(openaiOptions2.markup) : void 0,
|
|
2255
2299
|
n,
|
|
2256
2300
|
size,
|
|
2257
2301
|
quality: openaiOptions2.quality,
|
|
2258
2302
|
background: openaiOptions2.background,
|
|
2259
2303
|
output_format: openaiOptions2.outputFormat,
|
|
2260
2304
|
output_compression: openaiOptions2.outputCompression,
|
|
2305
|
+
complexity: openaiOptions2.complexity,
|
|
2261
2306
|
input_fidelity: openaiOptions2.inputFidelity,
|
|
2262
|
-
user: openaiOptions2.user
|
|
2307
|
+
user: openaiOptions2.user,
|
|
2308
|
+
safety_identifier: openaiOptions2.safetyIdentifier
|
|
2263
2309
|
}),
|
|
2264
2310
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2265
2311
|
successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
|
|
@@ -2325,7 +2371,11 @@ var OpenAIImageModel = class {
|
|
|
2325
2371
|
moderation: openaiOptions.moderation,
|
|
2326
2372
|
output_format: openaiOptions.outputFormat,
|
|
2327
2373
|
output_compression: openaiOptions.outputCompression,
|
|
2374
|
+
complexity: openaiOptions.complexity,
|
|
2375
|
+
frame_count: openaiOptions.frameCount,
|
|
2376
|
+
frame_duration_ms: openaiOptions.frameDurationMs,
|
|
2328
2377
|
user: openaiOptions.user,
|
|
2378
|
+
safety_identifier: openaiOptions.safetyIdentifier,
|
|
2329
2379
|
...!hasDefaultResponseFormat(this.modelId) ? { response_format: "b64_json" } : {}
|
|
2330
2380
|
},
|
|
2331
2381
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
@@ -2388,6 +2438,21 @@ function distributeTokenDetails(details, index, total) {
|
|
|
2388
2438
|
}
|
|
2389
2439
|
return result;
|
|
2390
2440
|
}
|
|
2441
|
+
async function markupToBlob(markup) {
|
|
2442
|
+
const dataUrl = /^data:([^;,]*)(;base64)?,(.*)$/s.exec(markup);
|
|
2443
|
+
if (dataUrl == null) {
|
|
2444
|
+
return (0, import_provider_utils14.downloadBlob)(markup);
|
|
2445
|
+
}
|
|
2446
|
+
if (dataUrl[2] == null) {
|
|
2447
|
+
throw new import_provider7.InvalidArgumentError({
|
|
2448
|
+
argument: "providerOptions.openai.markup",
|
|
2449
|
+
message: "`markup` data URLs must be base64 encoded."
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
return new Blob([(0, import_provider_utils14.convertBase64ToUint8Array)(dataUrl[3])], {
|
|
2453
|
+
type: dataUrl[1] || "image/png"
|
|
2454
|
+
});
|
|
2455
|
+
}
|
|
2391
2456
|
async function fileToBlob(file) {
|
|
2392
2457
|
if (!file) return void 0;
|
|
2393
2458
|
if (file.type === "url") {
|
|
@@ -3043,7 +3108,7 @@ var openaiTools = {
|
|
|
3043
3108
|
};
|
|
3044
3109
|
|
|
3045
3110
|
// src/responses/openai-responses-language-model.ts
|
|
3046
|
-
var
|
|
3111
|
+
var import_provider11 = require("@ai-sdk/provider");
|
|
3047
3112
|
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
3048
3113
|
|
|
3049
3114
|
// src/responses/convert-openai-responses-usage.ts
|
|
@@ -3087,7 +3152,7 @@ function convertOpenAIResponsesUsage(usage) {
|
|
|
3087
3152
|
}
|
|
3088
3153
|
|
|
3089
3154
|
// src/responses/convert-to-openai-responses-input.ts
|
|
3090
|
-
var
|
|
3155
|
+
var import_provider9 = require("@ai-sdk/provider");
|
|
3091
3156
|
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
3092
3157
|
var import_v422 = require("zod/v4");
|
|
3093
3158
|
|
|
@@ -3395,7 +3460,7 @@ var openaiResponsesSystemMessageOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
3395
3460
|
);
|
|
3396
3461
|
|
|
3397
3462
|
// src/responses/expand-parallel-tool-call.ts
|
|
3398
|
-
var
|
|
3463
|
+
var import_provider8 = require("@ai-sdk/provider");
|
|
3399
3464
|
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
3400
3465
|
var parallelToolName = "parallel";
|
|
3401
3466
|
var recipientNamePrefix = "functions.";
|
|
@@ -3405,7 +3470,7 @@ function getParallelToolCallMetadata({
|
|
|
3405
3470
|
}) {
|
|
3406
3471
|
var _a2;
|
|
3407
3472
|
const metadata = (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.parallelToolCall;
|
|
3408
|
-
if (!(0,
|
|
3473
|
+
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) {
|
|
3409
3474
|
return void 0;
|
|
3410
3475
|
}
|
|
3411
3476
|
return metadata;
|
|
@@ -3426,7 +3491,7 @@ async function expandParallelToolCall({
|
|
|
3426
3491
|
return void 0;
|
|
3427
3492
|
}
|
|
3428
3493
|
const parsedInput = await (0, import_provider_utils27.safeParseJSON)({ text: toolCall.input });
|
|
3429
|
-
if (!parsedInput.success || !(0,
|
|
3494
|
+
if (!parsedInput.success || !(0, import_provider8.isJSONObject)(parsedInput.value)) {
|
|
3430
3495
|
return void 0;
|
|
3431
3496
|
}
|
|
3432
3497
|
const toolUses = parsedInput.value.tool_uses;
|
|
@@ -3436,12 +3501,12 @@ async function expandParallelToolCall({
|
|
|
3436
3501
|
const availableToolNames = new Set(tools.map((tool) => tool.name));
|
|
3437
3502
|
const expandedToolCalls = [];
|
|
3438
3503
|
for (const [index, toolUse] of toolUses.entries()) {
|
|
3439
|
-
if (!(0,
|
|
3504
|
+
if (!(0, import_provider8.isJSONObject)(toolUse)) {
|
|
3440
3505
|
return void 0;
|
|
3441
3506
|
}
|
|
3442
3507
|
const recipientName = toolUse.recipient_name;
|
|
3443
3508
|
const parameters = toolUse.parameters;
|
|
3444
|
-
if (typeof recipientName !== "string" || !recipientName.startsWith(recipientNamePrefix) || !(0,
|
|
3509
|
+
if (typeof recipientName !== "string" || !recipientName.startsWith(recipientNamePrefix) || !(0, import_provider8.isJSONObject)(parameters)) {
|
|
3445
3510
|
return void 0;
|
|
3446
3511
|
}
|
|
3447
3512
|
const toolName = recipientName.slice(recipientNamePrefix.length);
|
|
@@ -3769,7 +3834,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3769
3834
|
if (effort != null) {
|
|
3770
3835
|
const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
|
|
3771
3836
|
if (unsupportedReason != null) {
|
|
3772
|
-
throw new
|
|
3837
|
+
throw new import_provider9.UnsupportedFunctionalityError({
|
|
3773
3838
|
functionality: "Message-level reasoningEffortUpdate",
|
|
3774
3839
|
message: unsupportedReason
|
|
3775
3840
|
});
|
|
@@ -3881,7 +3946,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3881
3946
|
};
|
|
3882
3947
|
}
|
|
3883
3948
|
if (mediaType !== "application/pdf" && !passThroughUnsupportedFiles) {
|
|
3884
|
-
throw new
|
|
3949
|
+
throw new import_provider9.UnsupportedFunctionalityError({
|
|
3885
3950
|
functionality: `file part media type ${mediaType}`
|
|
3886
3951
|
});
|
|
3887
3952
|
}
|
|
@@ -5496,7 +5561,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils29.lazySchema)(
|
|
|
5496
5561
|
);
|
|
5497
5562
|
|
|
5498
5563
|
// src/responses/openai-responses-prepare-tools.ts
|
|
5499
|
-
var
|
|
5564
|
+
var import_provider10 = require("@ai-sdk/provider");
|
|
5500
5565
|
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
5501
5566
|
async function prepareResponsesTools({
|
|
5502
5567
|
tools,
|
|
@@ -5559,7 +5624,7 @@ async function prepareResponsesTools({
|
|
|
5559
5624
|
namespaceTools.set(namespace.name, namespaceTool);
|
|
5560
5625
|
openaiTools2.push(namespaceTool);
|
|
5561
5626
|
} else if (namespaceTool.description !== namespace.description) {
|
|
5562
|
-
throw new
|
|
5627
|
+
throw new import_provider10.UnsupportedFunctionalityError({
|
|
5563
5628
|
functionality: `conflicting descriptions for OpenAI tool namespace "${namespace.name}"`
|
|
5564
5629
|
});
|
|
5565
5630
|
}
|
|
@@ -5813,7 +5878,7 @@ async function prepareResponsesTools({
|
|
|
5813
5878
|
allowedToolEntries.push(resolution.entry);
|
|
5814
5879
|
}
|
|
5815
5880
|
if (allowedToolEntries.length === 0) {
|
|
5816
|
-
throw new
|
|
5881
|
+
throw new import_provider10.UnsupportedFunctionalityError({
|
|
5817
5882
|
functionality: `allowedTools with only tools that cannot be allow-listed (${droppedToolNames.join(
|
|
5818
5883
|
", "
|
|
5819
5884
|
)})`
|
|
@@ -5848,7 +5913,7 @@ async function prepareResponsesTools({
|
|
|
5848
5913
|
}
|
|
5849
5914
|
default: {
|
|
5850
5915
|
const _exhaustiveCheck = type;
|
|
5851
|
-
throw new
|
|
5916
|
+
throw new import_provider10.UnsupportedFunctionalityError({
|
|
5852
5917
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
5853
5918
|
});
|
|
5854
5919
|
}
|
|
@@ -6156,7 +6221,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6156
6221
|
}
|
|
6157
6222
|
for (let i = 1; i < input.length; i++) {
|
|
6158
6223
|
if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
|
|
6159
|
-
throw new
|
|
6224
|
+
throw new import_provider11.UnsupportedFunctionalityError({
|
|
6160
6225
|
functionality: "Adjacent reasoning effort configuration updates"
|
|
6161
6226
|
});
|
|
6162
6227
|
}
|
|
@@ -6385,7 +6450,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6385
6450
|
fetch: this.config.fetch
|
|
6386
6451
|
});
|
|
6387
6452
|
if (response.error) {
|
|
6388
|
-
throw new
|
|
6453
|
+
throw new import_provider11.APICallError({
|
|
6389
6454
|
message: response.error.message,
|
|
6390
6455
|
url,
|
|
6391
6456
|
requestBodyValues: body,
|
|
@@ -7905,7 +7970,7 @@ function createOpenAIResponsesChatCompletionsMismatchError({
|
|
|
7905
7970
|
requestBodyValues,
|
|
7906
7971
|
responseHeaders
|
|
7907
7972
|
}) {
|
|
7908
|
-
return new
|
|
7973
|
+
return new import_provider11.APICallError({
|
|
7909
7974
|
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.",
|
|
7910
7975
|
url,
|
|
7911
7976
|
requestBodyValues,
|
|
@@ -8373,7 +8438,7 @@ var OpenAITranscriptionModel = class {
|
|
|
8373
8438
|
};
|
|
8374
8439
|
|
|
8375
8440
|
// src/version.ts
|
|
8376
|
-
var VERSION = true ? "3.0.
|
|
8441
|
+
var VERSION = true ? "3.0.137" : "0.0.0-test";
|
|
8377
8442
|
|
|
8378
8443
|
// src/openai-provider.ts
|
|
8379
8444
|
function createOpenAI(options = {}) {
|