Skip to main content

adk_rag/
lib.rs

1//! # adk-rag
2#![allow(clippy::result_large_err)]
3//!
4//! Retrieval-Augmented Generation for ADK-Rust agents.
5//!
6//! This crate provides a modular, trait-based RAG system with pluggable
7//! embedding providers, vector stores, chunking strategies, and rerankers.
8//! A [`RagPipeline`](pipeline) orchestrates the full ingest-and-query workflow,
9//! and a [`RagTool`](tool) exposes retrieval as an `adk_core::Tool` for
10//! agentic use.
11//!
12//! ## Features
13//!
14//! All external backends are feature-gated. The default feature set includes
15//! only core traits, the in-memory vector store, and chunking implementations.
16//!
17//! | Feature      | What it enables                          |
18//! |--------------|------------------------------------------|
19//! | `gemini`     | `GeminiEmbeddingProvider` via adk-gemini  |
20//! | `openai`     | `OpenAIEmbeddingProvider` via reqwest     |
21//! | `qdrant`     | `QdrantVectorStore` via qdrant-client     |
22//! | `lancedb`    | `LanceDBVectorStore` via lancedb          |
23//! | `pgvector`   | `PgVectorStore` via sqlx                  |
24//! | `surrealdb`  | `SurrealVectorStore` via surrealdb        |
25//! | `full`       | All of the above                          |
26
27pub mod chunking;
28pub mod config;
29pub mod document;
30pub mod embedding;
31pub mod error;
32pub mod inmemory;
33pub mod pipeline;
34pub mod reranker;
35pub mod tool;
36pub mod vectorstore;
37
38#[cfg(feature = "gemini")]
39pub mod gemini;
40#[cfg(feature = "lancedb")]
41pub mod lancedb;
42#[cfg(feature = "openai")]
43pub mod openai;
44#[cfg(feature = "pgvector")]
45pub mod pgvector;
46#[cfg(feature = "qdrant")]
47pub mod qdrant;
48#[cfg(feature = "surrealdb")]
49pub mod surrealdb;
50
51pub use chunking::{Chunker, FixedSizeChunker, MarkdownChunker, RecursiveChunker};
52pub use config::{RagConfig, RagConfigBuilder};
53pub use document::{Chunk, Document, SearchResult};
54pub use embedding::EmbeddingProvider;
55pub use error::{RagError, Result};
56pub use inmemory::InMemoryVectorStore;
57pub use pipeline::{RagPipeline, RagPipelineBuilder};
58pub use reranker::{NoOpReranker, Reranker};
59pub use tool::RagTool;
60pub use vectorstore::VectorStore;
61
62#[cfg(feature = "gemini")]
63pub use gemini::GeminiEmbeddingProvider;
64#[cfg(feature = "lancedb")]
65pub use lancedb::LanceDBVectorStore;
66#[cfg(feature = "openai")]
67pub use openai::OpenAIEmbeddingProvider;
68#[cfg(feature = "pgvector")]
69pub use pgvector::PgVectorStore;
70#[cfg(feature = "qdrant")]
71pub use qdrant::QdrantVectorStore;
72#[cfg(feature = "surrealdb")]
73pub use surrealdb::SurrealVectorStore;