use std::collections::HashMap;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
pub struct PredictionMetrics {
pub sample_count: u32,
pub mean: f64,
pub p50: f64,
pub p90: f64,
pub p95: f64,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
pub struct LlmCallPrediction {
pub remaining_calls: PredictionMetrics,
pub interarrival_ms: PredictionMetrics,
pub output_tokens: PredictionMetrics,
pub latency_sensitivity: Option<u32>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PredictionTrieNode {
pub name: String,
pub children: HashMap<String, PredictionTrieNode>,
pub predictions_by_call_index: HashMap<u32, LlmCallPrediction>,
pub predictions_any_index: Option<LlmCallPrediction>,
}
impl PredictionTrieNode {
pub fn new(name: impl Into<String>) -> Self {
Self {
name: name.into(),
children: HashMap::new(),
predictions_by_call_index: HashMap::new(),
predictions_any_index: None,
}
}
}
#[cfg(test)]
#[path = "../../tests/unit/trie/data_models_tests.rs"]
mod tests;