Expand description
RAG (Retrieval-Augmented Generation) module for LangChainRust.
Provides document loaders, text splitters, retrievers, BM25 search, hybrid retrieval, GraphRAG, HyDE, multi-query, reranking, and a full RAG pipeline builder.
Re-exports§
pub use adapter::RagRunnable;pub use parent_document::ParentDocumentRetriever;pub use pipeline::RAGPipeline;pub use pipeline::RAGPipelineBuilder;pub use pipeline::RAGQueryResult;pub use retriever_runnable::RetrieverRunnable;pub use loaders::CSVLoader;pub use loaders::DocumentLoader;pub use loaders::DocxLoader;pub use loaders::HTMLLoader;pub use loaders::JSONLoader;pub use loaders::LoaderError;pub use loaders::MarkdownLoader;pub use loaders::PDFLoader;pub use loaders::SitemapLoader;pub use loaders::TextLoader;pub use loaders::WebScraperLoader;pub use retriever::Retriever;pub use retriever::RetrieverError;pub use retriever::RetrieverTrait;pub use retriever::SimilarityRetriever;pub use self_query::SelfQueryArgs;pub use self_query::SelfQueryRetriever;pub use semantic_splitter::SemanticSplitter;pub use bm25::AutoMergingConfig;pub use bm25::BM25Params;pub use bm25::BM25Retriever;pub use bm25::ChunkedBM25Retriever;pub use bm25::ChunkedSearchResult;pub use bm25::Tokenizer;pub use hybrid::filter_by_score;pub use hybrid::reciprocal_rank_fusion;pub use hybrid::RetrievalSource;pub use hybrid::RetrievedDocument;pub use unified_hybrid::HybridIndexConfig;pub use unified_hybrid::HybridSearchResult;pub use unified_hybrid::UnifiedHybridIndex;pub use multi_query::MultiQueryConfig;pub use multi_query::MultiQueryError;pub use multi_query::MultiQueryRetriever;pub use multi_query::StaticQueryGenerator;pub use hyde::HyDEConfig;pub use hyde::HyDEError;pub use hyde::HyDERetriever;pub use reranking::BM25Reranker;pub use reranking::KeywordReranker;pub use reranking::Reranker;pub use reranking::RerankingConfig;pub use reranking::RerankingError;pub use reranking::RerankingExecutor;pub use graph_rag::Community as GraphCommunity;pub use graph_rag::Entity as GraphEntity;pub use graph_rag::GraphStore;pub use graph_rag::Relation as GraphRelation;pub use graph_rag::GraphRAG;pub use graph_rag::GraphRAGConfig;pub use graph_rag::GraphRAGError;pub use graph_rag::GraphRAGResult;pub use graph_rag::QueryMode;
Modules§
- adapter
- RagRunnable adapter - bridges RAGPipeline to the Runnable trait.
- bm25
- BM25 retrieval module
- graph_
rag - GraphRAG (Knowledge Graph RAG) module.
- hybrid
- Hybrid retrieval module
- hyde
- HyDE (Hypothetical Document Embedding) Retriever implementation
- loaders
- Document loader implementations
- multi_
query - MultiQueryRetriever implementation
- parent_
document - ParentDocumentRetriever — a parent/child document retriever
- pipeline
- RAGPipeline & RAGPipelineBuilder — a complete RAG pipeline in one line
- reranking
- Reranking implementation
- retriever
- Retriever implementations
- retriever_
runnable - RetrieverRunnable — a Runnable adapter to bring any retriever into an LCEL chain
- self_
query - SelfQueryRetriever — a self-querying retriever
- semantic_
splitter - Semantic chunking
- splitter
- Text splitter implementation
- unified_
hybrid - Unified Hybrid Index
Structs§
- Chunk
Document - Chunk document (split document fragment).
- Chunked
Vector Store - Chunked Vector Store
- Document
- Document structure.
- InMemory
Document Store - In-memory document store
- InMemory
Vector Store - In-memory vector store
- Mock
Embeddings - Mock embeddings for testing purposes.
- OpenAI
Embeddings - OpenAI Embeddings client
- Recursive
Character Splitter - Recursive character splitter
- Search
Result - Search result.
Enums§
- Embedding
Error - Embedding error type
- Vector
Store Error - Vector store error types.
Traits§
- Chunked
Document Store Trait - Document store trait supporting a parent-child structure
- Document
Store - Document store trait
- Embeddings
- Embedding model trait
- Text
Splitter - Text splitter trait
- Vector
Store - Vector store trait.
Functions§
- cosine_
similarity - Compute cosine similarity between two vectors.
Type Aliases§
- Chunked
Document Store - Type alias for
InMemoryChunkedDocumentStore