diff --git a/litellm-rust/crates/python-bridge/src/lib.rs b/litellm-rust/crates/python-bridge/src/lib.rs index 5b4f1b68e37..aeb05f8b343 100644 --- a/litellm-rust/crates/python-bridge/src/lib.rs +++ b/litellm-rust/crates/python-bridge/src/lib.rs @@ -162,6 +162,8 @@ mod _native { #[pymodule_init] fn init(module: &Bound<'_, PyModule>) -> PyResult<()> { super::errors::register(module)?; + litellm_python_interop::callback_runtime::register(module)?; + super::callback_bindings::register(module)?; super::routes::register(module)?; module.add_class::()?; module.add_function(wrap_pyfunction!( diff --git a/tests/test_litellm/ocr/test_rust_bridge.py b/tests/test_litellm/ocr/test_rust_bridge.py index 0726b48d16f..29c24f21c16 100644 --- a/tests/test_litellm/ocr/test_rust_bridge.py +++ b/tests/test_litellm/ocr/test_rust_bridge.py @@ -398,6 +398,7 @@ def test_load_rust_ocr_uses_compiled_extension(monkeypatch): fake_module = types.ModuleType("litellm.rust_bridge._native") fake_module.ocr = lambda **kwargs: dict(FAKE_OCR_RESPONSE) # type: ignore[attr-defined] fake_module.aocr = lambda **kwargs: dict(FAKE_OCR_RESPONSE) # type: ignore[attr-defined] + fake_module.ready_endpoints = {"ocr": {"callbacks"}} # type: ignore[attr-defined] monkeypatch.setattr( importlib.import_module("litellm.rust_bridge.bindings"), "get_native_bridge", diff --git a/tests/test_litellm/responses/test_rust_bridge_websocket.py b/tests/test_litellm/responses/test_rust_bridge_websocket.py index 35357e949d1..1ec1a8a9621 100644 --- a/tests/test_litellm/responses/test_rust_bridge_websocket.py +++ b/tests/test_litellm/responses/test_rust_bridge_websocket.py @@ -113,6 +113,7 @@ async def test_connection_forwards_session_callback_adapter() -> None: cls, request: NativeResponsesWebSocketRequest, *, + options: object, context: NativeRequestContext, callback_adapter: object | None = None, ) -> _FakeNativeConnection: @@ -167,7 +168,7 @@ async def test_connection_dispatch_cleans_up_without_reconnecting(native, sessio class Native: @classmethod - async def connect(cls, request, *, options, context): + async def connect(cls, request, *, options, context, callback_adapter=None): connections.append("native") assert options.custom_llm_provider == "azure" return native_socket diff --git a/tests/test_litellm/test_audio_transcription_rust_bridge.py b/tests/test_litellm/test_audio_transcription_rust_bridge.py index a3ff14a7696..87ed412d379 100644 --- a/tests/test_litellm/test_audio_transcription_rust_bridge.py +++ b/tests/test_litellm/test_audio_transcription_rust_bridge.py @@ -34,6 +34,7 @@ class SyncBridge: *, options: NativeRequestOptions, context: NativeRequestContext, + callback_adapter: object | None = None, ) -> dict[str, object]: self.calls.append( { @@ -53,6 +54,7 @@ class AsyncBridge: *, options: NativeRequestOptions, context: NativeRequestContext, + callback_adapter: object | None = None, ) -> dict[str, object]: return {"text": "async"}