@ai-sdk/openai 3.0.132 → 3.0.134
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 +14 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -12
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +233 -217
- package/dist/internal/index.d.ts +233 -217
- package/dist/internal/index.js +26 -11
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +25 -11
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +4 -3
- package/package.json +3 -3
- package/src/chat/openai-chat-options.ts +1 -0
- package/src/openai-language-model-capabilities.ts +5 -2
- package/src/responses/openai-responses-language-model.ts +16 -2
- package/src/responses/openai-responses-options.ts +2 -0
- package/src/transcription/openai-transcription-api.ts +8 -0
- package/src/transcription/openai-transcription-model.ts +16 -7
package/docs/03-openai.mdx
CHANGED
|
@@ -206,9 +206,9 @@ The following provider options are available:
|
|
|
206
206
|
Reasoning effort for reasoning models. Defaults to `medium`. If you use `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
207
207
|
|
|
208
208
|
<Note>
|
|
209
|
-
Supported reasoning efforts vary by model. GPT-5.6, GPT-6 Sol,
|
|
210
|
-
support `'none'`, `'low'`, `'medium'`, `'high'`, `'xhigh'`, and
|
|
211
|
-
Astra and GPT-6.1 Sol do not support `'none'`.
|
|
209
|
+
Supported reasoning efforts vary by model. GPT-5.6, GPT-6 Sol, GPT-6 Luna, and
|
|
210
|
+
GPT-6.1 Terra support `'none'`, `'low'`, `'medium'`, `'high'`, `'xhigh'`, and
|
|
211
|
+
`'max'`. GPT-6 Astra and GPT-6.1 Sol do not support `'none'`.
|
|
212
212
|
</Note>
|
|
213
213
|
|
|
214
214
|
<Note>
|
|
@@ -2562,6 +2562,7 @@ The following optional provider options are available for OpenAI completion mode
|
|
|
2562
2562
|
| --------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
|
|
2563
2563
|
| `gpt-6-astra` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2564
2564
|
| `gpt-6.1-sol` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2565
|
+
| `gpt-6.1-terra` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2565
2566
|
| `gpt-6-luna` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2566
2567
|
| `gpt-6-sol` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2567
2568
|
| `gpt-5.6` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/openai",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.134",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,8 +36,8 @@
|
|
|
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.62"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "20.17.24",
|
|
@@ -24,7 +24,10 @@ export function getOpenAILanguageModelCapabilities(
|
|
|
24
24
|
const isGptNanoModel = gptVersion?.variant?.startsWith('nano') ?? false;
|
|
25
25
|
const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const isGpt6OrLaterModelWithNoneEffort =
|
|
28
|
+
modelId === 'gpt-6-sol' ||
|
|
29
|
+
modelId === 'gpt-6-luna' ||
|
|
30
|
+
modelId === 'gpt-6.1-terra';
|
|
28
31
|
|
|
29
32
|
const supportsFlexProcessing =
|
|
30
33
|
(oSeriesVersion != null && oSeriesVersion >= 3) ||
|
|
@@ -59,7 +62,7 @@ export function getOpenAILanguageModelCapabilities(
|
|
|
59
62
|
supportsPriorityProcessing,
|
|
60
63
|
supportsConfigurationUpdate: isGpt6OrLaterModel,
|
|
61
64
|
supportsAsyncToolCalling: isGpt6OrLaterModel,
|
|
62
|
-
supportedReasoningEfforts:
|
|
65
|
+
supportedReasoningEfforts: isGpt6OrLaterModelWithNoneEffort
|
|
63
66
|
? ['none', 'low', 'medium', 'high', 'xhigh', 'max']
|
|
64
67
|
: isGpt6OrLaterModel
|
|
65
68
|
? ['low', 'medium', 'high', 'xhigh', 'max']
|
|
@@ -1009,7 +1009,7 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV3 {
|
|
|
1009
1009
|
toolName: toolNameMapping.toCustomToolName(
|
|
1010
1010
|
webSearchToolName ?? 'web_search',
|
|
1011
1011
|
),
|
|
1012
|
-
|
|
1012
|
+
...mapWebSearchResult(part),
|
|
1013
1013
|
});
|
|
1014
1014
|
|
|
1015
1015
|
break;
|
|
@@ -1772,7 +1772,7 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV3 {
|
|
|
1772
1772
|
toolName: toolNameMapping.toCustomToolName(
|
|
1773
1773
|
webSearchToolName ?? 'web_search',
|
|
1774
1774
|
),
|
|
1775
|
-
|
|
1775
|
+
...mapWebSearchResult(value.item),
|
|
1776
1776
|
});
|
|
1777
1777
|
} else if (value.item.type === 'computer_call') {
|
|
1778
1778
|
ongoingToolCalls[value.output_index] = undefined;
|
|
@@ -2678,6 +2678,20 @@ function isResponseOutputChunk(chunk: OpenAIResponsesChunk): boolean {
|
|
|
2678
2678
|
);
|
|
2679
2679
|
}
|
|
2680
2680
|
|
|
2681
|
+
export function mapWebSearchResult({
|
|
2682
|
+
action,
|
|
2683
|
+
status,
|
|
2684
|
+
}: {
|
|
2685
|
+
action?: OpenAIResponsesWebSearchAction | null;
|
|
2686
|
+
status: string;
|
|
2687
|
+
}):
|
|
2688
|
+
| { isError: true; result: { status: string } }
|
|
2689
|
+
| { result: InferSchema<typeof webSearchOutputSchema> } {
|
|
2690
|
+
return status === 'completed'
|
|
2691
|
+
? { result: mapWebSearchOutput(action) }
|
|
2692
|
+
: { isError: true, result: { status } };
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2681
2695
|
function mapWebSearchOutput(
|
|
2682
2696
|
action: OpenAIResponsesWebSearchAction | null | undefined,
|
|
2683
2697
|
): InferSchema<typeof webSearchOutputSchema> {
|
|
@@ -59,6 +59,7 @@ export const openaiResponsesReasoningModelIds = [
|
|
|
59
59
|
'gpt-5.6-terra',
|
|
60
60
|
'gpt-6-astra',
|
|
61
61
|
'gpt-6.1-sol',
|
|
62
|
+
'gpt-6.1-terra',
|
|
62
63
|
'gpt-6-luna',
|
|
63
64
|
'gpt-6-sol',
|
|
64
65
|
] as const;
|
|
@@ -135,6 +136,7 @@ export type OpenAIResponsesModelId =
|
|
|
135
136
|
| 'gpt-5.6-terra'
|
|
136
137
|
| 'gpt-6-astra'
|
|
137
138
|
| 'gpt-6.1-sol'
|
|
139
|
+
| 'gpt-6.1-terra'
|
|
138
140
|
| 'gpt-6-luna'
|
|
139
141
|
| 'gpt-6-sol'
|
|
140
142
|
| 'gpt-5-2025-08-07'
|
|
@@ -32,6 +32,14 @@ export const openaiTranscriptionResponseSchema = lazySchema(() =>
|
|
|
32
32
|
}),
|
|
33
33
|
)
|
|
34
34
|
.nullish(),
|
|
35
|
+
// Lenient: an unexpected usage shape must not fail the transcription.
|
|
36
|
+
usage: z
|
|
37
|
+
.object({
|
|
38
|
+
type: z.string().nullish(),
|
|
39
|
+
seconds: z.number().nullish(),
|
|
40
|
+
})
|
|
41
|
+
.nullish()
|
|
42
|
+
.catch(undefined),
|
|
35
43
|
}),
|
|
36
44
|
),
|
|
37
45
|
);
|
|
@@ -145,12 +145,16 @@ export class OpenAITranscriptionModel implements TranscriptionModelV3 {
|
|
|
145
145
|
prompt: openAIOptions.prompt,
|
|
146
146
|
// https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
|
|
147
147
|
// prefer verbose_json to get segments for models that support it
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
'gpt-4o-mini-transcribe'
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
// gpt-4o(-mini)-transcribe (incl. snapshots) and gpt-transcribe reject verbose_json:
|
|
149
|
+
response_format:
|
|
150
|
+
['gpt-4o-transcribe', 'gpt-4o-mini-transcribe'].includes(
|
|
151
|
+
this.modelId,
|
|
152
|
+
) ||
|
|
153
|
+
this.modelId.startsWith('gpt-4o-mini-transcribe-') ||
|
|
154
|
+
this.modelId === 'gpt-transcribe' ||
|
|
155
|
+
this.modelId.startsWith('gpt-transcribe-')
|
|
156
|
+
? 'json'
|
|
157
|
+
: 'verbose_json',
|
|
154
158
|
temperature: openAIOptions.temperature,
|
|
155
159
|
timestamp_granularities: openAIOptions.timestampGranularities,
|
|
156
160
|
};
|
|
@@ -219,7 +223,12 @@ export class OpenAITranscriptionModel implements TranscriptionModelV3 {
|
|
|
219
223
|
})) ??
|
|
220
224
|
[],
|
|
221
225
|
language,
|
|
222
|
-
|
|
226
|
+
// Duration-billed json responses report the duration only in `usage`:
|
|
227
|
+
durationInSeconds:
|
|
228
|
+
response.duration ??
|
|
229
|
+
(response.usage?.type === 'duration'
|
|
230
|
+
? (response.usage.seconds ?? undefined)
|
|
231
|
+
: undefined),
|
|
223
232
|
warnings,
|
|
224
233
|
response: {
|
|
225
234
|
timestamp: currentDate,
|