pub struct EmbeddingsClient { /* private fields */ }Expand description
Client that wraps an embeddings service and keeps track of the model name.
Implementations§
Source§impl EmbeddingsClient
impl EmbeddingsClient
Sourcepub fn new(model: impl Into<String>) -> Self
pub fn new(model: impl Into<String>) -> Self
Create a client that uses the default OpenAI configuration (OPENAI_API_KEY).
Sourcepub fn with_api_key(
model: impl Into<String>,
api_key: impl Into<String>,
) -> Self
pub fn with_api_key( model: impl Into<String>, api_key: impl Into<String>, ) -> Self
Create a client that uses the provided API key.
Sourcepub fn with_config(model: impl Into<String>, config: OpenAIConfig) -> Self
pub fn with_config(model: impl Into<String>, config: OpenAIConfig) -> Self
Create a client that uses the provided OpenAI configuration.
Sourcepub fn with_service(
model: impl Into<String>,
service: Arc<dyn EmbeddingsService>,
) -> Self
pub fn with_service( model: impl Into<String>, service: Arc<dyn EmbeddingsService>, ) -> Self
Create a client around a custom embeddings service implementation.
Trait Implementations§
Source§impl Clone for EmbeddingsClient
impl Clone for EmbeddingsClient
Source§fn clone(&self) -> EmbeddingsClient
fn clone(&self) -> EmbeddingsClient
Returns a duplicate of the value. Read more
1.0.0 · 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 EmbeddingsClient
impl !RefUnwindSafe for EmbeddingsClient
impl Send for EmbeddingsClient
impl Sync for EmbeddingsClient
impl Unpin for EmbeddingsClient
impl !UnwindSafe for EmbeddingsClient
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