pub struct TemporalGraphRag { /* private fields */ }Expand description
A lightweight retrieval engine that wraps TemporalKnowledgeGraph and
scores triples by keyword overlap with a natural-language question.
Implementations§
Source§impl TemporalGraphRag
impl TemporalGraphRag
Sourcepub fn ingest_event(
&mut self,
subject: &str,
predicate: &str,
object: &str,
timestamp: i64,
confidence: f64,
)
pub fn ingest_event( &mut self, subject: &str, predicate: &str, object: &str, timestamp: i64, confidence: f64, )
Ingest a new event into the underlying knowledge graph.
timestamp is the Unix-ms start time; the triple is treated as
“still valid” (no valid_to).
Sourcepub fn query(
&self,
question: &str,
timestamp: i64,
top_k: usize,
) -> Vec<TemporalTriple>
pub fn query( &self, question: &str, timestamp: i64, top_k: usize, ) -> Vec<TemporalTriple>
Retrieve up to top_k triples valid at timestamp that are most
relevant to question, ranked by keyword overlap score.
Sourcepub fn summarize_entity_history(&self, entity: &str) -> EntityHistory
pub fn summarize_entity_history(&self, entity: &str) -> EntityHistory
Summarise all historical appearances of entity in the knowledge graph.
Sourcepub fn cache_embedding(&mut self, entity: &str, embedding: Vec<f32>)
pub fn cache_embedding(&mut self, entity: &str, embedding: Vec<f32>)
Store an embedding vector for entity in the cache.
Sourcepub fn get_embedding(&self, entity: &str) -> Option<&Vec<f32>>
pub fn get_embedding(&self, entity: &str) -> Option<&Vec<f32>>
Retrieve a cached embedding, if present.
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Number of events ingested.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TemporalGraphRag
impl RefUnwindSafe for TemporalGraphRag
impl Send for TemporalGraphRag
impl Sync for TemporalGraphRag
impl Unpin for TemporalGraphRag
impl UnsafeUnpin for TemporalGraphRag
impl UnwindSafe for TemporalGraphRag
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
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>
Converts
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>
Converts
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