pub struct EmbeddingClient {
pub client: EmbeddingServiceClient<Channel>,
pub config: VectorConfig,
pub cache: Arc<Mutex<EmbeddingCache>>,
}Expand description
gRPC client that calls the Python embedding service and caches results locally.
Fields§
§client: EmbeddingServiceClient<Channel>Underlying tonic client.
config: VectorConfigRuntime configuration.
cache: Arc<Mutex<EmbeddingCache>>Shared embedding cache.
Implementations§
Source§impl EmbeddingClient
impl EmbeddingClient
Sourcepub async fn new(config: &VectorConfig) -> VectorResult<Self>
pub async fn new(config: &VectorConfig) -> VectorResult<Self>
Connect to the embedding service, initialize the cache, and verify readiness.
Sourcepub async fn connect(config: &VectorConfig) -> VectorResult<Self>
pub async fn connect(config: &VectorConfig) -> VectorResult<Self>
Alias for EmbeddingClient::new.
Sourcepub async fn cache_stats_snapshot(&self) -> EmbeddingCacheStats
pub async fn cache_stats_snapshot(&self) -> EmbeddingCacheStats
Return the current cache statistics snapshot.
Sourcepub async fn embed(&self, texts: Vec<String>) -> VectorResult<Vec<Vec<f32>>>
pub async fn embed(&self, texts: Vec<String>) -> VectorResult<Vec<Vec<f32>>>
Embed a list of texts.
Sourcepub async fn health_check(&self) -> VectorResult<bool>
pub async fn health_check(&self) -> VectorResult<bool>
Health-check the embedding service.
Sourcepub async fn model_info(&self) -> VectorResult<ModelInfo>
pub async fn model_info(&self) -> VectorResult<ModelInfo>
Return model metadata from the embedding service.
Trait Implementations§
Source§impl EmbeddingProvider for EmbeddingClient
impl EmbeddingProvider for EmbeddingClient
Source§fn embed<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = VectorResult<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn embed<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = VectorResult<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Embed a list of texts, serving cached results where available.
Source§fn embed_one<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = VectorResult<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed_one<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = VectorResult<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Embed a single text.
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VectorResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VectorResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Health-check the embedding service.
Source§fn model_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VectorResult<ModelInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn model_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VectorResult<ModelInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return metadata about the currently loaded model.
Source§fn cache_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<EmbeddingCacheStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cache_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<EmbeddingCacheStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return cache statistics for the client-local embedding cache.
Auto Trait Implementations§
impl !Freeze for EmbeddingClient
impl !RefUnwindSafe for EmbeddingClient
impl Send for EmbeddingClient
impl Sync for EmbeddingClient
impl Unpin for EmbeddingClient
impl UnsafeUnpin for EmbeddingClient
impl !UnwindSafe for EmbeddingClient
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request