pub struct EmbeddingClient { /* private fields */ }Expand description
Blocking client for configured embedding endpoints.
Implementations§
Source§impl EmbeddingClient
impl EmbeddingClient
Sourcepub fn from_config(
config: &EmbeddingConfig,
credentials: &CredentialsConfig,
) -> Result<Self, InferenceError>
pub fn from_config( config: &EmbeddingConfig, credentials: &CredentialsConfig, ) -> Result<Self, InferenceError>
Builds a client from config and resolved credentials.
§Errors
Returns InferenceError::Build when the HTTP client cannot be built.
Returns InferenceError::Config when auth resolution fails.
Sourcepub fn tei_for_tests(
base_url: impl Into<String>,
model: impl Into<String>,
) -> Result<Self, InferenceError>
pub fn tei_for_tests( base_url: impl Into<String>, model: impl Into<String>, ) -> Result<Self, InferenceError>
Builds a TEI client for tests and wiremock fixtures.
§Errors
Returns InferenceError::Build when the HTTP client cannot be built.
Sourcepub fn chunk_model(&self) -> &str
pub fn chunk_model(&self) -> &str
Model slug written to vector metadata for single-chunk notes.
Sourcepub fn document_model(&self) -> &str
pub fn document_model(&self) -> &str
Model slug written to vector metadata for multi-chunk notes.
Sourcepub fn embed(&self, inputs: &[String]) -> Result<Vec<Vec<f32>>, InferenceError>
pub fn embed(&self, inputs: &[String]) -> Result<Vec<Vec<f32>>, InferenceError>
Embeds a batch of texts and returns one vector per input.
§Errors
Returns InferenceError::Http or InferenceError::Decode.
Sourcepub fn embed_chunked(
&self,
input: &[Vec<String>],
) -> Result<EmbedChunkedResponse, InferenceError>
pub fn embed_chunked( &self, input: &[Vec<String>], ) -> Result<EmbedChunkedResponse, InferenceError>
Embeds grouped chunks (one group per note).
§Errors
Returns InferenceError::Http or InferenceError::Decode.
Trait Implementations§
Source§impl Clone for EmbeddingClient
impl Clone for EmbeddingClient
Source§fn clone(&self) -> EmbeddingClient
fn clone(&self) -> EmbeddingClient
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 moreAuto 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> 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