codetether_rlm/events/
completion.rs1use serde::{Deserialize, Serialize};
4use uuid::Uuid;
5
6use super::RlmOutcome;
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct RlmCompletion {
11 pub trace_id: Uuid,
12 pub outcome: RlmOutcome,
13 pub iterations: usize,
14 pub subcalls: usize,
15 pub input_tokens: usize,
16 pub output_tokens: usize,
17 pub elapsed_ms: u64,
18 pub reason: Option<String>,
19 pub root_model: String,
20 #[serde(default, skip_serializing_if = "Option::is_none")]
21 pub subcall_model_used: Option<String>,
22}
23
24impl RlmCompletion {
25 pub fn compression_ratio(&self) -> f64 {
27 if self.input_tokens == 0 {
28 0.0
29 } else {
30 self.output_tokens as f64 / self.input_tokens as f64
31 }
32 }
33}