pub struct Query<STATE: QueryState> {
pub embedding: Option<Embedding>,
pub sparse_embedding: Option<SparseEmbedding>,
pub documents: Vec<Document>,
/* private fields */
}
Expand description
A query is the main object going through a query pipeline
It acts as a statemachine, with the following transitions:
states::Pending
: No documents have been retrieved
states::Retrieved
: Documents have been retrieved
states::Answered
: The query has been answered
Fields§
§embedding: Option<Embedding>
§sparse_embedding: Option<SparseEmbedding>
§documents: Vec<Document>
Documents the query will operate on
A query can retrieve multiple times, accumulating documents
Implementations§
Source§impl<STATE: Clone + QueryState> Query<STATE>
impl<STATE: Clone + QueryState> Query<STATE>
pub fn builder() -> QueryBuilder<STATE>
pub fn history(&self) -> &Vec<TransformationEvent>
Sourcepub fn documents(&self) -> &[Document]
pub fn documents(&self) -> &[Document]
Returns the current documents that will be used as context for answer generation
Sourcepub fn documents_mut(&mut self) -> &mut Vec<Document>
pub fn documents_mut(&mut self) -> &mut Vec<Document>
Returns the current documents as mutable
Source§impl<STATE: Clone + CanRetrieve> Query<STATE>
impl<STATE: Clone + CanRetrieve> Query<STATE>
Trait Implementations§
impl<STATE: QueryState> StructuralPartialEq for Query<STATE>
Auto Trait Implementations§
impl<STATE> Freeze for Query<STATE>where
STATE: Freeze,
impl<STATE> RefUnwindSafe for Query<STATE>where
STATE: RefUnwindSafe,
impl<STATE> Send for Query<STATE>
impl<STATE> Sync for Query<STATE>
impl<STATE> Unpin for Query<STATE>where
STATE: Unpin,
impl<STATE> UnwindSafe for Query<STATE>where
STATE: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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