pub struct AnnotatedLlmResponse {
pub id: Option<String>,
pub model: Option<String>,
pub message: Option<MessageContent>,
pub tool_calls: Option<Vec<ResponseToolCall>>,
pub finish_reason: Option<FinishReason>,
pub usage: Option<Usage>,
pub api_specific: Option<ApiSpecificResponse>,
pub extra: Map<String, Value>,
}Expand description
Structured view of an LLM response, produced by a response codec from raw JSON API output.
The extra field captures any top-level keys not modeled by the known
fields, ensuring lossless round-trip through serde.
Fields§
§id: Option<String>Response ID from the API (e.g., “chatcmpl-abc123”, “resp_abc123”, “msg_abc123”).
model: Option<String>The model that actually served the request (may differ from requested model).
message: Option<MessageContent>The assistant’s response content, reusing MessageContent from request types.
tool_calls: Option<Vec<ResponseToolCall>>Tool calls requested by the model, normalized across APIs.
Uses ResponseToolCall (arguments as Json) NOT the request-side
ToolCall (arguments as String).
finish_reason: Option<FinishReason>Why generation stopped, normalized across APIs.
usage: Option<Usage>Token usage statistics.
api_specific: Option<ApiSpecificResponse>API-specific response data that cannot be normalized across providers.
extra: Map<String, Value>Catch-all for unmodeled top-level fields, ensuring lossless round-trip.
Implementations§
Source§impl AnnotatedLlmResponse
impl AnnotatedLlmResponse
Sourcepub fn response_text(&self) -> Option<&str>
pub fn response_text(&self) -> Option<&str>
Extract the text content of the response message.
For MessageContent::Text, returns the string directly.
For MessageContent::Parts, returns the text of the first
super::request::ContentPart::Text part.
Returns None if message is None.
Sourcepub fn has_tool_calls(&self) -> bool
pub fn has_tool_calls(&self) -> bool
Check if the response contains any tool calls.
Returns true if tool_calls is Some with at least one element.
Trait Implementations§
Source§impl Clone for AnnotatedLlmResponse
impl Clone for AnnotatedLlmResponse
Source§fn clone(&self) -> AnnotatedLlmResponse
fn clone(&self) -> AnnotatedLlmResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AnnotatedLlmResponse
impl Debug for AnnotatedLlmResponse
Source§impl Default for AnnotatedLlmResponse
impl Default for AnnotatedLlmResponse
Source§fn default() -> AnnotatedLlmResponse
fn default() -> AnnotatedLlmResponse
Source§impl<'de> Deserialize<'de> for AnnotatedLlmResponse
impl<'de> Deserialize<'de> for AnnotatedLlmResponse
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AnnotatedLlmResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AnnotatedLlmResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for AnnotatedLlmResponse
impl PartialEq for AnnotatedLlmResponse
Source§fn eq(&self, other: &AnnotatedLlmResponse) -> bool
fn eq(&self, other: &AnnotatedLlmResponse) -> bool
self and other values to be equal, and is used by ==.