@ai-sdk/openai 4.0.0-beta.12 → 4.0.0-beta.13
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 +9 -0
- package/dist/index.js +26 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -22
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +25 -21
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +27 -21
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/chat/openai-chat-language-model.ts +10 -2
- package/src/responses/openai-responses-language-model.ts +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/openai",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.13",
|
|
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": "4.0.0-beta.
|
|
40
|
-
"@ai-sdk/provider-utils": "5.0.0-beta.
|
|
39
|
+
"@ai-sdk/provider": "4.0.0-beta.4",
|
|
40
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.6"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "20.17.24",
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
createEventSourceResponseHandler,
|
|
18
18
|
createJsonResponseHandler,
|
|
19
19
|
generateId,
|
|
20
|
+
isCustomReasoning,
|
|
20
21
|
isParsableJson,
|
|
21
22
|
parseProviderOptions,
|
|
22
23
|
postJsonToApi,
|
|
@@ -81,6 +82,7 @@ export class OpenAIChatLanguageModel implements LanguageModelV4 {
|
|
|
81
82
|
seed,
|
|
82
83
|
tools,
|
|
83
84
|
toolChoice,
|
|
85
|
+
reasoning,
|
|
84
86
|
providerOptions,
|
|
85
87
|
}: LanguageModelV4CallOptions) {
|
|
86
88
|
const warnings: SharedV4Warning[] = [];
|
|
@@ -94,6 +96,12 @@ export class OpenAIChatLanguageModel implements LanguageModelV4 {
|
|
|
94
96
|
})) ?? {};
|
|
95
97
|
|
|
96
98
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
99
|
+
|
|
100
|
+
// AI SDK reasoning values map directly to the OpenAI reasoning values.
|
|
101
|
+
const resolvedReasoningEffort =
|
|
102
|
+
openaiOptions.reasoningEffort ??
|
|
103
|
+
(isCustomReasoning(reasoning) ? reasoning : undefined);
|
|
104
|
+
|
|
97
105
|
const isReasoningModel =
|
|
98
106
|
openaiOptions.forceReasoning ?? modelCapabilities.isReasoningModel;
|
|
99
107
|
|
|
@@ -168,7 +176,7 @@ export class OpenAIChatLanguageModel implements LanguageModelV4 {
|
|
|
168
176
|
store: openaiOptions.store,
|
|
169
177
|
metadata: openaiOptions.metadata,
|
|
170
178
|
prediction: openaiOptions.prediction,
|
|
171
|
-
reasoning_effort:
|
|
179
|
+
reasoning_effort: resolvedReasoningEffort,
|
|
172
180
|
service_tier: openaiOptions.serviceTier,
|
|
173
181
|
prompt_cache_key: openaiOptions.promptCacheKey,
|
|
174
182
|
prompt_cache_retention: openaiOptions.promptCacheRetention,
|
|
@@ -184,7 +192,7 @@ export class OpenAIChatLanguageModel implements LanguageModelV4 {
|
|
|
184
192
|
// when reasoning effort is none, gpt-5.1 models allow temperature, topP, logprobs
|
|
185
193
|
// https://platform.openai.com/docs/guides/latest-model#gpt-5-1-parameter-compatibility
|
|
186
194
|
if (
|
|
187
|
-
|
|
195
|
+
resolvedReasoningEffort !== 'none' ||
|
|
188
196
|
!modelCapabilities.supportsNonReasoningParameters
|
|
189
197
|
) {
|
|
190
198
|
if (baseArgs.temperature != null) {
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
createToolNameMapping,
|
|
22
22
|
generateId,
|
|
23
23
|
InferSchema,
|
|
24
|
+
isCustomReasoning,
|
|
24
25
|
parseProviderOptions,
|
|
25
26
|
ParseResult,
|
|
26
27
|
postJsonToApi,
|
|
@@ -130,6 +131,7 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
|
|
|
130
131
|
frequencyPenalty,
|
|
131
132
|
seed,
|
|
132
133
|
prompt,
|
|
134
|
+
reasoning,
|
|
133
135
|
providerOptions,
|
|
134
136
|
tools,
|
|
135
137
|
toolChoice,
|
|
@@ -175,6 +177,10 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
|
|
|
175
177
|
});
|
|
176
178
|
}
|
|
177
179
|
|
|
180
|
+
const resolvedReasoningEffort =
|
|
181
|
+
openaiOptions?.reasoningEffort ??
|
|
182
|
+
(isCustomReasoning(reasoning) ? reasoning : undefined);
|
|
183
|
+
|
|
178
184
|
const isReasoningModel =
|
|
179
185
|
openaiOptions?.forceReasoning ?? modelCapabilities.isReasoningModel;
|
|
180
186
|
|
|
@@ -348,11 +354,11 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
|
|
|
348
354
|
|
|
349
355
|
// model-specific settings:
|
|
350
356
|
...(isReasoningModel &&
|
|
351
|
-
(
|
|
357
|
+
(resolvedReasoningEffort != null ||
|
|
352
358
|
openaiOptions?.reasoningSummary != null) && {
|
|
353
359
|
reasoning: {
|
|
354
|
-
...(
|
|
355
|
-
effort:
|
|
360
|
+
...(resolvedReasoningEffort != null && {
|
|
361
|
+
effort: resolvedReasoningEffort,
|
|
356
362
|
}),
|
|
357
363
|
...(openaiOptions?.reasoningSummary != null && {
|
|
358
364
|
summary: openaiOptions.reasoningSummary,
|
|
@@ -368,7 +374,7 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
|
|
|
368
374
|
// https://platform.openai.com/docs/guides/latest-model#gpt-5-1-parameter-compatibility
|
|
369
375
|
if (
|
|
370
376
|
!(
|
|
371
|
-
|
|
377
|
+
resolvedReasoningEffort === 'none' &&
|
|
372
378
|
modelCapabilities.supportsNonReasoningParameters
|
|
373
379
|
)
|
|
374
380
|
) {
|