pub struct CompiledChecks { /* private fields */ }Expand description
A node’s accept list, with schemas already compiled.
Compiled once at daemon startup rather than per attempt: a malformed schema is a property of the spec, so it should stop the daemon coming up rather than surface as a bizarre acceptance failure partway through a campaign.
Implementations§
Source§impl CompiledChecks
impl CompiledChecks
Sourcepub fn compile(checks: &[AcceptCheck]) -> Result<Self>
pub fn compile(checks: &[AcceptCheck]) -> Result<Self>
Read and compile every Schema, and collect every Judge.
Fails if a schema file is unreadable or is not a valid JSON Schema.
Sourcepub fn check_schemas(&self, value: &Value) -> Result<(), String>
pub fn check_schemas(&self, value: &Value) -> Result<(), String>
Validate value against every compiled schema.
Reports all violations rather than only the first, matching
cuttlefish validate-json: someone fixing a prompt wants the whole
list, not one round trip per mistake.
Sourcepub async fn run_judges(
&self,
input: &Value,
output: &Value,
default: &Arc<dyn InferBackend>,
alternates: &Alternates,
) -> JudgeVerdict
pub async fn run_judges( &self, input: &Value, output: &Value, default: &Arc<dyn InferBackend>, alternates: &Alternates, ) -> JudgeVerdict
Ask every judge, in order, stopping at the first non-acceptance.
default serves a judge that named no model of its own; alternates
serves one that did. A judge naming a model absent from alternates
is JudgeVerdict::Unusable rather than a panic — startup resolution
should have caught it, so reaching here means a bug, and failing the
attempt beats taking the daemon down mid-campaign.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CompiledChecks
impl !UnwindSafe for CompiledChecks
impl Freeze for CompiledChecks
impl Send for CompiledChecks
impl Sync for CompiledChecks
impl Unpin for CompiledChecks
impl UnsafeUnpin for CompiledChecks
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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