Skip to main content

EmbeddingIndex

Struct EmbeddingIndex 

Source
pub struct EmbeddingIndex { /* private fields */ }
Expand description

Immutable vector index built from provider-generated embeddings.

Implementations§

Source§

impl EmbeddingIndex

Source

pub fn build<P>( config: IndexConfig, provider: &P, texts: &[(u64, &str)], ) -> Result<Self, SearchError>

Embeds all texts as one provider batch and builds the vector index.

§Errors

Returns a provider failure, dimension mismatch, or vector-index build error.

Source

pub const fn as_vector_index(&self) -> &VectorIndex

Source

pub fn into_vector_index(self) -> VectorIndex

Source

pub fn search<P>( &self, provider: &P, input: &str, count: usize, ) -> Result<Vec<SearchHit>, SearchError>

Embeds one query and returns nearest vector candidates.

§Errors

Returns a provider or vector-query error.

Source

pub fn search_batch<P>( &self, provider: &P, inputs: &[&str], count: usize, ) -> Result<Vec<Vec<SearchHit>>, SearchError>

Embeds independent query strings as one provider batch and preserves input order.

§Errors

Returns a provider, query, allocation, or worker error.

Trait Implementations§

Source§

impl Debug for EmbeddingIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.