pub struct RagPipeline<E: Embedder, R: Reranker> { /* private fields */ }Expand description
Complete RAG pipeline
Implementations§
Source§impl<E: Embedder + Clone, R: Reranker> RagPipeline<E, R>
impl<E: Embedder + Clone, R: Reranker> RagPipeline<E, R>
Sourcepub fn index_document(&mut self, document: &Document) -> Result<Vec<Chunk>>
pub fn index_document(&mut self, document: &Document) -> Result<Vec<Chunk>>
Index a single document
Sourcepub fn index_documents(&mut self, documents: &[Document]) -> Result<usize>
pub fn index_documents(&mut self, documents: &[Document]) -> Result<usize>
Index multiple documents
Sourcepub fn document_count(&self) -> usize
pub fn document_count(&self) -> usize
Get the number of indexed documents
Sourcepub fn chunk_count(&self) -> usize
pub fn chunk_count(&self) -> usize
Get the number of indexed chunks
Sourcepub fn query_with_context(
&self,
query: &str,
k: usize,
) -> Result<(Vec<RetrievalResult>, AssembledContext)>
pub fn query_with_context( &self, query: &str, k: usize, ) -> Result<(Vec<RetrievalResult>, AssembledContext)>
Query and assemble context
Sourcepub fn assembler(&self) -> &ContextAssembler
pub fn assembler(&self) -> &ContextAssembler
Get the context assembler
Sourcepub fn assemble_context(&self, results: &[RetrievalResult]) -> AssembledContext
pub fn assemble_context(&self, results: &[RetrievalResult]) -> AssembledContext
Assemble context from results
Auto Trait Implementations§
impl<E, R> !RefUnwindSafe for RagPipeline<E, R>
impl<E, R> !UnwindSafe for RagPipeline<E, R>
impl<E, R> Freeze for RagPipeline<E, R>
impl<E, R> Send for RagPipeline<E, R>
impl<E, R> Sync for RagPipeline<E, R>
impl<E, R> Unpin for RagPipeline<E, R>
impl<E, R> UnsafeUnpin for RagPipeline<E, R>where
E: UnsafeUnpin,
R: UnsafeUnpin,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more