Skip to main content

codetether_rlm/model_select/
types.rs

1//! Types used by RLM model selection.
2
3/// RLM call surface that needs a model.
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum RlmModelPurpose {
6    /// Top-level RLM analysis.
7    Root,
8    /// Session history/context compaction.
9    Compression,
10    /// Background tool-output summarisation.
11    Background,
12    /// Recursive subcall analysis.
13    Subcall,
14}
15
16/// Source that won model selection.
17#[derive(Debug, Clone, Copy, PartialEq, Eq)]
18pub enum RlmModelSource {
19    /// [`crate::RlmConfig::root_model`] was set.
20    RootConfig,
21    /// [`crate::RlmConfig::subcall_model`] was set.
22    SubcallConfig,
23    /// [`super::RLM_MODEL_ENV`] was set.
24    Env,
25    /// Foreground caller model was reused.
26    Caller,
27}
28
29/// Selected model plus provenance for logging.
30#[derive(Debug, Clone, PartialEq, Eq)]
31pub struct RlmModelChoice {
32    /// Provider-qualified or bare model reference.
33    pub model: String,
34    /// Selection source.
35    pub source: RlmModelSource,
36}
37
38impl RlmModelChoice {
39    pub(crate) fn new(model: impl Into<String>, source: RlmModelSource) -> Self {
40        Self {
41            model: model.into(),
42            source,
43        }
44    }
45}