litellm/tests/unit/router_utils
Julien Parenti d9b88ad3d8
fix(ocr): report an unreachable document URL as a 400, not a provider 500 (#54215)
* fix(ocr): report an unreachable document URL as a 400, not a provider 500

A refused, unresolvable or dropped download of the caller's document_url
had no status, so the proxy reported a 500 naming the provider even
though the provider was never called. Classify it like the existing
download status passthrough, as the caller's 400.

* fix(ocr): keep the download cause in the 400 and retry dropped downloads

Media host failures (DNS, transport, a redirect without a usable Location)
are now request faults in litellm-http, so the OCR bridge answers 400 with
the cause chain instead of a fixed message. A transport failure gets up to
three attempts inside the one download deadline, like Python's media fetch,
since the router no longer retries the 400

* fix(ocr): wait between download retries and retry failed lookups, not connect timeouts

* fix(ocr): answer an unreachable document with a DocumentFetchError the router retries

* fix(ocr): raise a typed native error for an unreachable document

The bridge raises RustDocumentFetchError instead of tagging the exception
with an attribute, and the public DocumentFetchError keeps it as context

* fix(ocr): keep retry counts and debug info on an unreachable document error

* refactor(ocr): import the native module as a whole in the OCR route

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-26 07:56:58 +00:00
..
pre_call_checks 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
__init__.py
test_access_windows.py refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
test_add_retry_fallback_headers.py fix(responses): accept a string or tuple allowed_openai_params on Responses models instead of answering 500 (#51751) 2026-11-14 04:32:38 -05:00
test_client_initalization_utils.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
test_cooldown_cache.py feat(redis): serve the proxy's common Redis call with Rust stores (#50170) 2026-11-06 06:01:11 +00:00
test_cooldown_handlers.py fix(ocr): report an unreachable document URL as a 400, not a provider 500 (#54215) 2026-11-26 07:56:58 +00:00
test_deployment_pricing.py refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
test_dynamic_queue.py feat(router): add bounded congestion queue controller (#51883) 2026-11-17 17:15:24 -08:00
test_dynamic_queue_redis.py feat(router): coordinate congestion queues through Redis (#52367) 2026-11-17 19:29:39 -08:00
test_dynamic_queue_router.py fix(router): preserve destination bearer credentials on Anthropic fallbacks (#54271) 2026-11-24 17:12:02 -08:00
test_embedding_batch_size_check.py feat(embeddings): enforce per-request input batch limit (#44574) 2026-10-20 11:35:18 +00:00
test_endpoint_eligibility.py refactor(router): delete router code nothing calls (#52516) 2026-11-19 06:11:10 +09:00
test_fallback_event_handlers.py refactor(router): delete router code nothing calls (#52516) 2026-11-19 06:11:10 +09:00
test_fallback_event_v2_dispatch.py feat(custom-logger-v2): add types, dispatcher and route callback call sites (step 0) (#51214) 2026-11-13 22:08:05 +00:00
test_get_retry_from_policy.py fix(ocr): report an unreachable document URL as a 400, not a provider 500 (#54215) 2026-11-26 07:56:58 +00:00
test_handle_error.py refactor(router): delete router code nothing calls (#52516) 2026-11-19 06:11:10 +09:00
test_health_check_allowed_fails_integration.py feat(redis): serve the proxy's common Redis call with Rust stores (#50170) 2026-11-06 06:01:11 +00:00
test_health_state_cache.py feat(redis): serve the health checks' deployment states from a native store (#50357) 2026-11-13 03:22:28 +00:00
test_kubernetes_pod_discovery.py refactor(router): delete router code nothing calls (#52516) 2026-11-19 06:11:10 +09:00
test_pattern_match_deployments.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
test_prompt_caching_cache.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_ptu_shares.py refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
test_reasoning_effort_capability.py fix(openai): drop or refuse an o-series reasoning_effort level the model map turns off (#54066) 2026-11-24 06:42:03 -08:00
test_request_priority.py fix(openai): relay provider error codes, types, and Responses params from OpenAI-compatible backends (#51809) 2026-11-24 02:23:00 +00:00
test_router_health_check_routing.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
test_router_interactions_endpoints.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
test_router_utils_common_utils.py fix(responses): accept a string or tuple allowed_openai_params on Responses models instead of answering 500 (#51751) 2026-11-14 04:32:38 -05:00
test_routing_read_batch.py refactor(redis): delete the Python RedisBatch now that every request op is native (#51383) 2026-11-13 03:22:28 +00:00