entrenar/citl/pattern_store/suggestion.rs
1//! Fix suggestion representation for retrieval results.
2
3use super::FixPattern;
4
5/// A suggested fix from the pattern store
6#[derive(Debug, Clone)]
7pub struct FixSuggestion {
8 /// The fix pattern
9 pub pattern: FixPattern,
10 /// Retrieval score from the RAG pipeline
11 pub score: f32,
12 /// Rank in the result set
13 pub rank: usize,
14}
15
16impl FixSuggestion {
17 /// Create a new fix suggestion
18 #[must_use]
19 pub fn new(pattern: FixPattern, score: f32, rank: usize) -> Self {
20 Self { pattern, score, rank }
21 }
22
23 /// Get the weighted score (retrieval score * success rate)
24 #[must_use]
25 pub fn weighted_score(&self) -> f32 {
26 self.score * (0.5 + 0.5 * self.pattern.success_rate())
27 }
28}