pub struct ConversationScorer { /* private fields */ }Available on crate feature
eval only.Expand description
Scores multi-turn conversations on quality metrics.
Uses a StructuredJudge for context retention, goal completion, and
coherence metrics. For topic drift, uses an [EmbeddingScorer] if available,
otherwise falls back to the structured judge.
Implementations§
Source§impl ConversationScorer
impl ConversationScorer
Sourcepub fn new(judge: StructuredJudge) -> ConversationScorer
pub fn new(judge: StructuredJudge) -> ConversationScorer
Create a new conversation scorer with default configuration.
Uses the structured judge for all metrics including topic drift.
Sourcepub fn with_config(
judge: StructuredJudge,
config: ConversationScorerConfig,
) -> ConversationScorer
Available on non-crate feature embedding only.
pub fn with_config( judge: StructuredJudge, config: ConversationScorerConfig, ) -> ConversationScorer
embedding only.Create a conversation scorer with custom configuration (no embedding).
Sourcepub fn config(&self) -> &ConversationScorerConfig
pub fn config(&self) -> &ConversationScorerConfig
Returns the current configuration.
Sourcepub async fn score(
&self,
conversation: &[Content],
goal: &str,
) -> Result<ConversationMetrics, EvalError>
pub async fn score( &self, conversation: &[Content], goal: &str, ) -> Result<ConversationMetrics, EvalError>
Score a multi-turn conversation.
Evaluates the conversation on four metrics:
- Context retention: Does the agent reference prior turn information?
- Goal completion: Does the agent achieve the stated objective?
- Coherence: Are consecutive responses logically consistent?
- Topic drift: Does the conversation stay on topic?
All scores are clamped to [0.0, 1.0].
§Errors
Returns an error if the judge LLM calls fail or the conversation is empty.
Auto Trait Implementations§
impl !RefUnwindSafe for ConversationScorer
impl !UnwindSafe for ConversationScorer
impl Freeze for ConversationScorer
impl Send for ConversationScorer
impl Sync for ConversationScorer
impl Unpin for ConversationScorer
impl UnsafeUnpin for ConversationScorer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more