use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RerankConfig {
pub top_k: usize,
pub min_score: Option<f32>,
pub include_score_breakdown: bool,
pub recency_mode: Option<RecencyMode>,
pub query_embedding: Option<Vec<f32>>,
}
impl Default for RerankConfig {
fn default() -> Self {
Self {
top_k: 10,
min_score: Some(0.2),
include_score_breakdown: false,
recency_mode: Some(RecencyMode::ExponentialDecay { decay_rate: 0.01 }),
query_embedding: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum RecencyMode {
NoDecay,
LinearDecay {
max_age_days: f64,
},
ExponentialDecay {
decay_rate: f64,
},
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChannelRecencyRule {
pub channel: String,
pub mode: RecencyMode,
}