Skip to content

Commit 7daafe3

Browse files
committed
Update reasoning field to be reasoning_effort
1 parent 2c16e3f commit 7daafe3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

web/src/llm-api/openai.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ export async function handleOpenAIStream({
110110
openaiBody.max_completion_tokens ?? openaiBody.max_tokens
111111
delete (openaiBody as any).max_tokens
112112

113+
// Transform reasoning to reasoning_effort
114+
if (openaiBody.reasoning && typeof openaiBody.reasoning === 'object') {
115+
const reasoning = openaiBody.reasoning as {
116+
enabled?: boolean
117+
effort?: 'high' | 'medium' | 'low'
118+
}
119+
const enabled = reasoning.enabled ?? true
120+
121+
if (enabled) {
122+
openaiBody.reasoning_effort = reasoning.effort ?? 'medium'
123+
}
124+
}
125+
delete (openaiBody as any).reasoning
126+
113127
// Remove fields that OpenAI doesn't support
114128
delete (openaiBody as any).stop
115129
delete (openaiBody as any).usage

0 commit comments

Comments
 (0)