pub struct GraphRAGConfig {
pub max_entities_per_doc: usize,
pub max_relations_per_doc: usize,
pub community_size_tiers: usize,
pub max_context_tokens: Option<usize>,
pub entity_matcher: Option<Box<dyn EntityMatcher>>,
}Expand description
Configuration for GraphRAG.
Fields§
§max_entities_per_doc: usizeMaximum number of entities to extract per document.
max_relations_per_doc: usizeMaximum number of relations to extract per document.
community_size_tiers: usize社区大小分桶数(P1-3)。
注意:这是大小分桶(size tiering),不是经典层级社区(父-子包含关系)。
社区按大小排名均分为这么多档,Community::level 表示“第几档大小“。
max_context_tokens: Option<usize>Maximum number of tokens for context in query prompts. When set, community summaries or subgraph context is truncated to fit.
entity_matcher: Option<Box<dyn EntityMatcher>>Custom entity matcher for local/hybrid queries. When None, uses the default KeywordMatcher.
Implementations§
Source§impl GraphRAGConfig
impl GraphRAGConfig
Sourcepub fn with_max_entities_per_doc(self, n: usize) -> Self
pub fn with_max_entities_per_doc(self, n: usize) -> Self
Sets the maximum number of entities to extract per document.
Sourcepub fn with_max_relations_per_doc(self, n: usize) -> Self
pub fn with_max_relations_per_doc(self, n: usize) -> Self
Sets the maximum number of relations to extract per document.
Sourcepub fn with_community_size_tiers(self, n: usize) -> Self
pub fn with_community_size_tiers(self, n: usize) -> Self
设置社区大小分桶数(P1-3,见 GraphRAGConfig::community_size_tiers)。
Sourcepub fn with_max_context_tokens(self, tokens: usize) -> Self
pub fn with_max_context_tokens(self, tokens: usize) -> Self
Sets the maximum number of tokens for context in query prompts.
When set, community summaries (Global/Hybrid) or subgraph context (Local/Hybrid) are truncated from lowest-priority items to fit within this budget.
Sourcepub fn with_entity_matcher(self, matcher: Box<dyn EntityMatcher>) -> Self
pub fn with_entity_matcher(self, matcher: Box<dyn EntityMatcher>) -> Self
Sets a custom entity matcher for local/hybrid queries.
When set, the matcher is used instead of the default keyword-based matching to find relevant entities.