pub struct Response {
pub llm_response: LlmResponse,
pub metadata: Option<Metadata>,
}Expand description
A response an algorithm returns: the LlmResponse (streamed or aggregate) plus
optional correlation Metadata.
Not Clone — llm_response may own a live stream.
Fields§
§llm_response: LlmResponseThe neutral model response — a chunk stream or the buffered aggregate.
metadata: Option<Metadata>Correlation metadata carried through the response.
Implementations§
Source§impl Response
impl Response
Sourcepub fn selected_model(&self) -> Option<&str>
pub fn selected_model(&self) -> Option<&str>
Returns the model recorded by a buffered response.
Returns None for a live stream because inspecting its MessageStart
event would require consuming the stream.
Sourcepub fn served_model(&self) -> Option<&ModelId>
pub fn served_model(&self) -> Option<&ModelId>
Returns the Switchyard target that successfully served this response.
Unlike Self::selected_model, this is available for streamed responses because the
client records the target when it receives the stream handle.
Sourcepub fn set_served_model(&mut self, model: &ModelId)
pub fn set_served_model(&mut self, model: &ModelId)
Records the Switchyard target that successfully served this response.
Auto Trait Implementations§
impl Freeze for Response
impl !RefUnwindSafe for Response
impl Send for Response
impl !Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl !UnwindSafe for Response
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more