pub struct PairwiseJudge<M: BaseChatModel> { /* private fields */ }Expand description
成对比较评测器(用 LLM 当裁判,二选一)。
P1-1: 实现 PairwiseEvaluator trait,可与单点 Evaluator 一起进 EvalRunner
统一报告;直接调用仍可走 compare 拿细粒度 Verdict(A 赢 / B 赢 / 平局)。
Implementations§
Source§impl<M: BaseChatModel> PairwiseJudge<M>
impl<M: BaseChatModel> PairwiseJudge<M>
Sourcepub fn with_rubric(self, rubric: impl Into<String>) -> Self
pub fn with_rubric(self, rubric: impl Into<String>) -> Self
设置自定义评分标准(builder 风格)。
Trait Implementations§
Source§impl<M: BaseChatModel> PairwiseEvaluator for PairwiseJudge<M>
P1-1: 作为 PairwiseEvaluator 进 EvalRunner,judge 以
(a=prediction, b=reference) 为两个候选。得分映射:1.0 = A 优、
0.5 = 平局、0.0 = B 优,label 保留裁决含义(a_wins / tie / b_wins)。
impl<M: BaseChatModel> PairwiseEvaluator for PairwiseJudge<M>
P1-1: 作为 PairwiseEvaluator 进 EvalRunner,judge 以
(a=prediction, b=reference) 为两个候选。得分映射:1.0 = A 优、
0.5 = 平局、0.0 = B 优,label 保留裁决含义(a_wins / tie / b_wins)。
Source§fn eval_pair<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
input: &'life1 str,
a: &'life2 str,
b: &'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_pair<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
input: &'life1 str,
a: &'life2 str,
b: &'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,
比较 A、B 两个回答,返回 0-1 得分
(1.0 = A 优,0.5 = 平局,0.0 = B 优)。
Auto Trait Implementations§
impl<M> Freeze for PairwiseJudge<M>where
M: Freeze,
impl<M> RefUnwindSafe for PairwiseJudge<M>where
M: RefUnwindSafe,
impl<M> Send for PairwiseJudge<M>
impl<M> Sync for PairwiseJudge<M>
impl<M> Unpin for PairwiseJudge<M>where
M: Unpin,
impl<M> UnsafeUnpin for PairwiseJudge<M>where
M: UnsafeUnpin,
impl<M> UnwindSafe for PairwiseJudge<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