pub struct LlmGenerationMetadata {
pub model: String,
pub provider: Option<String>,
pub usage: Option<TokenUsage>,
pub duration_ms: Option<u64>,
pub time_to_first_token_ms: Option<u64>,
pub success: bool,
pub error: Option<String>,
pub finish_reasons: Option<Vec<String>>,
pub response_id: Option<String>,
pub retry: Option<LlmRetryInfo>,
pub compaction: Option<LlmCompactionInfo>,
pub request_options: Option<LlmRequestOptions>,
}Expand description
Metadata about an LLM generation
Fields§
§model: StringModel identifier used for generation
provider: Option<String>Provider type (openai, anthropic, etc.)
usage: Option<TokenUsage>Token usage statistics
duration_ms: Option<u64>Duration of the generation in milliseconds
time_to_first_token_ms: Option<u64>Time to first token in milliseconds (streaming latency)
success: boolWhether the generation was successful
error: Option<String>Error message if generation failed
finish_reasons: Option<Vec<String>>Finish reasons from the LLM (e.g., [“stop”], [“tool_calls”]) Required for gen-ai semantic conventions
response_id: Option<String>Unique response identifier from the LLM provider Required for gen-ai semantic conventions
retry: Option<LlmRetryInfo>Retry information if rate limit retries occurred Contains number of retries and total wait time
compaction: Option<LlmCompactionInfo>Compaction information if context was compressed before generation Occurs when the conversation context exceeded the model’s limit
request_options: Option<LlmRequestOptions>Request-side driver options that were enabled for this generation.
Trait Implementations§
Source§impl Clone for LlmGenerationMetadata
impl Clone for LlmGenerationMetadata
Source§fn clone(&self) -> LlmGenerationMetadata
fn clone(&self) -> LlmGenerationMetadata
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 LlmGenerationMetadata
impl Debug for LlmGenerationMetadata
Source§impl<'de> Deserialize<'de> for LlmGenerationMetadata
impl<'de> Deserialize<'de> for LlmGenerationMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for LlmGenerationMetadata
impl RefUnwindSafe for LlmGenerationMetadata
impl Send for LlmGenerationMetadata
impl Sync for LlmGenerationMetadata
impl Unpin for LlmGenerationMetadata
impl UnsafeUnpin for LlmGenerationMetadata
impl UnwindSafe for LlmGenerationMetadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request