pub struct GraphRagEnricher { /* private fields */ }Expand description
Graph-RAG enricher that adds graph context to search results
Implementations§
Source§impl GraphRagEnricher
impl GraphRagEnricher
Sourcepub fn new(config: GraphRagConfig) -> GraphRagEnricher
pub fn new(config: GraphRagConfig) -> GraphRagEnricher
Create a new enricher with the given configuration
Sourcepub fn with_defaults() -> GraphRagEnricher
pub fn with_defaults() -> GraphRagEnricher
Create with default configuration
Sourcepub fn should_enrich(&self, graph: &SimpleEntityGraph) -> bool
pub fn should_enrich(&self, graph: &SimpleEntityGraph) -> bool
Check if graph is large enough for enrichment
Sourcepub fn extract_graph_entities(
&self,
graph: &SimpleEntityGraph,
text: &str,
) -> Vec<String>
pub fn extract_graph_entities( &self, graph: &SimpleEntityGraph, text: &str, ) -> Vec<String>
Extract entities from text that exist in the graph
Find related entities with depth limit and cycle detection
Sourcepub fn filter_relevant_relations(
&self,
relations: &[RelationInfo],
query_entities: &[String],
graph: &SimpleEntityGraph,
) -> Vec<RelationInfo>
pub fn filter_relevant_relations( &self, relations: &[RelationInfo], query_entities: &[String], graph: &SimpleEntityGraph, ) -> Vec<RelationInfo>
Filter relations by relevance to query context
A relation is considered relevant if:
- The target entity appears in query entities
- The target entity shares context with query entities (common neighbors)
- The relation type is high-priority (causes, depends_on, etc.)
Sourcepub fn summarize_path(
&self,
path: &[String],
graph: &SimpleEntityGraph,
) -> String
pub fn summarize_path( &self, path: &[String], graph: &SimpleEntityGraph, ) -> String
Summarize a path with relationship types
Converts: [“payment”, “database”, “timeout”] To: “payment ─DEPENDS_ON→ database ─CAUSED_BY→ timeout”
Sourcepub fn relation_relevance_score(
&self,
relation: &RelationInfo,
query_entities: &[String],
query_neighbors: &HashSet<String>,
) -> u32
pub fn relation_relevance_score( &self, relation: &RelationInfo, query_entities: &[String], query_neighbors: &HashSet<String>, ) -> u32
Calculate relevance score for a relation (exposed for testing)
Sourcepub fn analyze_query(
&self,
graph: &SimpleEntityGraph,
query_entities: &[String],
) -> GlobalGraphInsights
pub fn analyze_query( &self, graph: &SimpleEntityGraph, query_entities: &[String], ) -> GlobalGraphInsights
Analyze query and build global insights
Sourcepub fn enrich_result(
&self,
graph: &SimpleEntityGraph,
content: &str,
query_entities: &[String],
) -> GraphEnrichment
pub fn enrich_result( &self, graph: &SimpleEntityGraph, content: &str, query_entities: &[String], ) -> GraphEnrichment
Enrich a single search result with graph context
Sourcepub fn find_cross_result_insights(
&self,
graph: &SimpleEntityGraph,
result_entities: &[Vec<String>],
) -> Vec<String>
pub fn find_cross_result_insights( &self, graph: &SimpleEntityGraph, result_entities: &[Vec<String>], ) -> Vec<String>
Find structural insights between top results Now uses path summarization to show relationship types
Sourcepub fn cleanup_cache(&self)
pub fn cleanup_cache(&self)
Clear expired cache entries
Sourcepub fn cache_stats(&self) -> (usize, usize)
pub fn cache_stats(&self) -> (usize, usize)
Get cache statistics
Auto Trait Implementations§
impl Freeze for GraphRagEnricher
impl !RefUnwindSafe for GraphRagEnricher
impl Send for GraphRagEnricher
impl Sync for GraphRagEnricher
impl Unpin for GraphRagEnricher
impl UnsafeUnpin for GraphRagEnricher
impl !UnwindSafe for GraphRagEnricher
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::RequestSource§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::RequestSource§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