entrenar/monitor/llm/
traits.rs1use crate::monitor::llm::{EvalResult, LLMMetrics, LLMStats, PromptVersion, Result};
4
5pub trait LLMEvaluator: Send + Sync {
7 fn evaluate_response(
9 &self,
10 prompt: &str,
11 response: &str,
12 reference: Option<&str>,
13 ) -> Result<EvalResult>;
14
15 fn log_llm_call(&mut self, run_id: &str, metrics: LLMMetrics) -> Result<()>;
17
18 fn track_prompt(&mut self, run_id: &str, prompt: &PromptVersion) -> Result<()>;
20
21 fn get_metrics(&self, run_id: &str) -> Result<Vec<LLMMetrics>>;
23
24 fn get_prompts(&self, run_id: &str) -> Result<Vec<PromptVersion>>;
26
27 fn get_stats(&self, run_id: &str) -> Result<LLMStats>;
29}