litellm/tests/unit/llms/chat
shrey kharbanda 428c0337bb
fix(core): reject a bad stream_chunk_size with a 400 before any prompt hook runs
completion() and acompletion() now read LiteLLM's control settings from kwargs
once, before the prompt management hooks run. A stream_chunk_size written as a
string of digits ("64", which is what a quoted YAML value or os.environ/...
produces) is read as that int. Anything else that is not a positive int
("sixty-four", 64.0, True, 0, -1) fails with a 400 naming the param, for every
provider and whether or not the request streams. With drop_params on, per
request or through litellm.drop_params, the bad value is dropped instead and
default chunking applies. Before, only Bedrock streams checked it, 0 was
accepted, and a Router deployment with a bad value reached the provider

control_params_from returns the typed LiteLLMControlParams or an
InvalidControlParam value, and one match in main.py turns the failure into the
400. completion() adds the validated bag to litellm_params under
CONTROL_PARAMS_KEY after get_litellm_params builds them, so a caller cannot
supply its own. control_params_in reads the bag back. The flat
stream_chunk_size key stays until Bedrock reads the bag

Refs LIT-8317
2026-09-26 01:34:54 +00: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_converse_handler.py fix(core): reject a bad stream_chunk_size with a 400 before any prompt hook runs 2026-09-26 01:34:54 +00:00