pub struct RlmCompletion {
pub trace_id: Uuid,
pub outcome: RlmOutcome,
pub iterations: usize,
pub subcalls: usize,
pub input_tokens: usize,
pub output_tokens: usize,
pub elapsed_ms: u64,
pub reason: Option<String>,
pub root_model: String,
pub subcall_model_used: Option<String>,
}Expand description
Terminal record for a single RLM invocation.
Persisted durably so cost post-mortems and trace-driven tuning jobs can reconstruct how each compaction or big-tool-output run behaved.
§Examples
use codetether_agent::session::{RlmCompletion, RlmOutcome};
use uuid::Uuid;
let c = RlmCompletion {
trace_id: Uuid::nil(),
outcome: RlmOutcome::Converged,
iterations: 4,
subcalls: 1,
input_tokens: 42_000,
output_tokens: 2_100,
elapsed_ms: 3_412,
reason: None,
root_model: "zai/glm-5".into(),
subcall_model_used: None,
};
assert!(c.compression_ratio() > 0.0);
assert!(c.compression_ratio() < 1.0);Fields§
§trace_id: UuidCorrelates this completion with its progress events.
outcome: RlmOutcomeWhy the loop finished.
iterations: usizeIterations actually executed.
subcalls: usizeSub-LLM calls issued during the loop.
input_tokens: usizeInput tokens (the raw blob handed to the router).
output_tokens: usizeOutput tokens (the produced summary / final answer).
elapsed_ms: u64Total wall-clock duration in milliseconds.
reason: Option<String>Human-readable explanation for non-RlmOutcome::Converged outcomes.
root_model: StringModel used for iteration 1 (the root model).
subcall_model_used: Option<String>Model used for iterations ≥ 2, if
RlmConfig::subcall_model
was configured and resolved. None means all iterations used
Self::root_model.
Implementations§
Source§impl RlmCompletion
impl RlmCompletion
Sourcepub fn compression_ratio(&self) -> f64
pub fn compression_ratio(&self) -> f64
output_tokens / input_tokens, clamped so zero-input loops return
0.0 rather than NaN.
Values below 1.0 indicate compression; above 1.0 indicate
expansion (rare, but possible when the model rewrites a terse blob
into a verbose explanation).
§Examples
use codetether_agent::session::{RlmCompletion, RlmOutcome};
use uuid::Uuid;
let c = RlmCompletion {
trace_id: Uuid::nil(),
outcome: RlmOutcome::Converged,
iterations: 1, subcalls: 0,
input_tokens: 1000, output_tokens: 100,
elapsed_ms: 0, reason: None,
root_model: "m".into(), subcall_model_used: None,
};
assert!((c.compression_ratio() - 0.1).abs() < 1e-9);Trait Implementations§
Source§impl Clone for RlmCompletion
impl Clone for RlmCompletion
Source§fn clone(&self) -> RlmCompletion
fn clone(&self) -> RlmCompletion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RlmCompletion
impl Debug for RlmCompletion
Source§impl<'de> Deserialize<'de> for RlmCompletion
impl<'de> Deserialize<'de> for RlmCompletion
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 RlmCompletion
impl RefUnwindSafe for RlmCompletion
impl Send for RlmCompletion
impl Sync for RlmCompletion
impl Unpin for RlmCompletion
impl UnsafeUnpin for RlmCompletion
impl UnwindSafe for RlmCompletion
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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