litellm/tests/test_litellm_rust
saruar-dev e4bc52a83d
feat(nace): add NDI document parse as an OCR provider (#52519)
* feat(nace): add NDI document parse as an OCR provider

Add a Rust OCR adapter for Nace Document Intelligence (NDI) Parse with
the models nace/parse-low, nace/parse-medium and nace/parse-high.

A public https link goes to Nace as a link. Any other document is
uploaded with a one-time grant, parsed, and deleted after the call.
The cost map bills each processed page at the price of the effort.

* fix(nace): clean the job error before the OCR response hooks see it

The copy of a Nace job that goes to the response hooks now has its
error code and message cleaned and the deployment API key masked. The
copy keeps the key order of the job. The password texts now say that
the logging callbacks mask it.

* fix(nace): accept include_image_base64 and never send it to Nace

Clients that use the Mistral OCR request shape send the top-level
include_image_base64 option. A host that passes every body field on
sent it to Nace, which refuses an unknown field with a 422. The option
is now accepted with any value and left out of the parse request, since
Nace returns images as links (output.include_images), not base64.

* fix(nace): map the pages option to Nace page_ranges

Clients that use the Mistral OCR request shape select pages with the
top-level pages option (0-based page indexes). The Python host dropped
it, so Nace parsed and billed the whole document, and a host that
passes every body field on sent it to Nace, which refuses it with a
422. The option is now sorted, deduplicated, shifted to 1-based pages
and merged into page_ranges runs. An empty list parses the whole
document. Values that are not non-negative integers, or pages together
with page_ranges, are refused with a 400 before the upload.

* test(nace): assert request headers without loops and drop a redundant doc line

* fix(nace): refuse include_image_base64 true unless drop_params is on

Nace returns images as links, never as base64, so a request asking for
base64 images now gets the unsupported-param 400 that other OCR
providers give for output they cannot return. drop_params drops it
instead, and false or null are still accepted and never sent, which
keeps Open WebUI's Mistral loader working

* fix(nace): refuse output.include_images unless drop_params is on

Nace returns image crops only as links that need the operator's Nace key and
stop working once cleanup deletes the job, so image requests now get the same
unsupported-param 400 as include_image_base64 and every job is deleted

* fix(nace): bill only the requested pages when Nace omits billed units

With page_ranges, the page count Nace reports covers the whole document, so a
job without units now bills the requested pages that exist in the document
instead of every page

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-24 05:50:07 +00:00
..
cache feat(messages): serve anthropic messages on rust only (#51119) 2026-11-12 00:07:20 +00:00
chat_completions feat(rust): one typed decline from core up to each host (#47772) 2026-10-28 09:22:11 -07:00
embeddings refactor(rust-bridge): decide native routing in the catalog, drop the bypass predicates (#46750) 2026-10-20 15:06:24 -07:00
messages fix(proxy): resolve admin oidc api_key references on batch cancel, fine-tuning listing, OCR, /v1/messages and cache prediction (#53678) 2026-11-23 10:11:10 -08:00
ocr feat(nace): add NDI document parse as an OCR provider (#52519) 2026-11-24 05:50:07 +00:00
responses fix(messages): let proxy /v1/messages requests run on the rust path (#50335) 2026-11-09 16:06:52 -08:00
support feat(messages): serve anthropic messages on rust only (#51119) 2026-11-12 00:07:20 +00:00
tokenizer fix(tokenizer): match tiktoken on lone surrogates and out-of-u32 tokens (#51720) 2026-11-18 01:29:55 +00:00
AGENTS.md refactor(rust-bridge): detect Python-only features in the catalog instead of Rust declines (#46714) 2026-10-20 15:06:25 -07:00
conftest.py refactor(rust-bridge): require the native extension (#48852) 2026-10-28 13:16:56 -07:00
test_clickhouse_spend.py refactor(lens): connect LiteLLM to the independent Lens service (#45529) 2026-10-09 16:17:05 -07:00
test_dispatch.py feat(messages): serve anthropic messages on rust only (#51119) 2026-11-12 00:07:20 +00:00
test_fork_guard.py refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
test_public_entries.py fix(rust): run native async calls through python's async wrapper steps (#50423) 2026-11-10 00:24:20 +00:00