pub struct ResponseAttributes {
pub content: String,
pub prompt_tokens: Option<u32>,
pub completion_tokens: Option<u32>,
pub total_tokens: Option<u32>,
pub tool_calls_count: usize,
pub latency_ms: u64,
pub success: bool,
pub error: Option<String>,
}Expand description
OpenTelemetry response attributes
Fields§
§content: StringResponse content (truncated if too long)
prompt_tokens: Option<u32>Prompt tokens used
completion_tokens: Option<u32>Completion tokens used
total_tokens: Option<u32>Total tokens used
tool_calls_count: usizeNumber of tool calls in response
latency_ms: u64Request latency in milliseconds
success: boolWhether the request succeeded
error: Option<String>Error message if failed
Implementations§
Source§impl ResponseAttributes
impl ResponseAttributes
Sourcepub fn from_response(response: &LlmResponse, latency_ms: u64) -> Self
pub fn from_response(response: &LlmResponse, latency_ms: u64) -> Self
Create response attributes from an LLM response
Sourcepub fn from_embedding_response(
response: &EmbeddingResponse,
latency_ms: u64,
) -> Self
pub fn from_embedding_response( response: &EmbeddingResponse, latency_ms: u64, ) -> Self
Create response attributes from an embedding response
Sourcepub fn from_error(error: &str, latency_ms: u64) -> Self
pub fn from_error(error: &str, latency_ms: u64) -> Self
Create response attributes from an error
Trait Implementations§
Source§impl Clone for ResponseAttributes
impl Clone for ResponseAttributes
Source§fn clone(&self) -> ResponseAttributes
fn clone(&self) -> ResponseAttributes
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ResponseAttributes
impl RefUnwindSafe for ResponseAttributes
impl Send for ResponseAttributes
impl Sync for ResponseAttributes
impl Unpin for ResponseAttributes
impl UnwindSafe for ResponseAttributes
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