pub struct RelevanceJudge { /* private fields */ }Expand description
LLM-based relevance judge
Implementations§
Source§impl RelevanceJudge
impl RelevanceJudge
Sourcepub fn new(client: AnthropicClient, model: &str, cache: JudgeCache) -> Self
pub fn new(client: AnthropicClient, model: &str, cache: JudgeCache) -> Self
Create a new judge
Sourcepub async fn judge(
&mut self,
query: &str,
content: &str,
) -> Result<JudgeVerdict, String>
pub async fn judge( &mut self, query: &str, content: &str, ) -> Result<JudgeVerdict, String>
Judge whether a chunk is relevant to a query
Sourcepub fn cache(&self) -> &JudgeCache
pub fn cache(&self) -> &JudgeCache
Get the current cache (for saving)
Sourcepub async fn evaluate(
&mut self,
results: &[RetrievalResultEntry],
top_k: usize,
) -> Result<EvalOutput, String>
pub async fn evaluate( &mut self, results: &[RetrievalResultEntry], top_k: usize, ) -> Result<EvalOutput, String>
Run full evaluation: judge all retrieval results and compute metrics
Auto Trait Implementations§
impl Freeze for RelevanceJudge
impl !RefUnwindSafe for RelevanceJudge
impl Send for RelevanceJudge
impl Sync for RelevanceJudge
impl Unpin for RelevanceJudge
impl UnsafeUnpin for RelevanceJudge
impl !UnwindSafe for RelevanceJudge
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> 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 more