litellm/litellm-rust/crates/python-bridge/src
mateo-berri 48a0d4ca66 fix(rust): read an OCR document that defines only __getitem__ by item again
The previous commit checked `in` before it read `file` or `mime_type`. For
an object that defines only `__getitem__`, Python answers `in` by indexing
it with 0, 1, 2 and so on, so a strict lookup raised KeyError: 0 and a
lookup that returns None for unknown keys never stopped

The `in` check now runs only for a Mapping, whose `in` reads its keys. Any
other document is read by item, and a KeyError means the caller left the
key out, as on the base

On lts/1.108.x the path sits under litellm-rust/, and the test hunk keeps
the line's `#[rstest::rstest]` attribute and its own validation test

(cherry picked from commit 156280896e)
2026-11-14 05:21:01 -08:00
..
cache refactor(rust_bridge): route Python state reads through host modules (#45689) 2026-10-11 14:10:16 -07:00
logger refactor(rust): centralize bridge execution wrappers (#43871) 2026-09-30 15:54:27 +00:00
routes fix(rust): read an OCR document that defines only __getitem__ by item again 2026-11-14 05:21:01 -08:00
secrets refactor(rust_bridge): route Python state reads through host modules (#45689) 2026-10-11 14:10:16 -07:00
callable.rs refactor(rust): centralize host execution and compose callbacks (#43515) 2026-09-28 19:20:27 +00:00
coercion.rs refactor(rust): centralize host execution and compose callbacks (#43515) 2026-09-28 19:20:27 +00:00
credentials.rs refactor(rust): centralize host execution and compose callbacks (#43515) 2026-09-28 19:20:27 +00:00
diagnostics.rs wip 2026-09-19 10:36:59 -07:00
errors.rs refactor(rust): rename litellm-core to litellm-inference (#44802) 2026-10-06 07:17:24 -07:00
execution.rs refactor(rust): centralize bridge execution wrappers (#43871) 2026-09-30 15:54:27 +00:00
http.rs refactor(rust): rename litellm-core to litellm-inference (#44802) 2026-10-06 07:17:24 -07:00
lib.rs refactor(rust-bridge): return an unstarted Execution from native entrypoints and drive it in Python (#46299) 2026-10-14 17:50:44 -07:00
marshal.rs refactor(rust_bridge): route Python state reads through host modules (#45689) 2026-10-11 14:10:16 -07:00
preflight.rs refactor(rust): centralize host execution and compose callbacks (#43515) 2026-09-28 19:20:27 +00:00
python_settings.rs refactor(rust_bridge): route Python state reads through host modules (#45689) 2026-10-11 14:10:16 -07:00
tokenizer.rs feat(tokenizer): preserve Python defaults with opt-in Rust dispatch (#42174) 2026-09-22 04:41:11 +00:00