Skip to main content

lc_rag/
lib.rs

1#![warn(missing_docs)]
2// lc-rag/src/lib.rs
3//! RAG (Retrieval-Augmented Generation) module for LangChainRust.
4//!
5//! Provides document loaders, text splitters, retrievers, BM25 search,
6//! hybrid retrieval, GraphRAG, HyDE, multi-query, reranking, and
7//! a full RAG pipeline builder.
8
9pub mod adapter;
10pub mod bm25;
11pub mod graph_rag;
12pub mod hybrid;
13pub mod hyde;
14pub mod loaders;
15pub mod multi_query;
16pub mod parent_document;
17pub mod pipeline;
18pub mod reranking;
19pub mod retriever;
20pub mod retriever_runnable;
21pub mod semantic_splitter;
22pub mod splitter;
23mod structured;
24pub mod unified_hybrid;
25
26pub use adapter::RagRunnable;
27pub use parent_document::ParentDocumentRetriever;
28pub use pipeline::{RAGPipeline, RAGPipelineBuilder, RAGQueryResult};
29pub use retriever_runnable::RetrieverRunnable;
30
31pub use loaders::{
32    CSVLoader, DocumentLoader, DocxLoader, HTMLLoader, JSONLoader, LoaderError, MarkdownLoader,
33    PDFLoader, SitemapLoader, TextLoader, WebScraperLoader,
34};
35pub use retriever::{Retriever, RetrieverError, RetrieverTrait, SimilarityRetriever};
36pub use semantic_splitter::SemanticSplitter;
37pub use splitter::{RecursiveCharacterSplitter, TextSplitter};
38
39pub use bm25::{
40    AutoMergingConfig, BM25Params, BM25Retriever, ChunkedBM25Retriever, ChunkedSearchResult,
41    Tokenizer,
42};
43
44pub use hybrid::{filter_by_score, reciprocal_rank_fusion, RetrievalSource, RetrievedDocument};
45pub use unified_hybrid::{HybridIndexConfig, HybridSearchResult, UnifiedHybridIndex};
46
47pub use multi_query::{
48    MultiQueryConfig, MultiQueryError, MultiQueryRetriever, StaticQueryGenerator,
49};
50
51pub use hyde::{HyDEConfig, HyDEError, HyDERetriever};
52
53pub use reranking::{
54    BM25Reranker, KeywordReranker, Reranker, RerankingConfig, RerankingError, RerankingExecutor,
55};
56
57pub use graph_rag::{
58    Community as GraphCommunity, Entity as GraphEntity, GraphStore, Relation as GraphRelation,
59};
60pub use graph_rag::{GraphRAG, GraphRAGConfig, GraphRAGError, GraphRAGResult, QueryMode};
61
62// Re-export key types from dependency crates for convenience
63pub use lc_embeddings::{
64    cosine_similarity, EmbeddingError, Embeddings, MockEmbeddings, OpenAIEmbeddings,
65};
66pub use lc_vector_stores::{
67    ChunkDocument, ChunkedDocumentStore, ChunkedDocumentStoreTrait, ChunkedVectorStore,
68    DocumentStore, InMemoryDocumentStore,
69};
70pub use lc_vector_stores::{
71    Document, InMemoryVectorStore, SearchResult, VectorStore, VectorStoreError,
72};