pub struct EmbeddingProviderRegistry { /* private fields */ }Expand description
Process-local registry of embedding providers.
Empty by default: dense search works when applications supply vectors; sparse search works with no provider at all.
Implementations§
Source§impl EmbeddingProviderRegistry
impl EmbeddingProviderRegistry
Sourcepub fn new() -> EmbeddingProviderRegistry
pub fn new() -> EmbeddingProviderRegistry
Empty registry (no vendors pre-registered).
Sourcepub fn register(&self, provider: Arc<dyn EmbeddingProvider>)
pub fn register(&self, provider: Arc<dyn EmbeddingProvider>)
Register or replace a provider under its EmbeddingProvider::provider_id.
Sourcepub fn unregister(&self, provider_id: &str) -> bool
pub fn unregister(&self, provider_id: &str) -> bool
Remove a provider by id. Returns whether it was present.
Sourcepub fn get(&self, provider_id: &str) -> Option<Arc<dyn EmbeddingProvider>>
pub fn get(&self, provider_id: &str) -> Option<Arc<dyn EmbeddingProvider>>
Lookup by registry key.
Sourcepub fn resolve(
&self,
source: &EmbeddingSource,
) -> Result<Arc<dyn EmbeddingProvider>, EmbeddingError>
pub fn resolve( &self, source: &EmbeddingSource, ) -> Result<Arc<dyn EmbeddingProvider>, EmbeddingError>
Resolve a source to a provider, or refuse generation for application-supplied columns.
Sourcepub fn embed(
&self,
source: &EmbeddingSource,
texts: &[&str],
expected_dim: u32,
) -> Result<Vec<Vec<f32>>, EmbeddingError>
pub fn embed( &self, source: &EmbeddingSource, texts: &[&str], expected_dim: u32, ) -> Result<Vec<Vec<f32>>, EmbeddingError>
Generate embeddings for texts under source, checking expected_dim.
For EmbeddingSource::SuppliedByApplication this always errors —
callers must write vectors themselves.
Trait Implementations§
Source§impl Clone for EmbeddingProviderRegistry
impl Clone for EmbeddingProviderRegistry
Source§fn clone(&self) -> EmbeddingProviderRegistry
fn clone(&self) -> EmbeddingProviderRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EmbeddingProviderRegistry
impl Debug for EmbeddingProviderRegistry
Source§impl Default for EmbeddingProviderRegistry
impl Default for EmbeddingProviderRegistry
Source§fn default() -> EmbeddingProviderRegistry
fn default() -> EmbeddingProviderRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EmbeddingProviderRegistry
impl RefUnwindSafe for EmbeddingProviderRegistry
impl Send for EmbeddingProviderRegistry
impl Sync for EmbeddingProviderRegistry
impl Unpin for EmbeddingProviderRegistry
impl UnsafeUnpin for EmbeddingProviderRegistry
impl UnwindSafe for EmbeddingProviderRegistry
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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