Skip to main content

Crate graphrag_core

Crate graphrag_core 

Source
Expand description

§GraphRAG Core

Portable core library for GraphRAG - works on both native and WASM platforms.

This is the foundational crate that provides:

  • Knowledge graph construction and management
  • Entity extraction and linking
  • Vector embeddings and similarity search
  • Graph algorithms (PageRank, community detection)
  • Retrieval systems (semantic, keyword, hybrid)
  • Caching and optimization

§Platform Support

  • Native: Full feature set with optional CUDA/Metal GPU acceleration
  • WASM: Browser-compatible with Voy vector search and Candle embeddings

§Feature Flags

  • wasm: Enable WASM compatibility (uses Voy instead of HNSW)
  • cuda: Enable NVIDIA GPU acceleration via Candle
  • metal: Enable Apple Silicon GPU acceleration
  • webgpu: Enable WebGPU acceleration for browser (via Burn)
  • pagerank: Enable PageRank-based retrieval
  • lightrag: Enable LightRAG optimizations (6000x token reduction)
  • caching: Enable intelligent LLM response caching

§Quick Start

use graphrag_core::{GraphRAG, Config};

let config = Config::default();
let mut graphrag = GraphRAG::new(config)?;
graphrag.initialize()?;

Re-exports§

pub use crate::config::Config;
pub use crate::core::ChunkId;
pub use crate::core::Document;
pub use crate::core::DocumentId;
pub use crate::core::Entity;
pub use crate::core::EntityId;
pub use crate::core::EntityMention;
pub use crate::core::ErrorContext;
pub use crate::core::ErrorSeverity;
pub use crate::core::GraphRAGError;
pub use crate::core::KnowledgeGraph;
pub use crate::core::Relationship;
pub use crate::core::Result;
pub use crate::core::TextChunk;
pub use crate::core::traits::Embedder;
pub use crate::core::traits::EntityExtractor;
pub use crate::core::traits::GraphStore;
pub use crate::core::traits::LanguageModel;
pub use crate::core::traits::Retriever;
pub use crate::core::traits::Storage;
pub use crate::core::traits::VectorStore;
pub use crate::storage::MemoryStorage;

Modules§

async_graphrag
Async GraphRAG implementation Async GraphRAG System
async_processing
Async processing pipelines Async processing utilities for GraphRAG operations
builder
Builder pattern implementations GraphRAG builder module
config
Configuration management and loading
core
Core traits and types Core data structures and abstractions for GraphRAG
embeddings
Embedding generation and providers Embedding generation for GraphRAG
entity
Entity extraction and management
evaluation
Evaluation framework for query results and pipeline validation Evaluation framework for GraphRAG system
generation
Text generation and LLM interactions (async feature only)
graph
Graph data structures and algorithms
inference
Inference module for model predictions Implicit relationship inference system
monitoring
Monitoring, benchmarking, and performance tracking Monitoring and benchmarking utilities for GraphRAG
nlp
Natural language processing utilities Advanced NLP Module
ollama
Ollama LLM integration Ollama LLM integration
parallel
Parallel processing utilities for GraphRAG
persistence
Persistence layer for knowledge graphs (workspace management always available) Persistence layer for GraphRAG knowledge graphs
pipeline
Data processing pipelines Pipeline Module
prelude
Prelude module containing the most commonly used types
query
Query processing and execution
reranking
Reranking utilities for improving search result quality Reranking module for improving retrieval accuracy
retrieval
Retrieval strategies and implementations
storage
Storage backends and persistence Storage layer for GraphRAG
summarization
Text summarization capabilities
text
Text processing and chunking
vector
Vector operations and embeddings

Macros§

config_error
Helper macros for creating specific error types
generation_error
Creates a generation error with a message
retrieval_error
Creates a retrieval error with a message
storage_error
Creates a storage error with a message

Structs§

GraphRAG
Main GraphRAG system