pub struct StructuredJudge { /* private fields */ }Available on crate feature
eval only.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.
Implementations§
Source§impl StructuredJudge
impl StructuredJudge
Sourcepub fn new(model: Arc<dyn Llm>) -> StructuredJudge
pub fn new(model: Arc<dyn Llm>) -> StructuredJudge
Create a new structured judge with default configuration.
Sourcepub fn with_config(
model: Arc<dyn Llm>,
config: StructuredJudgeConfig,
) -> StructuredJudge
pub fn with_config( model: Arc<dyn Llm>, config: StructuredJudgeConfig, ) -> StructuredJudge
Create a structured judge with custom configuration.
Sourcepub async fn judge(
&self,
expected: &str,
actual: &str,
criterion: &str,
) -> Result<StructuredVerdict, EvalError>
pub async fn judge( &self, expected: &str, actual: &str, criterion: &str, ) -> Result<StructuredVerdict, EvalError>
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, EvalError>
pub async fn judge_with_rubric( &self, response: &str, context: &str, rubric: &JudgeRubric, ) -> Result<StructuredVerdict, EvalError>
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 Freeze for StructuredJudge
impl Send for StructuredJudge
impl Sync for StructuredJudge
impl Unpin for StructuredJudge
impl UnsafeUnpin for StructuredJudge
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