fix: map tool_choice 'none' in OpenAI shim

The Anthropic-to-OpenAI tool_choice mapping handled 'auto', 'any', and
'tool' but not 'none'. When 'none' was passed, the request was sent
without tool_choice, defaulting to 'auto' — the opposite of the
intended behavior (disable tool use).

Relates to #30

Co-Authored-By: Juan Camilo <juancamilo.auriti@gmail.com>
This commit is contained in:
Juan Camilo
2026-04-01 15:34:08 +02:00
parent 0192dc0fa0
commit 598f59e546

View File

@@ -630,6 +630,8 @@ class OpenAIShimMessages {
} }
} else if (tc.type === 'any') { } else if (tc.type === 'any') {
body.tool_choice = 'required' body.tool_choice = 'required'
} else if (tc.type === 'none') {
body.tool_choice = 'none'
} }
} }
} }