pub struct StructuredJudge { /* private fields */ }Expand description
Structured LLM judge that produces typed verdicts.
Tries function calling first (via response schema), then falls back to prompting for JSON output with a lenient parser.
Calls meter against the current ModelCallScope, as
LlmJudge calls do.
Implementations§
Source§impl StructuredJudge
impl StructuredJudge
Sourcepub fn new(model: Arc<dyn Llm>) -> Self
pub fn new(model: Arc<dyn Llm>) -> Self
Create a new structured judge with default configuration.
Sourcepub fn with_config(model: Arc<dyn Llm>, config: StructuredJudgeConfig) -> Self
pub fn with_config(model: Arc<dyn Llm>, config: StructuredJudgeConfig) -> Self
Create a structured judge with custom configuration.
Sourcepub async fn judge(
&self,
expected: &str,
actual: &str,
criterion: &str,
) -> Result<StructuredVerdict>
pub async fn judge( &self, expected: &str, actual: &str, criterion: &str, ) -> Result<StructuredVerdict>
Judge a response against expected output with a specific criterion.
Tries function calling first, falls back to JSON extraction. On unparseable response, returns score 0.0 with parse error in reasoning.
Sourcepub async fn judge_with_rubric(
&self,
response: &str,
context: &str,
rubric: &JudgeRubric,
) -> Result<StructuredVerdict>
pub async fn judge_with_rubric( &self, response: &str, context: &str, rubric: &JudgeRubric, ) -> Result<StructuredVerdict>
Judge with a custom rubric.
Evaluates the response against the rubric’s scale points and produces a structured verdict.
Auto Trait Implementations§
impl !RefUnwindSafe for StructuredJudge
impl !UnwindSafe for StructuredJudge
impl Forget for StructuredJudge
impl Freeze for StructuredJudgewhere
*const ArcInner<dyn Llm> is !null: Freeze,
PhantomData<ArcInner<dyn Llm>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<JudgeRubric>: Freeze,
impl Move for StructuredJudge
impl Send for StructuredJudge
impl Sync for StructuredJudge
impl Unpin for StructuredJudge
impl UnsafeUnpin for StructuredJudgewhere
*const ArcInner<dyn Llm> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Llm>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<JudgeRubric>: UnsafeUnpin,
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