pub trait JudgeProvider: Send + Sync {
// Required method
fn judge<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
input_body: &'life1 str,
original_response: &'life2 str,
proposed_response: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(JudgeVerdict, String), QualityError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
}Expand description
Pluggable judge backend. Production: an LLM provider call. Tests:
MockJudge.
Required Methods§
Sourcefn judge<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
input_body: &'life1 str,
original_response: &'life2 str,
proposed_response: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(JudgeVerdict, String), QualityError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn judge<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
input_body: &'life1 str,
original_response: &'life2 str,
proposed_response: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(JudgeVerdict, String), QualityError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Compare an “original” response and a “proposed” response for the same input. Return a verdict + one-line reason.
§Errors
Returns QualityError::Judge when the underlying provider fails
in a way the caller should surface to the user (e.g. auth failure,
rate-limit exhaustion). Implementations that recover internally via
retry should return JudgeVerdict::Unclear rather than erroring.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".