pub struct GraphAwareLongTerm { /* private fields */ }Expand description
Graph-first RAG composer over a FilterableLongTermMemory vector
store + a KnowledgeGraph + an EntityExtractor.
Provenance recording is not the composer’s responsibility —
wrap the graph argument in
crate::ProvenanceKnowledgeGraph at construction time to emit
signed chain entries on every graph.index() call (ADR-038).
Implementations§
Source§impl GraphAwareLongTerm
impl GraphAwareLongTerm
Sourcepub fn new(
vector: Arc<dyn FilterableLongTermMemory>,
graph: Arc<dyn KnowledgeGraph>,
extractor: Arc<dyn EntityExtractor>,
metrics: Arc<RecallMetrics>,
) -> Self
pub fn new( vector: Arc<dyn FilterableLongTermMemory>, graph: Arc<dyn KnowledgeGraph>, extractor: Arc<dyn EntityExtractor>, metrics: Arc<RecallMetrics>, ) -> Self
Build with the default min_graph_hits = 1 threshold.
Sourcepub fn with_min_graph_hits(self, n: usize) -> Self
pub fn with_min_graph_hits(self, n: usize) -> Self
Override the minimum candidate count required to take the graph
path. When graph.neighbors() returns fewer than n FactIds,
recall falls back to pure vector. Default is 1.
Sourcepub fn builder() -> GraphAwareLongTermBuilder
pub fn builder() -> GraphAwareLongTermBuilder
Capability-shaped builder facade — defaults the extractor to
BuiltinExtractor (regex over caller hints + typed-id
patterns) and the metrics to a fresh RecallMetrics.
let long_term = GraphAwareLongTerm::builder().build(vector, graph);Override defaults via the builder’s setters; pass the
authoritative vector store + graph at GraphAwareLongTermBuilder::build
time since both are required.
Sourcepub async fn recall_traced(
&self,
scope: Scope,
query: &str,
k: usize,
) -> Result<RecallTrace, MemoryError>
pub async fn recall_traced( &self, scope: Scope, query: &str, k: usize, ) -> Result<RecallTrace, MemoryError>
The “why did retrieval return this?” trace behind one recall call.
Runs the exact same Self::recall_core that
LongTermMemory::recall uses, then additionally fetches
KnowledgeGraph::recall_paths for display. Production recall
never issues that second graph call — this method is the only path
that pays for it.
Records no RecallMetrics — it’s a debug/introspection call, not
production recall traffic.
Trait Implementations§
Source§impl LongTermMemory for GraphAwareLongTerm
impl LongTermMemory for GraphAwareLongTerm
Source§fn remember<'life0, 'async_trait>(
&'life0 self,
scope: Scope,
fact: Fact,
) -> Pin<Box<dyn Future<Output = Result<FactId, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remember<'life0, 'async_trait>(
&'life0 self,
scope: Scope,
fact: Fact,
) -> Pin<Box<dyn Future<Output = Result<FactId, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
scope. Returns a stable id.Source§fn recall<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: Scope,
query: &'life1 str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recall<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: Scope,
query: &'life1 str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Fact>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
k semantic recall under scope for the supplied query.