@ai-sdk/openai 3.0.135 → 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 +17 -0
- package/dist/index.d.mts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +127 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +120 -14
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +13 -2
- package/dist/internal/index.d.ts +13 -2
- package/dist/internal/index.js +126 -28
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +119 -13
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +58 -0
- package/package.json +5 -5
- package/src/chat/convert-to-openai-chat-messages.ts +22 -3
- package/src/image/openai-image-model-options.ts +44 -0
- package/src/image/openai-image-model.ts +44 -4
- package/src/responses/convert-to-openai-responses-input.ts +21 -7
- package/src/transcription/openai-transcription-model.ts +2 -0
- package/src/transcription/openai-transcription-options.ts +12 -0
package/docs/03-openai.mdx
CHANGED
|
@@ -2755,6 +2755,8 @@ const { images } = await generateImage({
|
|
|
2755
2755
|
|
|
2756
2756
|
| Model | Sizes |
|
|
2757
2757
|
| ------------------------ | -------------------------------------- |
|
|
2758
|
+
| `gpt-image-2.6-flare` | Standard presets and custom dimensions |
|
|
2759
|
+
| `gpt-image-2.6-sunburst` | Standard presets and custom dimensions |
|
|
2758
2760
|
| `gpt-image-2.5-flare` | Standard presets and custom dimensions |
|
|
2759
2761
|
| `gpt-image-2.5-sunburst` | Standard presets and custom dimensions |
|
|
2760
2762
|
| `gpt-image-2` | 1024x1024, 1536x1024, 1024x1536 |
|
|
@@ -2802,6 +2804,28 @@ const { image } = await generateImage({
|
|
|
2802
2804
|
});
|
|
2803
2805
|
```
|
|
2804
2806
|
|
|
2807
|
+
The `gpt-image-2.6-flare` and `gpt-image-2.6-sunburst` models support these additional options:
|
|
2808
|
+
|
|
2809
|
+
- **complexity** _'low' | 'medium' | 'high'_ - how much detail the model puts into the image (generation and editing). The API defaults to `high`.
|
|
2810
|
+
- **outputFormat: 'gif'** _(generation only)_ - generates an animated GIF. Use **frameCount** (2-64, API default 9) and **frameDurationMs** (20-2000, API default 200) to control the animation.
|
|
2811
|
+
- **markup** _string_ _(editing only)_ - a transparent PNG (HTTPS URL or base64 data URL) overlaid on the first input image to mark up the regions to change. Supported by `gpt-image-2.5-*` and `gpt-image-2.6-*` models. It cannot be combined with `mask`; providing both throws an error.
|
|
2812
|
+
|
|
2813
|
+
```ts
|
|
2814
|
+
const { image } = await generateImage({
|
|
2815
|
+
model: openai.image('gpt-image-2.6-flare'),
|
|
2816
|
+
prompt: 'A red panda waving hello, flat illustration',
|
|
2817
|
+
providerOptions: {
|
|
2818
|
+
openai: {
|
|
2819
|
+
outputFormat: 'gif',
|
|
2820
|
+
frameCount: 9,
|
|
2821
|
+
frameDurationMs: 200,
|
|
2822
|
+
} satisfies OpenAIImageModelGenerationOptions,
|
|
2823
|
+
},
|
|
2824
|
+
});
|
|
2825
|
+
```
|
|
2826
|
+
|
|
2827
|
+
All image options also accept `safetyIdentifier` (max 128 characters) to help OpenAI detect abuse by your end users.
|
|
2828
|
+
|
|
2805
2829
|
For more on `generateImage()` see [Image Generation](/docs/ai-sdk-core/image-generation).
|
|
2806
2830
|
|
|
2807
2831
|
OpenAI's image models return additional metadata in the response that can be
|
|
@@ -2847,6 +2871,30 @@ const result = await transcribe({
|
|
|
2847
2871
|
});
|
|
2848
2872
|
```
|
|
2849
2873
|
|
|
2874
|
+
For `gpt-transcribe`, use `languages` for expected languages and `keywords` for
|
|
2875
|
+
names, acronyms, and domain vocabulary. These hints are sent as repeated
|
|
2876
|
+
`languages[]` and `keywords[]` multipart fields:
|
|
2877
|
+
|
|
2878
|
+
```ts
|
|
2879
|
+
import { transcribe } from 'ai';
|
|
2880
|
+
import { openai, type OpenAITranscriptionModelOptions } from '@ai-sdk/openai';
|
|
2881
|
+
|
|
2882
|
+
const result = await transcribe({
|
|
2883
|
+
model: openai.transcription('gpt-transcribe'),
|
|
2884
|
+
audio: new Uint8Array([1, 2, 3, 4]),
|
|
2885
|
+
providerOptions: {
|
|
2886
|
+
openai: {
|
|
2887
|
+
languages: ['en', 'fr'],
|
|
2888
|
+
keywords: ['premium plan', 'AC-42'],
|
|
2889
|
+
prompt: 'A customer support call.',
|
|
2890
|
+
} satisfies OpenAITranscriptionModelOptions,
|
|
2891
|
+
},
|
|
2892
|
+
});
|
|
2893
|
+
```
|
|
2894
|
+
|
|
2895
|
+
Use `languages` instead of `language` with `gpt-transcribe`; do not send both.
|
|
2896
|
+
The API validates model support and language codes. These options apply to REST transcription.
|
|
2897
|
+
|
|
2850
2898
|
To get word-level timestamps, specify the granularity:
|
|
2851
2899
|
|
|
2852
2900
|
```ts highlight="8-9"
|
|
@@ -2880,6 +2928,16 @@ The following provider options are available:
|
|
|
2880
2928
|
The language of the input audio. Supplying the input language in ISO-639-1 format (e.g. 'en') will improve accuracy and latency.
|
|
2881
2929
|
Optional.
|
|
2882
2930
|
|
|
2931
|
+
- **languages** _string[]_
|
|
2932
|
+
Expected languages for REST transcription, such as `['en', 'fr']` for `gpt-transcribe`.
|
|
2933
|
+
Use this instead of `language`; do not send both. The API validates model support.
|
|
2934
|
+
Optional.
|
|
2935
|
+
|
|
2936
|
+
- **keywords** _string[]_
|
|
2937
|
+
Vocabulary hints for REST transcription, such as product names, acronyms, or technical terms.
|
|
2938
|
+
Supported by `gpt-transcribe`; the API validates support for other models.
|
|
2939
|
+
Optional.
|
|
2940
|
+
|
|
2883
2941
|
- **prompt** _string_
|
|
2884
2942
|
An optional text to guide the model's style or continue a previous audio segment. The prompt should match the audio language.
|
|
2885
2943
|
Optional.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/openai",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.137",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@ai-sdk/provider
|
|
40
|
-
"@ai-sdk/provider": "
|
|
39
|
+
"@ai-sdk/provider": "3.0.19",
|
|
40
|
+
"@ai-sdk/provider-utils": "4.0.64"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "20.17.24",
|
|
44
44
|
"tsup": "^8",
|
|
45
45
|
"typescript": "5.8.3",
|
|
46
46
|
"zod": "3.25.76",
|
|
47
|
-
"@
|
|
48
|
-
"@ai-
|
|
47
|
+
"@ai-sdk/test-server": "1.0.6",
|
|
48
|
+
"@vercel/ai-tsconfig": "0.0.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"zod": "^3.25.76 || ^4.1.8"
|
|
@@ -5,10 +5,29 @@ import {
|
|
|
5
5
|
type SharedV3ProviderOptions,
|
|
6
6
|
} from '@ai-sdk/provider';
|
|
7
7
|
import type { OpenAIChatPrompt } from './openai-chat-prompt';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
secureJsonParse,
|
|
10
|
+
stringifyWithBigIntAndCycles,
|
|
11
|
+
convertToBase64,
|
|
12
|
+
} from '@ai-sdk/provider-utils';
|
|
9
13
|
|
|
10
14
|
function serializeToolCallArguments(input: unknown): string {
|
|
11
|
-
|
|
15
|
+
if (typeof input === 'string') {
|
|
16
|
+
try {
|
|
17
|
+
const parsed = secureJsonParse(input);
|
|
18
|
+
if (
|
|
19
|
+
typeof parsed !== 'object' ||
|
|
20
|
+
parsed === null ||
|
|
21
|
+
Array.isArray(parsed)
|
|
22
|
+
) {
|
|
23
|
+
return '{}';
|
|
24
|
+
}
|
|
25
|
+
return input;
|
|
26
|
+
} catch {
|
|
27
|
+
return '{}';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return stringifyWithBigIntAndCycles(
|
|
12
31
|
typeof input === 'object' && input !== null && !Array.isArray(input)
|
|
13
32
|
? input
|
|
14
33
|
: {},
|
|
@@ -304,7 +323,7 @@ export function convertToOpenAIChatMessages({
|
|
|
304
323
|
case 'content':
|
|
305
324
|
case 'json':
|
|
306
325
|
case 'error-json':
|
|
307
|
-
contentValue =
|
|
326
|
+
contentValue = stringifyWithBigIntAndCycles(output.value);
|
|
308
327
|
break;
|
|
309
328
|
}
|
|
310
329
|
|
|
@@ -12,6 +12,8 @@ export type OpenAIImageModelId =
|
|
|
12
12
|
| 'gpt-image-1-mini'
|
|
13
13
|
| 'gpt-image-1.5'
|
|
14
14
|
| 'gpt-image-2'
|
|
15
|
+
| 'gpt-image-2.6-flare'
|
|
16
|
+
| 'gpt-image-2.6-sunburst'
|
|
15
17
|
| 'gpt-image-2.5-flare'
|
|
16
18
|
| 'gpt-image-2.5-flare-2026-09-08'
|
|
17
19
|
| 'gpt-image-2.5-sunburst'
|
|
@@ -27,6 +29,8 @@ export const modelMaxImagesPerCall: Record<OpenAIImageModelId, number> = {
|
|
|
27
29
|
'gpt-image-1-mini': 10,
|
|
28
30
|
'gpt-image-1.5': 10,
|
|
29
31
|
'gpt-image-2': 10,
|
|
32
|
+
'gpt-image-2.6-flare': 10,
|
|
33
|
+
'gpt-image-2.6-sunburst': 10,
|
|
30
34
|
'gpt-image-2.5-flare': 10,
|
|
31
35
|
'gpt-image-2.5-flare-2026-09-08': 10,
|
|
32
36
|
'gpt-image-2.5-sunburst': 10,
|
|
@@ -74,6 +78,12 @@ const baseImageModelOptionsObject = () =>
|
|
|
74
78
|
*/
|
|
75
79
|
outputFormat: z.enum(['png', 'jpeg', 'webp']).optional(),
|
|
76
80
|
|
|
81
|
+
/**
|
|
82
|
+
* How much detail the model puts into the image. Supported by GPT Image
|
|
83
|
+
* 2.6 models. The API defaults to `high`.
|
|
84
|
+
*/
|
|
85
|
+
complexity: z.enum(['low', 'medium', 'high']).optional(),
|
|
86
|
+
|
|
77
87
|
/**
|
|
78
88
|
* Compression level (0-100) for the generated image(s). Applies to the
|
|
79
89
|
* `jpeg` and `webp` output formats.
|
|
@@ -85,6 +95,13 @@ const baseImageModelOptionsObject = () =>
|
|
|
85
95
|
* to monitor and detect abuse.
|
|
86
96
|
*/
|
|
87
97
|
user: z.string().optional(),
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* A stable identifier used to help detect users of your application that
|
|
101
|
+
* may be violating OpenAI's usage policies. Should be a hashed username
|
|
102
|
+
* or email address.
|
|
103
|
+
*/
|
|
104
|
+
safetyIdentifier: z.string().max(128).optional(),
|
|
88
105
|
});
|
|
89
106
|
|
|
90
107
|
export const openaiImageModelOptions = lazySchema(() =>
|
|
@@ -105,6 +122,25 @@ export const openaiImageModelGenerationOptions = lazySchema(() =>
|
|
|
105
122
|
*/
|
|
106
123
|
style: z.enum(['vivid', 'natural']).optional(),
|
|
107
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Format in which the generated image(s) are returned. `gif` produces
|
|
127
|
+
* an animated GIF and is supported by GPT Image 2.6 models.
|
|
128
|
+
*/
|
|
129
|
+
outputFormat: z.enum(['png', 'jpeg', 'webp', 'gif']).optional(),
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Number of frames (2-64) of an animated GIF. Only applies to the `gif`
|
|
133
|
+
* output format. The API defaults to 9.
|
|
134
|
+
*/
|
|
135
|
+
frameCount: z.number().int().min(2).max(64).optional(),
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Duration of each frame in milliseconds (20-2000) of an animated GIF.
|
|
139
|
+
* The API rounds it to the nearest 10 ms. Only applies to the `gif`
|
|
140
|
+
* output format. The API defaults to 200.
|
|
141
|
+
*/
|
|
142
|
+
frameDurationMs: z.number().int().min(20).max(2000).optional(),
|
|
143
|
+
|
|
108
144
|
/**
|
|
109
145
|
* Content moderation level for the generated image(s). `low` applies
|
|
110
146
|
* less restrictive filtering.
|
|
@@ -125,6 +161,14 @@ export const openaiImageModelEditOptions = lazySchema(() =>
|
|
|
125
161
|
* Fidelity of the output image(s) to the input image(s).
|
|
126
162
|
*/
|
|
127
163
|
inputFidelity: z.enum(['high', 'low']).optional(),
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* A transparent PNG overlaid on the first input image to mark up the
|
|
167
|
+
* regions to change, as an HTTPS URL or a base64 data URL. It must match
|
|
168
|
+
* the dimensions of the first image. Supported by GPT Image 2.5 and 2.6
|
|
169
|
+
* models. Cannot be combined with a `mask`.
|
|
170
|
+
*/
|
|
171
|
+
markup: z.string().optional(),
|
|
128
172
|
}),
|
|
129
173
|
),
|
|
130
174
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
InvalidArgumentError,
|
|
3
|
+
type ImageModelV3,
|
|
4
|
+
type ImageModelV3File,
|
|
5
|
+
type SharedV3Warning,
|
|
5
6
|
} from '@ai-sdk/provider';
|
|
6
7
|
import {
|
|
7
8
|
combineHeaders,
|
|
@@ -86,6 +87,13 @@ export class OpenAIImageModel implements ImageModelV3 {
|
|
|
86
87
|
schema: openaiImageModelEditOptions,
|
|
87
88
|
})) ?? {};
|
|
88
89
|
|
|
90
|
+
if (mask != null && openaiOptions.markup != null) {
|
|
91
|
+
throw new InvalidArgumentError({
|
|
92
|
+
argument: 'providerOptions.openai.markup',
|
|
93
|
+
message: '`markup` cannot be combined with `mask`.',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
89
97
|
const { value: response, responseHeaders } = await postFormDataToApi({
|
|
90
98
|
url: this.config.url({
|
|
91
99
|
path: '/images/edits',
|
|
@@ -114,14 +122,20 @@ export class OpenAIImageModel implements ImageModelV3 {
|
|
|
114
122
|
),
|
|
115
123
|
),
|
|
116
124
|
mask: mask != null ? await fileToBlob(mask) : undefined,
|
|
125
|
+
markup:
|
|
126
|
+
openaiOptions.markup != null
|
|
127
|
+
? await markupToBlob(openaiOptions.markup)
|
|
128
|
+
: undefined,
|
|
117
129
|
n,
|
|
118
130
|
size,
|
|
119
131
|
quality: openaiOptions.quality,
|
|
120
132
|
background: openaiOptions.background,
|
|
121
133
|
output_format: openaiOptions.outputFormat,
|
|
122
134
|
output_compression: openaiOptions.outputCompression,
|
|
135
|
+
complexity: openaiOptions.complexity,
|
|
123
136
|
input_fidelity: openaiOptions.inputFidelity,
|
|
124
137
|
user: openaiOptions.user,
|
|
138
|
+
safety_identifier: openaiOptions.safetyIdentifier,
|
|
125
139
|
}),
|
|
126
140
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
127
141
|
successfulResponseHandler: createJsonResponseHandler(
|
|
@@ -193,7 +207,11 @@ export class OpenAIImageModel implements ImageModelV3 {
|
|
|
193
207
|
moderation: openaiOptions.moderation,
|
|
194
208
|
output_format: openaiOptions.outputFormat,
|
|
195
209
|
output_compression: openaiOptions.outputCompression,
|
|
210
|
+
complexity: openaiOptions.complexity,
|
|
211
|
+
frame_count: openaiOptions.frameCount,
|
|
212
|
+
frame_duration_ms: openaiOptions.frameDurationMs,
|
|
196
213
|
user: openaiOptions.user,
|
|
214
|
+
safety_identifier: openaiOptions.safetyIdentifier,
|
|
197
215
|
...(!hasDefaultResponseFormat(this.modelId)
|
|
198
216
|
? { response_format: 'b64_json' }
|
|
199
217
|
: {}),
|
|
@@ -284,16 +302,38 @@ type OpenAIImageEditInput = {
|
|
|
284
302
|
prompt?: string;
|
|
285
303
|
image: Blob | Blob[];
|
|
286
304
|
mask?: Blob;
|
|
305
|
+
markup?: Blob;
|
|
287
306
|
n?: number;
|
|
288
307
|
size?: `${number}x${number}`;
|
|
289
308
|
quality?: OpenAIImageModelEditOptions['quality'];
|
|
290
309
|
background?: OpenAIImageModelEditOptions['background'];
|
|
291
310
|
output_format?: OpenAIImageModelEditOptions['outputFormat'];
|
|
292
311
|
output_compression?: OpenAIImageModelEditOptions['outputCompression'];
|
|
312
|
+
complexity?: OpenAIImageModelEditOptions['complexity'];
|
|
293
313
|
input_fidelity?: OpenAIImageModelEditOptions['inputFidelity'];
|
|
294
314
|
user?: OpenAIImageModelEditOptions['user'];
|
|
315
|
+
safety_identifier?: OpenAIImageModelEditOptions['safetyIdentifier'];
|
|
295
316
|
};
|
|
296
317
|
|
|
318
|
+
async function markupToBlob(markup: string): Promise<Blob> {
|
|
319
|
+
const dataUrl = /^data:([^;,]*)(;base64)?,(.*)$/s.exec(markup);
|
|
320
|
+
|
|
321
|
+
if (dataUrl == null) {
|
|
322
|
+
return downloadBlob(markup);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (dataUrl[2] == null) {
|
|
326
|
+
throw new InvalidArgumentError({
|
|
327
|
+
argument: 'providerOptions.openai.markup',
|
|
328
|
+
message: '`markup` data URLs must be base64 encoded.',
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return new Blob([convertBase64ToUint8Array(dataUrl[3]) as BlobPart], {
|
|
333
|
+
type: dataUrl[1] || 'image/png',
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
297
337
|
async function fileToBlob(
|
|
298
338
|
file: ImageModelV3File | undefined,
|
|
299
339
|
): Promise<Blob | undefined> {
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
type SharedV3Warning,
|
|
9
9
|
} from '@ai-sdk/provider';
|
|
10
10
|
import {
|
|
11
|
+
secureJsonParse,
|
|
12
|
+
stringifyWithBigIntAndCycles,
|
|
11
13
|
lazySchema,
|
|
12
14
|
zodSchema,
|
|
13
15
|
type InferSchema,
|
|
@@ -49,7 +51,15 @@ import {
|
|
|
49
51
|
} from './expand-parallel-tool-call';
|
|
50
52
|
|
|
51
53
|
function serializeToolCallArguments(input: unknown): string {
|
|
52
|
-
|
|
54
|
+
if (typeof input === 'string') {
|
|
55
|
+
try {
|
|
56
|
+
secureJsonParse(input);
|
|
57
|
+
return input;
|
|
58
|
+
} catch {
|
|
59
|
+
return stringifyWithBigIntAndCycles(input);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return stringifyWithBigIntAndCycles(input === undefined ? {} : input);
|
|
53
63
|
}
|
|
54
64
|
|
|
55
65
|
async function convertWebSearchToolResultOutput({
|
|
@@ -146,7 +156,7 @@ async function convertFunctionToolResultOutput({
|
|
|
146
156
|
}
|
|
147
157
|
case 'json':
|
|
148
158
|
case 'error-json':
|
|
149
|
-
return convertScalarOutput(
|
|
159
|
+
return convertScalarOutput(stringifyWithBigIntAndCycles(output.value));
|
|
150
160
|
case 'content':
|
|
151
161
|
return output.value
|
|
152
162
|
.map(item => {
|
|
@@ -901,7 +911,7 @@ export async function convertToOpenAIResponsesInput({
|
|
|
901
911
|
input:
|
|
902
912
|
typeof part.input === 'string'
|
|
903
913
|
? part.input
|
|
904
|
-
:
|
|
914
|
+
: stringifyWithBigIntAndCycles(part.input),
|
|
905
915
|
...(isAsync != null && { async: isAsync }),
|
|
906
916
|
id,
|
|
907
917
|
});
|
|
@@ -1101,7 +1111,7 @@ export async function convertToOpenAIResponsesInput({
|
|
|
1101
1111
|
} else if (reasoningMessage !== undefined) {
|
|
1102
1112
|
warnings.push({
|
|
1103
1113
|
type: 'other',
|
|
1104
|
-
message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${
|
|
1114
|
+
message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${stringifyWithBigIntAndCycles(part)}.`,
|
|
1105
1115
|
});
|
|
1106
1116
|
}
|
|
1107
1117
|
|
|
@@ -1152,7 +1162,7 @@ export async function convertToOpenAIResponsesInput({
|
|
|
1152
1162
|
} else {
|
|
1153
1163
|
warnings.push({
|
|
1154
1164
|
type: 'other',
|
|
1155
|
-
message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${
|
|
1165
|
+
message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${stringifyWithBigIntAndCycles(part)}.`,
|
|
1156
1166
|
});
|
|
1157
1167
|
}
|
|
1158
1168
|
}
|
|
@@ -1238,7 +1248,9 @@ export async function convertToOpenAIResponsesInput({
|
|
|
1238
1248
|
}),
|
|
1239
1249
|
);
|
|
1240
1250
|
const serializedToolOutputs = toolOutputs.map(({ output }) =>
|
|
1241
|
-
typeof output === 'string'
|
|
1251
|
+
typeof output === 'string'
|
|
1252
|
+
? output
|
|
1253
|
+
: stringifyWithBigIntAndCycles(output),
|
|
1242
1254
|
);
|
|
1243
1255
|
const hasPromptCacheBreakpoint = toolOutputs.some(
|
|
1244
1256
|
({ promptCacheBreakpoint }) => promptCacheBreakpoint != null,
|
|
@@ -1394,7 +1406,9 @@ export async function convertToOpenAIResponsesInput({
|
|
|
1394
1406
|
break;
|
|
1395
1407
|
case 'json':
|
|
1396
1408
|
case 'error-json':
|
|
1397
|
-
outputValue = convertScalarOutput(
|
|
1409
|
+
outputValue = convertScalarOutput(
|
|
1410
|
+
stringifyWithBigIntAndCycles(output.value),
|
|
1411
|
+
);
|
|
1398
1412
|
break;
|
|
1399
1413
|
case 'content':
|
|
1400
1414
|
outputValue = output.value
|
|
@@ -142,6 +142,8 @@ export class OpenAITranscriptionModel implements TranscriptionModelV3 {
|
|
|
142
142
|
const transcriptionModelOptions = {
|
|
143
143
|
include: openAIOptions.include,
|
|
144
144
|
language: openAIOptions.language,
|
|
145
|
+
languages: openAIOptions.languages,
|
|
146
|
+
keywords: openAIOptions.keywords,
|
|
145
147
|
prompt: openAIOptions.prompt,
|
|
146
148
|
// https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
|
|
147
149
|
// prefer verbose_json to get segments for models that support it
|
|
@@ -29,6 +29,18 @@ export const openAITranscriptionModelOptions = lazySchema(() =>
|
|
|
29
29
|
*/
|
|
30
30
|
language: z.string().optional(),
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Expected languages for REST transcription, e.g. with gpt-transcribe.
|
|
34
|
+
* Use this instead of language. The API validates model support.
|
|
35
|
+
*/
|
|
36
|
+
languages: z.array(z.string()).optional(),
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Vocabulary hints for REST transcription, e.g. names or technical terms.
|
|
40
|
+
* The API validates model support.
|
|
41
|
+
*/
|
|
42
|
+
keywords: z.array(z.string()).optional(),
|
|
43
|
+
|
|
32
44
|
/**
|
|
33
45
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
34
46
|
*/
|