pub struct ContextViews { /* private fields */ }Expand description
Bounded view definitions for a single host-owned graph. Stores no duplicate documents.
Implementations§
Source§impl ContextViews
impl ContextViews
Sourcepub fn define(
&mut self,
spec: ContextViewSpec,
) -> Result<ContextViewHandle, ContextError>
pub fn define( &mut self, spec: ContextViewSpec, ) -> Result<ContextViewHandle, ContextError>
Define or replace a host-owned scope. Every replacement invalidates its old handles.
Sourcepub fn revoke(&mut self, id: &str) -> bool
pub fn revoke(&mut self, id: &str) -> bool
Revoke a scope. Existing context cannot be used through that view afterward.
Sourcepub fn compile(
&self,
graph: &ContextGraph,
handle: &ContextViewHandle,
request: &ContextRequest,
tokenizer: &impl TokenCounter,
) -> Result<ContextView, ContextError>
pub fn compile( &self, graph: &ContextGraph, handle: &ContextViewHandle, request: &ContextRequest, tokenizer: &impl TokenCounter, ) -> Result<ContextView, ContextError>
Compile against current authorized sources. Request allowed may only narrow access.
Sourcepub fn replace_source(
&self,
graph: &mut ContextGraph,
handle: &ContextViewHandle,
source: &str,
documents: Vec<Document>,
) -> Result<SourceUpdate, ContextError>
pub fn replace_source( &self, graph: &mut ContextGraph, handle: &ContextViewHandle, source: &str, documents: Vec<Document>, ) -> Result<SourceUpdate, ContextError>
Atomic replacement restricted to a writable source, including cross-source ID collisions.
Sourcepub fn check_answer(
&self,
graph: &ContextGraph,
handle: &ContextViewHandle,
context: &ContextView,
draft: &AnswerDraft,
reviews: &[ClaimReview],
policy: &AnswerPolicy,
tokenizer: &impl TokenCounter,
) -> Result<ContextViewAssessment, ContextError>
pub fn check_answer( &self, graph: &ContextGraph, handle: &ContextViewHandle, context: &ContextView, draft: &AnswerDraft, reviews: &[ClaimReview], policy: &AnswerPolicy, tokenizer: &impl TokenCounter, ) -> Result<ContextViewAssessment, ContextError>
Freshly validate the whole readable scope and recompile before applying trusted reviews. Alpha policy is conservative: ANY authorized document/edge change requires a new review, including unselected evidence. Unrelated writes outside this view do not invalidate it.
Sourcepub fn explain(
&self,
graph: &ContextGraph,
handle: &ContextViewHandle,
context: &ContextView,
tokenizer: &impl TokenCounter,
) -> Result<SelectionExplanation, ContextError>
pub fn explain( &self, graph: &ContextGraph, handle: &ContextViewHandle, context: &ContextView, tokenizer: &impl TokenCounter, ) -> Result<SelectionExplanation, ContextError>
Reconstruct only successful selection steps after checking the current whole scope. Revocation and any in-scope change invalidate the explanation, including unselected data.