pub struct ModelJudge { /* private fields */ }Expand description
A structured LLM-as-judge adapter backed by any runtime ChatModel.
The operator-authored rubric is placed in the system instruction; run
evidence is isolated as untrusted user JSON. The model may return exactly
one submit_judgment tool call, or a bare JSON object when the provider
cannot force tool use. Both paths use the same strict schema. The model
supplies only score and rationale; the pass/fail bit is derived locally
from the configured threshold.
Implementations§
Source§impl ModelJudge
impl ModelJudge
Sourcepub fn new(model: Arc<dyn ChatModel>, rubric: impl Into<String>) -> Result<Self>
pub fn new(model: Arc<dyn ChatModel>, rubric: impl Into<String>) -> Result<Self>
Create a model-backed judge with an explicit, non-empty rubric.
Sourcepub fn with_pass_score(self, pass_score: f64) -> Result<Self>
pub fn with_pass_score(self, pass_score: f64) -> Result<Self>
Set the locally enforced passing threshold.
Sourcepub fn with_max_request_bytes(self, max_request_bytes: usize) -> Result<Self>
pub fn with_max_request_bytes(self, max_request_bytes: usize) -> Result<Self>
Bound the complete serialized input sent to the model.
This is a byte bound, not a token estimate. It provides a deterministic guardrail before provider-specific context-window accounting applies.
Sourcepub fn with_max_response_bytes(self, max_response_bytes: usize) -> Result<Self>
pub fn with_max_response_bytes(self, max_response_bytes: usize) -> Result<Self>
Bound the raw JSON or tool-argument verdict before schema parsing.