litellm/tests/unit/router_utils/pre_call_checks
paveln83 dbe537157f
fix(logging): log Anthropic base64 sources on /v1/messages and pass-through routes as a size placeholder (#54161)
* fix(logging): log an Anthropic base64 source as a size placeholder

* fix(router): keep Anthropic base64 sources whole in the prompt caching affinity key

Two different same-size base64 documents hashed to one key once logging replaced source data with a size placeholder, so they shared one deployment pin. The router key now shortens only data URIs and hashes base64 source data whole, as before

* test(router): pin same-size base64 documents at their raw source key

Adds a router-level regression test that sends two different same-size
base64 PDFs through prompt caching routing, checks each one pins and keeps
its own deployment, and checks every logged copy holds the size placeholder.
Also updates the MAX_BASE64_LENGTH_FOR_LOGGING comment to name Anthropic
base64 source data

* fix(pass-through): log Anthropic base64 sources in pass-through request logs as a size placeholder

* test(logging): type the Anthropic base64 source test helper

* fix(pass-through): copy the logged request body off the event loop for large payloads

* chore(constants): drop the base64 logging comment line that restated the behavior

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-24 12:13:09 -08:00
..
__init__.py test: add __init__.py to new tests/unit packages 2026-09-20 12:36:13 +00:00
test_continuation_prefill_check.py fix(router): continue Responses mid-stream fallbacks on models without assistant prefill (#47672) 2026-10-28 04:34:40 -07:00
test_deployment_affinity_check.py feat(redis): serve the router's session pins from a native store (#50870) 2026-11-13 03:22:28 +00:00
test_encrypted_content_affinity_check.py feat(redis): serve the router's session pins from a native store (#50870) 2026-11-13 03:22:28 +00:00
test_prompt_caching_deployment_check.py fix(logging): log Anthropic base64 sources on /v1/messages and pass-through routes as a size placeholder (#54161) 2026-11-24 12:13:09 -08:00
test_responses_api_deployment_check.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
test_session_id_affinity.py feat(router): select conversation headers for session affinity (#52193) 2026-11-16 21:37:48 -08:00