pub struct LLMAsJudge<M: BaseChatModel> { /* private fields */ }Expand description
LLM-judge evaluator: has the LLM score the prediction against a rubric (0 to max_score).
Implementations§
Source§impl<M: BaseChatModel> LLMAsJudge<M>
impl<M: BaseChatModel> LLMAsJudge<M>
Sourcepub fn new(judge: M) -> Self
pub fn new(judge: M) -> Self
Creates an LLM-judge evaluator using the default rubric on a 10-point scale.
Sourcepub fn with_rubric(self, rubric: impl Into<String>) -> Self
pub fn with_rubric(self, rubric: impl Into<String>) -> Self
Sets a custom rubric (builder style).
Sourcepub fn with_max_score(self, max_score: u8) -> Self
pub fn with_max_score(self, max_score: u8) -> Self
Sets the maximum score (at least 1).
Trait Implementations§
Source§impl<M: BaseChatModel> Evaluator for LLMAsJudge<M>
impl<M: BaseChatModel> Evaluator for LLMAsJudge<M>
Source§fn eval<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
input: &'life1 str,
prediction: &'life2 str,
reference: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Score, EvalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn eval<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
input: &'life1 str,
prediction: &'life2 str,
reference: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Score, EvalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Scores a single prediction
Auto Trait Implementations§
impl<M> Freeze for LLMAsJudge<M>where
M: Freeze,
impl<M> RefUnwindSafe for LLMAsJudge<M>where
M: RefUnwindSafe,
impl<M> Send for LLMAsJudge<M>
impl<M> Sync for LLMAsJudge<M>
impl<M> Unpin for LLMAsJudge<M>where
M: Unpin,
impl<M> UnsafeUnpin for LLMAsJudge<M>where
M: UnsafeUnpin,
impl<M> UnwindSafe for LLMAsJudge<M>where
M: UnwindSafe,
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