The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(rust): box messages response output
Yujong Lee41873e2bc796
diff --git a/litellm-rust/crates/core/src/messages/mod.rs b/litellm-rust/crates/core/src/messages/mod.rsindex c07a83c7e43..289f79109dd 100644--- a/litellm-rust/crates/core/src/messages/mod.rs+++ b/litellm-rust/crates/core/src/messages/mod.rs@@ -34,7 +34,7 @@ pub async fn messages(request: MessagesRequest<'_>) -> Result<AnthropicMessagesRtimeout: request.timeout,};match litellm_host::run::run(messages_machine(), &LocalMessagesHost::new(call)).await? {- MessagesOutput::Message(message) => Ok(message),+ MessagesOutput::Message(message) => Ok(*message),MessagesOutput::Streamed => Err(Error::Unsupported("streamed responses need a streaming host",)),diff --git a/litellm-rust/crates/core/src/messages/route.rs b/litellm-rust/crates/core/src/messages/route.rsindex 3d607ba67f6..838b56fcb4b 100644--- a/litellm-rust/crates/core/src/messages/route.rs+++ b/litellm-rust/crates/core/src/messages/route.rs@@ -48,7 +48,7 @@ impl MessagesCall {}pub enum MessagesOutput {- Message(AnthropicMessagesResponse),+ Message(Box<AnthropicMessagesResponse>),/// Every chunk already reached the host through `Deliver`.Streamed,}@@ -174,7 +174,8 @@ async fn execute(host: MessagesHost) -> Result<MessagesOutput, Error> {raw: RawResponse { body: text.clone() },}).await?;- decode_response(request.config, &request.model, &text).map(MessagesOutput::Message)+ decode_response(request.config, &request.model, &text)+ .map(|message| MessagesOutput::Message(Box::new(message)))}/// Hands each upstream chunk to the caller as it arrives. A caller that stops readingdiff --git a/litellm-rust/crates/python-bridge/src/routes/messages/host.rs b/litellm-rust/crates/python-bridge/src/routes/messages/host.rsindex b590018bc4e..c1b3f59df58 100644--- a/litellm-rust/crates/python-bridge/src/routes/messages/host.rs+++ b/litellm-rust/crates/python-bridge/src/routes/messages/host.rs@@ -150,7 +150,7 @@ impl RouteHost for MessagesRouteHost {MessagesOutput::Message(message) => py.import("litellm.rust_bridge.messages.route_host")?.getattr("response")?- .call1((to_py(py, &message)?,))+ .call1((to_py(py, message.as_ref())?,)).map(Bound::unbind),MessagesOutput::Streamed => Ok(py.None()),}