litellm/tests/unit/rust_bridge/host/routes
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
..
__init__.py refactor(rust-bridge): move the route host modules under host/routes (#46786) 2026-10-15 18:27:06 -07:00
test_chat_completions.py refactor(rust-bridge): let each route host pick the body params (#46787) 2026-10-15 18:27:06 -07:00
test_messages.py fix(anthropic): keep caller tool_use ids unless the upstream rejects them (#54468) 2026-11-26 05:55:01 +00:00
test_ocr.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_responses.py refactor(rust-bridge): move the route host modules under host/routes (#46786) 2026-10-15 18:27:06 -07:00