File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments