mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
fix(rust): box messages response output
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
b7686d78b6
commit
41873e2bc7
3 changed files with 5 additions and 4 deletions
|
|
@ -34,7 +34,7 @@ pub async fn messages(request: MessagesRequest<'_>) -> Result<AnthropicMessagesR
|
|||
timeout: 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",
|
||||
)),
|
||||
|
|
|
|||
|
|
@ -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 reading
|
||||
|
|
|
|||
|
|
@ -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()),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue