codetether_agent/rlm/
mod.rs1pub mod chunker;
11pub mod repl;
12pub mod router;
13
14pub use chunker::{Chunk, ChunkOptions, ContentType, RlmChunker};
15pub use repl::{ReplRuntime, RlmAnalysisResult, RlmExecutor, RlmRepl, SubQuery};
16pub use router::{RlmRouter, RoutingContext, RoutingResult};
17
18use serde::{Deserialize, Serialize};
19
20#[derive(Debug, Clone, Default, Serialize, Deserialize)]
22pub struct RlmStats {
23 pub input_tokens: usize,
24 pub output_tokens: usize,
25 pub iterations: usize,
26 pub subcalls: usize,
27 pub elapsed_ms: u64,
28 pub compression_ratio: f64,
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33pub struct RlmResult {
34 pub processed: String,
35 pub stats: RlmStats,
36 pub success: bool,
37 pub error: Option<String>,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42pub struct RlmConfig {
43 #[serde(default = "default_mode")]
45 pub mode: String,
46
47 #[serde(default = "default_threshold")]
49 pub threshold: f64,
50
51 #[serde(default = "default_max_iterations")]
53 pub max_iterations: usize,
54
55 #[serde(default = "default_max_subcalls")]
57 pub max_subcalls: usize,
58
59 #[serde(default = "default_runtime")]
61 pub runtime: String,
62
63 pub root_model: Option<String>,
65
66 pub subcall_model: Option<String>,
68}
69
70fn default_mode() -> String {
71 "auto".to_string()
72}
73
74fn default_threshold() -> f64 {
75 0.35
76}
77
78fn default_max_iterations() -> usize {
79 15
80}
81
82fn default_max_subcalls() -> usize {
83 50
84}
85
86fn default_runtime() -> String {
87 "rust".to_string()
88}
89
90impl Default for RlmConfig {
91 fn default() -> Self {
92 Self {
93 mode: default_mode(),
94 threshold: default_threshold(),
95 max_iterations: default_max_iterations(),
96 max_subcalls: default_max_subcalls(),
97 runtime: default_runtime(),
98 root_model: None,
99 subcall_model: None,
100 }
101 }
102}