pub struct LlmJudge { /* private fields */ }Available on crate feature
eval only.Expand description
LLM-based judge for semantic evaluation
Implementations§
Source§impl LlmJudge
impl LlmJudge
Sourcepub fn with_config(model: Arc<dyn Llm>, config: LlmJudgeConfig) -> LlmJudge
pub fn with_config(model: Arc<dyn Llm>, config: LlmJudgeConfig) -> LlmJudge
Create with custom config
Sourcepub async fn semantic_match(
&self,
expected: &str,
actual: &str,
config: Option<&SemanticMatchConfig>,
) -> Result<SemanticMatchResult, EvalError>
pub async fn semantic_match( &self, expected: &str, actual: &str, config: Option<&SemanticMatchConfig>, ) -> Result<SemanticMatchResult, EvalError>
Judge semantic similarity between expected and actual responses
Returns a score from 0.0 to 1.0 indicating semantic equivalence.
Sourcepub async fn evaluate_rubrics(
&self,
response: &str,
context: &str,
config: &RubricConfig,
) -> Result<RubricEvaluationResult, EvalError>
pub async fn evaluate_rubrics( &self, response: &str, context: &str, config: &RubricConfig, ) -> Result<RubricEvaluationResult, EvalError>
Evaluate response against rubrics
Returns scores for each rubric and an overall weighted score.
Sourcepub async fn evaluate_safety(
&self,
response: &str,
) -> Result<SafetyResult, EvalError>
pub async fn evaluate_safety( &self, response: &str, ) -> Result<SafetyResult, EvalError>
Evaluate safety of a response
Sourcepub async fn detect_hallucinations(
&self,
response: &str,
context: &str,
ground_truth: Option<&str>,
) -> Result<HallucinationResult, EvalError>
pub async fn detect_hallucinations( &self, response: &str, context: &str, ground_truth: Option<&str>, ) -> Result<HallucinationResult, EvalError>
Detect potential hallucinations in a response
Auto Trait Implementations§
impl Freeze for LlmJudge
impl !RefUnwindSafe for LlmJudge
impl Send for LlmJudge
impl Sync for LlmJudge
impl Unpin for LlmJudge
impl UnsafeUnpin for LlmJudge
impl !UnwindSafe for LlmJudge
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.