pub struct QualityGate { /* private fields */ }Expand description
Write quality gate that runs after A-MAC admission.
Constructed once and attached to crate::semantic::SemanticMemory via
crate::semantic::SemanticMemory::with_quality_gate. Shared via Arc.
§Fail-open
Any internal error (embed failure, LLM timeout, graph query error) is caught
and treated as a pass. The gate never causes remember() to return an Err.
Implementations§
Source§impl QualityGate
impl QualityGate
Sourcepub fn new(config: QualityGateConfig) -> Self
pub fn new(config: QualityGateConfig) -> Self
Create a new quality gate with the given config.
Sourcepub fn with_llm_provider(self, provider: AnyProvider) -> Self
pub fn with_llm_provider(self, provider: AnyProvider) -> Self
Attach an LLM provider for optional blended scoring.
Sourcepub fn with_graph_store(self, store: Arc<GraphStore>) -> Self
pub fn with_graph_store(self, store: Arc<GraphStore>) -> Self
Attach a graph store for contradiction detection.
Sourcepub fn config(&self) -> &QualityGateConfig
pub fn config(&self) -> &QualityGateConfig
Return a reference to the configuration.
Sourcepub fn rejection_counts(&self) -> HashMap<QualityRejectionReason, u64>
pub fn rejection_counts(&self) -> HashMap<QualityRejectionReason, u64>
Return cumulative rejection counts per reason.
Sourcepub async fn evaluate(
&self,
content: &str,
embed_provider: &AnyProvider,
recent_embeddings: &[Vec<f32>],
) -> Option<QualityRejectionReason>
pub async fn evaluate( &self, content: &str, embed_provider: &AnyProvider, recent_embeddings: &[Vec<f32>], ) -> Option<QualityRejectionReason>
Evaluate the quality gate for a candidate write.
Returns None when the write passes (should be persisted).
Returns Some(reason) when the write should be rejected.
Failures inside scoring are caught and treated as pass (fail-open).
Auto Trait Implementations§
impl !Freeze for QualityGate
impl !RefUnwindSafe for QualityGate
impl Send for QualityGate
impl Sync for QualityGate
impl Unpin for QualityGate
impl UnsafeUnpin for QualityGate
impl !UnwindSafe for QualityGate
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
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request