pub struct CompletionCall {
pub call_index: usize,
pub usage: Usage,
pub response_id: Option<String>,
pub provider_request_id: Option<String>,
pub finish_reason: Option<FinishReason>,
pub raw: Value,
}Expand description
One completion call of a run: what was asked and what came back.
Fields§
§call_index: usizeZero-based index of the completion request within this agent run.
usage: UsageToken usage reported for this completion request.
A counter the provider did not report is None; a reported zero is
Some(0). Every counter is None when no usage was reported at all.
response_id: Option<String>Provider-assigned response-scoped ID for this call, when reported.
provider_request_id: Option<String>Transport request ID for this call, or None if the provider reported none.
finish_reason: Option<FinishReason>Why this call stopped generating, or None if unreported.
Retained per call so callers can identify which attempt was truncated.
raw: ValueThis attempt’s provider response payload, as defined by
rig_core::completion::CompletionResponse::raw. A stream without a
terminal response produces no completion-call entry.
Implementations§
Source§impl CompletionCall
impl CompletionCall
Sourcepub fn new(call_index: usize, usage: Usage, raw: Value) -> Self
pub fn new(call_index: usize, usage: Usage, raw: Value) -> Self
Create details for one completion request in an agent run, carrying
the provider’s own response raw (see Self::raw); identity
metadata starts unset and is attached with Self::with_identity.
Sourcepub fn with_identity(self, identity: ResponseIdentity) -> Self
pub fn with_identity(self, identity: ResponseIdentity) -> Self
Attach the response identity metadata this call’s attempt reported.
Sourcepub fn with_finish_reason(self, finish_reason: Option<FinishReason>) -> Self
pub fn with_finish_reason(self, finish_reason: Option<FinishReason>) -> Self
Attach the terminal finish reason reported by this attempt.
Sourcepub fn identity(&self) -> ResponseIdentity
pub fn identity(&self) -> ResponseIdentity
This call’s identity metadata as one ResponseIdentity carrier.