Expand description
RAG (Retrieval-Augmented Generation) module for LangChainRust.
Provides document loaders, text splitters, retrievers, BM25 search, hybrid retrieval, GraphRAG, HyDE, multi-query, reranking, multimodal (image+text) retrieval, and a full RAG pipeline builder.
Re-exports§
pub use adapter::RagRunnable;pub use contextual::ContextualConfig;pub use contextual::ContextualEnhancer;pub use contextual::ContextualError;pub use contextual::CONTEXTUAL_METADATA_KEY;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_cache::CacheHitKind;pub use semantic_cache::CachedRetriever;pub use semantic_cache::SemanticCacheConfig;pub use semantic_cache::SemanticCacheCore;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 multimodal::ImageAsset;pub use multimodal::MediaBlock;pub use multimodal::ModalityFilter;pub use multimodal::MultimodalChunkConfig;pub use multimodal::MultimodalChunker;pub use multimodal::MultimodalRetriever;pub use multimodal::MM_CAPTION_KEY;pub use multimodal::MM_KIND_IMAGE;pub use multimodal::MM_KIND_KEY;pub use multimodal::MM_KIND_TEXT;pub use multimodal::MM_MIME_KEY;pub use multimodal::MM_URL_KEY;pub use hyde::HyDEConfig;pub use hyde::HyDEError;pub use hyde::HyDERetriever;pub use late_chunking::late_chunk;pub use late_chunking::pool_tokens;pub use late_chunking::LateChunk;pub use late_chunking::LateChunkConfig;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::GlobalLevel;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
- contextual
- Contextual Retrieval: index-time context injection for chunks (0.21.0 S4.1).
- graph_
rag - GraphRAG (Knowledge Graph RAG) module.
- hybrid
- Hybrid retrieval module
- hyde
- HyDE (Hypothetical Document Embedding) Retriever implementation
- late_
chunking - Late chunking: embed the whole document token by token first, then pool along chunk boundaries (0.21.0 S5.2).
- loaders
- Document loader implementations
- multi_
query - MultiQueryRetriever implementation
- multimodal
- Multimodal (image + text) chunking and retrieval (B7, v0.22.4).
- 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_
cache - Semantic cache for retrieval results (0.21.0 S4.2).
- 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
- Image
Input - Provider-neutral image input for vision embedding models.
- 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.
- Vision
Embeddings - Cross-modal embedding model: images and text mapped to one shared space.
Functions§
- cosine_
similarity - Compute cosine similarity between two vectors.
Type Aliases§
- Chunked
Document Store - Type alias for
InMemoryChunkedDocumentStore