pub struct RagPipeline { /* private fields */ }Expand description
Retrieval-Augmented Generation pipeline.
Orchestrates document ingestion (chunking, embedding, storage) and context-aware retrieval for LLM injection.
Implementations§
Source§impl RagPipeline
impl RagPipeline
Sourcepub fn new(
vector_store: Arc<dyn VectorStore>,
embedder: Arc<dyn EmbeddingProvider>,
config: RagConfig,
) -> Self
pub fn new( vector_store: Arc<dyn VectorStore>, embedder: Arc<dyn EmbeddingProvider>, config: RagConfig, ) -> Self
Create a new RAG pipeline.
Sourcepub async fn ingest_document(
&self,
doc: &Document,
) -> ArgentorResult<Vec<DocumentChunk>>
pub async fn ingest_document( &self, doc: &Document, ) -> ArgentorResult<Vec<DocumentChunk>>
Ingest a single document: chunk it, embed each chunk, and store.
Sourcepub async fn ingest_batch(
&self,
docs: &[Document],
) -> ArgentorResult<Vec<Vec<DocumentChunk>>>
pub async fn ingest_batch( &self, docs: &[Document], ) -> ArgentorResult<Vec<Vec<DocumentChunk>>>
Batch-ingest multiple documents.
Sourcepub async fn query(
&self,
question: &str,
top_k: Option<usize>,
) -> ArgentorResult<RagResult>
pub async fn query( &self, question: &str, top_k: Option<usize>, ) -> ArgentorResult<RagResult>
Query the knowledge base and return scored, filtered chunks.
Sourcepub async fn query_with_context(
&self,
question: &str,
top_k: Option<usize>,
context_window: usize,
) -> ArgentorResult<RagResult>
pub async fn query_with_context( &self, question: &str, top_k: Option<usize>, context_window: usize, ) -> ArgentorResult<RagResult>
Query and return a formatted context string sized to fit a given context window (in estimated tokens).
Auto Trait Implementations§
impl !Freeze for RagPipeline
impl !RefUnwindSafe for RagPipeline
impl Send for RagPipeline
impl Sync for RagPipeline
impl Unpin for RagPipeline
impl UnsafeUnpin for RagPipeline
impl !UnwindSafe for RagPipeline
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more