mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-15 23:31:29 +00:00
* refactor(ocr): extract call completion boundary * fix(ocr): release completion state after dispatch * test(ocr): prove wrapper completion handoff * test(ocr): narrow mapped failure assertion * fix(ocr): preserve wrapper invocation kwargs * fix(ocr): retain completion through finalization * fix(ocr): make completion ownership explicit * refactor(ocr): resolve logging executor explicitly * fix(callbacks): preserve completion lifecycle behavior * refactor(ocr): move public OCR into native lifecycle * refactor(ocr): remove unused rust bridge capability * wip * wip * refactor * wip * fix(ocr): preserve reducto native compatibility * wip * fix(ocr): document native callable casts * perf(ocr): bound responses and reduce native scheduling overhead * refactor(python-bridge): organize placeholder routes * refactor test * fix(ocr): normalize DeepSeek document content * perf(ocr): skip unused callback work and benchmark callback overhead * fix(ocr): align conversion contracts * test(ocr): cover official provider response shapes * fix(ocr): restore Python fallback and honor Rust opt-out * fixes and refactor * fix(ocr): preserve Azure Document Intelligence authentication * fix(rust): enforce OCR response limits and lint contracts * test(rust): align native OCR contract coverage * test(ocr): isolate Azure auth precedence coverage
2.1 KiB
2.1 KiB
- Target invariants; implementation and runtime validation may lag these rules
- Keep this crate a small, domain-neutral foundation: Python/Serde conversion and interpreter-boundary utilities
- No LiteLLM domain dependencies, route types, callback policy, public API registration or cdylib build features
- Generic code alone does not justify extraction: runtime integration stays in
python-bridge/src/execution.rs, host adaptation in itslifecycle.rs
- Use standard PyO3 ownership and conversion APIs
- Prefer
Bound<'py, T>for attached operations/results,Py<T>for retention; binding/unbinding does not copy payloads - Use
pythonizefor selected Serde data, never a JSON-text round trip; share conversion withPythonized<T> - Preserve
PythonizeError's standard conversion intoPyErr; do not stringify original Python exceptions into newValueErrors - Keep serializer-panic containment in
Pythonized<T>: async output conversion can run in an unjoined blocking task and otherwise strand delivery
- Prefer
- Use
Python::detachfor Rust-only work; Python operations require attachment- Keep diagnostic counters in the consumer; wrapper invocations do not measure every interpreter release
- Release exclusive class borrows/locks before Python calls or decrements that can invoke finalizers; expose retained Python edges to GC without calling Python during traversal
- Keep coroutine driving in the shared Python driver and native adapter
- Driver:
litellm/rust_bridge/lifecycle.py; handle:python-bridge/src/lifecycle.rs; native-backed behavior tests:python-bridge/tests/lifecycle.py
- Driver:
- References: ownership, conversions, pythonize errors