From 3f6bc9778602283845e36c845ba6a470efdf4492 Mon Sep 17 00:00:00 2001 From: Yujong Lee Date: Sat, 5 Sep 2026 23:59:22 -0700 Subject: [PATCH] fix(rust): preserve core-only route ownership --- litellm-rust/crates/core/src/ocr/mod.rs | 2 +- litellm-rust/crates/python-bridge/src/lib.rs | 1 - .../python-bridge/src/routes/definition.rs | 4 +-- .../src/routes/gateway_messages.rs | 29 ------------------- .../crates/python-bridge/src/routes/mod.rs | 4 --- 5 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 litellm-rust/crates/python-bridge/src/routes/gateway_messages.rs diff --git a/litellm-rust/crates/core/src/ocr/mod.rs b/litellm-rust/crates/core/src/ocr/mod.rs index 2f71dddac31..494f787889f 100644 --- a/litellm-rust/crates/core/src/ocr/mod.rs +++ b/litellm-rust/crates/core/src/ocr/mod.rs @@ -36,7 +36,7 @@ pub async fn ocr_with_observer( } pub fn ocr_admitted(model: &str, provider: &str, request_format: Option<&str>) -> bool { - common_utils::ocr_provider_config(provider, model).is_some_and(|config| { + prepare::ocr_provider_config(provider, model).is_some_and(|config| { request_format != Some("native") || config.supported_ocr_params().contains(&"req_format") }) } diff --git a/litellm-rust/crates/python-bridge/src/lib.rs b/litellm-rust/crates/python-bridge/src/lib.rs index 142f08cfe86..c687fffc8a0 100644 --- a/litellm-rust/crates/python-bridge/src/lib.rs +++ b/litellm-rust/crates/python-bridge/src/lib.rs @@ -243,7 +243,6 @@ mod tests { "amessages", "chat_completions", "achat_completions", - "gateway_messages", ] ); } diff --git a/litellm-rust/crates/python-bridge/src/routes/definition.rs b/litellm-rust/crates/python-bridge/src/routes/definition.rs index f2f669f367f..56c0306a776 100644 --- a/litellm-rust/crates/python-bridge/src/routes/definition.rs +++ b/litellm-rust/crates/python-bridge/src/routes/definition.rs @@ -304,7 +304,7 @@ for field in ('litellm_call_id', 'trace_id', 'request_model'): c" import asyncio -async def invoke_async(execute, request, options): +async def execute_async(execute, request, options, context): return await execute(request, options=options, context=context) for route, provider in ( @@ -328,7 +328,7 @@ for route, provider in ( for execute, is_async in functions: try: if is_async: - asyncio.run(invoke_async(execute, request, unsupported_options)) + asyncio.run(execute_async(execute, request, unsupported_options, context)) else: execute(request, options=unsupported_options, context=context) except Exception as error: diff --git a/litellm-rust/crates/python-bridge/src/routes/gateway_messages.rs b/litellm-rust/crates/python-bridge/src/routes/gateway_messages.rs deleted file mode 100644 index 97ff93f299a..00000000000 --- a/litellm-rust/crates/python-bridge/src/routes/gateway_messages.rs +++ /dev/null @@ -1,29 +0,0 @@ -use pyo3::prelude::*; -use serde_json::Value; - -use crate::errors::core_error_to_pyerr; - -#[pyfunction] -fn gateway_messages<'py>( - py: Python<'py>, - model_alias: String, - provider_model: String, - api_base: String, - #[pyo3(from_py_with = litellm_python_interop::from_py)] body: Value, -) -> PyResult> { - let future = litellm_ai_gateway::trace_parity::messages_request( - model_alias, - provider_model, - api_base, - body, - ); - crate::execution::run_async( - py, - crate::function_trace::capture(future), - core_error_to_pyerr, - ) -} - -pub(super) fn register_trace(module: &Bound<'_, PyModule>) -> PyResult<()> { - super::definition::add_function(module, wrap_pyfunction!(gateway_messages, module)?) -} diff --git a/litellm-rust/crates/python-bridge/src/routes/mod.rs b/litellm-rust/crates/python-bridge/src/routes/mod.rs index e84d85485b2..984ea0a52e7 100644 --- a/litellm-rust/crates/python-bridge/src/routes/mod.rs +++ b/litellm-rust/crates/python-bridge/src/routes/mod.rs @@ -3,9 +3,6 @@ use pyo3::prelude::*; #[macro_use] pub(crate) mod definition; -#[cfg(feature = "trace-parity")] -mod gateway_messages; - mod audio_transcription; mod chat_completions; mod messages; @@ -23,7 +20,6 @@ pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { audio_transcription::register_trace(&trace)?; messages::register_trace(&trace)?; chat_completions::register_trace(&trace)?; - gateway_messages::register_trace(&trace)?; module.add_submodule(&trace)?; } Ok(())