litellm/tests/unit/llms/bedrock/chat
zoveki ebf4991f75
fix(gateway): serve messages drop, summary and timeout settings like Python (#51236)
* fix(gateway): fill messages settings from LITELLM_DROP_PARAMS, the request, and litellm_settings

* fix(gateway): honor a deployment's timeout over request_timeout on messages, read numeric settings flags, and delete drop paths in place

* feat(gateway): honor request drop_params, additional_drop_params, reasoning_auto_summary and request_timeout on /v1/messages

The standalone gateway answered 501 for a request's drop_params and
additional_drop_params, a deployment's additional_drop_params, and
litellm_settings.reasoning_auto_summary and request_timeout. It now reads
each the way the Python proxy does and keeps sending to Python only the
corners where the two would differ. The unsupported-param 400 hint now
also names the proxy config key.

* perf(core-utils): delete additional_drop_params paths in place

delete_nested_value rebuilt every object along a path, so each path cost
the width of the widest map it crossed. A request can now set its own
additional_drop_params on the native /v1/messages route, and 10,000 absent
paths over a 10,000-property tool schema took about 50 seconds. Paths are
now removed in place, an absent key costs one lookup, and key order is kept.

* fix(gateway): read request_timeout where Python does, answer timeouts 408, and drop paths in one pass

The Python lane's sampling and speed 400 hints also name the proxy config key

* fix(gateway): drop overlapping paths in one visit and share the drop hint across Anthropic and Bedrock errors

* fix(gateway): read REQUEST_TIMEOUT only from the process environment

Python reads REQUEST_TIMEOUT once when litellm is imported, before the proxy
exports the config's environment_variables, so a timeout the config exports
never applies there. The gateway now reads it from its own process
environment alone, so such a config no longer times out calls Python serves

* fix(core-utils): walk drop paths without building a tree, so a deep path cannot overflow the stack

* fix(core-utils): read each drop path segment once, so a long path under [*] cannot stall a request

The walk read the rest of every path again at each list element, so one path with a long field name under [*] hashed that name once per element. Paths now grow a tree only as deep as the body goes, with each field name numbered once and each object matched from its smaller side.

* fix(core-utils): cap the drop path routes that reach one value, so overlapping paths cannot stall a request

Paths mixing [*] and index steps reach one value through one node per distinct run, and that count
doubles with every level, so 65,536 overlapping paths over 100,000 list elements held a worker past
120s. At most 64 nodes may now reach one value, and past that the call answers 400 naming
additional_drop_params. A list also reads whichever is smaller now, its named indexes or its elements

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-25 09:26:12 +00:00
..
agentcore fix(streaming)!: fail a stream that ends without a finish reason (#47665) 2026-10-31 11:29:26 -07:00
chat_completions fix(bedrock): preserve native chat content cache checkpoints (#53322) (#53370) 2026-11-21 12:15:03 -08:00
invoke_transformations fix(anthropic)!: send extra_body fields at the top level of the Messages request (#48373) 2026-11-20 06:52:56 -08:00
mantle fix(anthropic)!: send extra_body fields at the top level of the Messages request (#48373) 2026-11-20 06:52:56 -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_bedrock_converse_handler.py fix(bedrock): send native chat and Responses calls to aws_bedrock_runtime_endpoint like Converse (#50582) 2026-11-19 16:40:23 -08:00
test_bedrock_gpt_oss.py test: move the unit half of 126 mixed legacy files into tests/unit (#45090) 2026-10-07 14:07:43 -07:00
test_converse_transformation.py fix(gateway): serve messages drop, summary and timeout settings like Python (#51236) 2026-11-25 09:26:12 +00:00
test_converse_transformation_nova_2.py fix(bedrock): drop another model's signed thinking when replaying to a non-Claude Converse target (#50073) 2026-11-06 03:15:49 -08:00
test_invoke_handler.py fix(sagemaker,bedrock): answer 502 when a 200 AWS event stream decodes to no events or ends mid-frame (#53482) 2026-11-22 23:59:32 +00:00
test_mistral_config.py test: migrate tests/llm_translation into unit, integration and e2e tiers (#45759) 2026-10-11 07:58:53 +00:00
test_native_output_fallback.py feat(bedrock): default to native structured output on Opus 5.5, Fable 5.1, Sonnet 5 and Haiku 5.5 (#50221) 2026-11-06 09:38:00 -08:00
test_service_tier.py fix(gateway): serve messages drop, summary and timeout settings like Python (#51236) 2026-11-25 09:26:12 +00:00
test_streaming_choice_index.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
test_tool_result_images.py fix(bedrock): keep GPT tool-result images beside the tool result (#45579) 2026-10-09 18:02:23 -07:00
test_tool_use_ids.py fix(mistral): map tool call ids to Mistral's 9-char shape on Vertex AI and Bedrock (#53416) 2026-11-22 21:48:55 +00:00
test_writer_palmyra.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00