pub struct Response {
pub llm_response: LlmResponse,
pub metadata: Option<Metadata>,
pub upstream_headers: HeaderMap,
}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.
upstream_headers: HeaderMapUpstream HTTP response headers preserved from the LLM backend (or proxy). Populated by the LLM client; consumers (e.g. switchyard-server) may forward these to the downstream client for observability.
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.