litellm/tests/unit/llms/moonshot
kenneth-berri 14964b9def
fix(moonshot): send Kimi K3 a tool_choice it accepts (#56335)
* fix(moonshot): send Kimi K3 a tool_choice it accepts

Kimi K3 takes tool_choice="required", so it is sent as is and the extra
"Please select a tool" user message is no longer added for K3, on Moonshot's
API and on Bedrock invoke. Moonshot's API rejects a named tool_choice on K3
while thinking is on, so that call is forced by offering only the named tool
with "required". Models before K3 and callers that turned thinking off keep
today's request.

Fixes #55761

Co-authored-by: Chaitanya Deshpande <dcchaitanyadeshpande@gmail.com>

* refactor(moonshot): build the K3 request params without casts or rebinding

* refactor(moonshot): validate the tool params instead of narrowing untyped values

---------

Co-authored-by: Chaitanya Deshpande <dcchaitanyadeshpande@gmail.com>
2026-12-04 14:30:14 -08:00
..
__init__.py test(unit): make every tests/unit directory a package so pytest collection is unique 2026-09-20 11:50:59 +00:00
test_moonshot_chat_transformation.py fix(moonshot): send Kimi K3 a tool_choice it accepts (#56335) 2026-12-04 14:30:14 -08:00