pub struct CustomAsyncValidator<F> { /* private fields */ }Expand description
Wraps an async closure as an AsyncValidator — the escape hatch for checks this
crate can’t sensibly hardcode. Return Ok(()) to pass, Err(reason) to fail.
ⓘ
let no_hallucination = CustomAsyncValidator::new("grounded_in_context", |text| async move {
if ask_llm_judge(&text).await { Ok(()) } else { Err("not grounded in retrieved context".into()) }
});Implementations§
Trait Implementations§
Source§impl<F, Fut> AsyncValidator for CustomAsyncValidator<F>
impl<F, Fut> AsyncValidator for CustomAsyncValidator<F>
Auto Trait Implementations§
impl<F> Freeze for CustomAsyncValidator<F>where
F: Freeze,
impl<F> RefUnwindSafe for CustomAsyncValidator<F>where
F: RefUnwindSafe,
impl<F> Send for CustomAsyncValidator<F>where
F: Send,
impl<F> Sync for CustomAsyncValidator<F>where
F: Sync,
impl<F> Unpin for CustomAsyncValidator<F>where
F: Unpin,
impl<F> UnsafeUnpin for CustomAsyncValidator<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for CustomAsyncValidator<F>where
F: UnwindSafe,
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