pub struct EmbeddingIndex { /* private fields */ }Expand description
Immutable vector index built from provider-generated embeddings.
Implementations§
Source§impl EmbeddingIndex
impl EmbeddingIndex
Sourcepub fn build<P>(
config: IndexConfig,
provider: &P,
texts: &[(u64, &str)],
) -> Result<Self, SearchError>where
P: EmbeddingProvider,
pub fn build<P>(
config: IndexConfig,
provider: &P,
texts: &[(u64, &str)],
) -> Result<Self, SearchError>where
P: EmbeddingProvider,
Embeds all texts as one provider batch and builds the vector index.
§Errors
Returns a provider failure, dimension mismatch, or vector-index build error.
pub const fn as_vector_index(&self) -> &VectorIndex
pub fn into_vector_index(self) -> VectorIndex
Sourcepub fn search<P>(
&self,
provider: &P,
input: &str,
count: usize,
) -> Result<Vec<SearchHit>, SearchError>where
P: EmbeddingProvider,
pub fn search<P>(
&self,
provider: &P,
input: &str,
count: usize,
) -> Result<Vec<SearchHit>, SearchError>where
P: EmbeddingProvider,
Embeds one query and returns nearest vector candidates.
§Errors
Returns a provider or vector-query error.
Sourcepub fn search_batch<P>(
&self,
provider: &P,
inputs: &[&str],
count: usize,
) -> Result<Vec<Vec<SearchHit>>, SearchError>where
P: EmbeddingProvider,
pub fn search_batch<P>(
&self,
provider: &P,
inputs: &[&str],
count: usize,
) -> Result<Vec<Vec<SearchHit>>, SearchError>where
P: EmbeddingProvider,
Embeds independent query strings as one provider batch and preserves input order.
§Errors
Returns a provider, query, allocation, or worker error.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EmbeddingIndex
impl RefUnwindSafe for EmbeddingIndex
impl Send for EmbeddingIndex
impl Sync for EmbeddingIndex
impl Unpin for EmbeddingIndex
impl UnsafeUnpin for EmbeddingIndex
impl UnwindSafe for EmbeddingIndex
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