litellm/tests/unit/llms/zai
paveln83 4cb8bbf480
fix(zai): accept reasoning_effort so /v1/messages thinking reaches GLM models (#54279)
* fix(zai): accept reasoning_effort and round it up to the levels glm-5.3 takes

* fix(zai): drop a reasoning_effort glm-5.3 cannot take when drop_params is set

* fix(zai): send only the level of a reasoning_effort that carries a summary

* fix(zai): send reasoning off as the weakest level under drop_params and follow the rounding setting

Under drop_params a reasoning_effort of none now goes to glm-5.3 as its weakest declared level, since Z.AI's own default for an omitted level is max. Rounding follows litellm.reasoning_effort_rounding, and each remap is logged at debug level.

* fix(zai): turn thinking off for reasoning_effort none and read each deployment's own levels

reasoning_effort none now goes to Z.AI as thinking disabled unless the caller set thinking itself, a reasoning_effort that names no level drops under drop_params, and zai reads a deployment's own reasoning_effort_levels and reasoning_effort_rounding before the loaded catalog, so one deployment's declaration no longer changes what a sibling of the same model sends

* fix(zai): drop reasoning_effort none on glm-5.3 under drop_params, since it cannot turn thinking off

* fix(zai): read register_model levels, drop disabled thinking on always-thinking models under drop_params, and send no effort for default

* fix(zai): keep disabled thinking unless the model always thinks, match GLM names in any case, and let zai round /v1/messages effort

* fix(zai): drop unknown reasoning_effort strings under drop_params and match registered models in any case

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-25 04:56:45 +00:00
..
__init__.py
test_zai_provider.py fix(zai): accept reasoning_effort so /v1/messages thinking reaches GLM models (#54279) 2026-11-25 04:56:45 +00:00