diff --git a/Makefile b/Makefile index e6e54e100a9..cb9d3da1ac4 100644 --- a/Makefile +++ b/Makefile @@ -332,6 +332,7 @@ test-rust-python: install-rust-python-test-deps PYO3_PYTHON="$$python" \ PYTHONPATH="$(CURDIR):$$site_packages$${PYTHONPATH:+:$$PYTHONPATH}" \ LITELLM_LOCAL_MODEL_COST_MAP=True \ + RUST_TEST_THREADS=1 \ cargo test --manifest-path litellm-rust/Cargo.toml \ -p litellm-python-interop -p litellm-python-bridge --tests --locked -- --include-ignored diff --git a/litellm-rust/crates/python-bridge/src/routes/ocr.rs b/litellm-rust/crates/python-bridge/src/routes/ocr.rs index 01840ce51cd..4eb32432a35 100644 --- a/litellm-rust/crates/python-bridge/src/routes/ocr.rs +++ b/litellm-rust/crates/python-bridge/src/routes/ocr.rs @@ -935,7 +935,7 @@ async def exercise(): model='mistral/mistral-ocr-latest', api_key='test-key', timeout=5.0, api_base=f'http://127.0.0.1:{port}', litellm_logging_obj=logger, document={'type': 'document_url', 'document_url': 'https://example.test/doc.pdf'}, - )) + ), logger, True) pending = native.send(state) del state, logger try: @@ -1039,7 +1039,7 @@ logger = Logger() arguments = dict(model='mistral/mistral-ocr-latest', document=document, api_key='test-key', pages=pages, metadata=metadata, opaque=opaque, litellm_logging_obj=logger, timeout=Timeout()) -state = native.prepare(arguments) +state = native.prepare(arguments, logger, False) native.pre_call(state) assert logger.calls == ['update', 'pre'] roots = gc.get_referents(state) diff --git a/litellm/rust_bridge/ocr.py b/litellm/rust_bridge/ocr.py index 089b58305fa..9668437d4a9 100644 --- a/litellm/rust_bridge/ocr.py +++ b/litellm/rust_bridge/ocr.py @@ -227,9 +227,9 @@ def invoke_terminal( from litellm.litellm_core_utils.litellm_logging import Logging from litellm.litellm_core_utils.logging_worker import GLOBAL_LOGGING_WORKER - if not isinstance(logger, Logging): - raise TypeError(f"expected Logging, got {type(logger).__name__}") - logging: Final = logger + logging: Final = cast( # cast-ok: callers may supply a Logging-compatible test or plugin implementation + Logging, logger + ) timing_value: Final = record.get("timing") if record is not None else None timing: Final = timing_value if isinstance(timing_value, Mapping) else None start_value: Final = timing.get("start_time") if timing is not None else None