pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
pub fn new(api_key: &str) -> Client
pub fn from_url(api_key: &str, base_url: &str) -> Client
pub fn post(&self, path: &str) -> RequestBuilder
pub fn embeddings<D>(
&self,
model: &str,
input_type: &str,
) -> EmbeddingsBuilder<EmbeddingModel, D>where
D: Embed,
Sourcepub fn embedding_model(&self, model: &str, input_type: &str) -> EmbeddingModel
pub fn embedding_model(&self, model: &str, input_type: &str) -> EmbeddingModel
Note: default embedding dimension of 0 will be used if model is not known.
If this is the case, it’s better to use function embedding_model_with_ndims
Sourcepub fn embedding_model_with_ndims(
&self,
model: &str,
input_type: &str,
ndims: usize,
) -> EmbeddingModel
pub fn embedding_model_with_ndims( &self, model: &str, input_type: &str, ndims: usize, ) -> EmbeddingModel
Create an embedding model with the given name and the number of dimensions in the embedding generated by the model.
Trait Implementations§
Source§impl AsTranscription for Client
impl AsTranscription for Client
fn as_transcription(&self) -> Option<Box<dyn TranscriptionClientDyn>>
Source§impl CompletionClient for Client
impl CompletionClient for Client
Source§type CompletionModel = CompletionModel
type CompletionModel = CompletionModel
The type of CompletionModel used by the client.
Source§fn completion_model(
&self,
model: &str,
) -> <Client as CompletionClient>::CompletionModel
fn completion_model( &self, model: &str, ) -> <Client as CompletionClient>::CompletionModel
Create a completion model with the given name. Read more
Source§fn agent(&self, model: &str) -> AgentBuilder<Self::CompletionModel>
fn agent(&self, model: &str) -> AgentBuilder<Self::CompletionModel>
Create an agent builder with the given completion model. Read more
Source§fn extractor<T>(
&self,
model: &str,
) -> ExtractorBuilder<T, Self::CompletionModel>
fn extractor<T>( &self, model: &str, ) -> ExtractorBuilder<T, Self::CompletionModel>
Create an extractor builder with the given completion model.
Source§impl EmbeddingsClient for Client
impl EmbeddingsClient for Client
Source§type EmbeddingModel = EmbeddingModel
type EmbeddingModel = EmbeddingModel
The type of EmbeddingModel used by the Client
Source§fn embedding_model(
&self,
model: &str,
) -> <Client as EmbeddingsClient>::EmbeddingModel
fn embedding_model( &self, model: &str, ) -> <Client as EmbeddingsClient>::EmbeddingModel
Create an embedding model with the given name.
Note: default embedding dimension of 0 will be used if model is not known.
If this is the case, it’s better to use function
embedding_model_with_ndims Read moreSource§fn embedding_model_with_ndims(
&self,
model: &str,
ndims: usize,
) -> <Client as EmbeddingsClient>::EmbeddingModel
fn embedding_model_with_ndims( &self, model: &str, ndims: usize, ) -> <Client as EmbeddingsClient>::EmbeddingModel
Create an embedding model with the given name and the number of dimensions in the embedding generated by the model. Read more
Source§fn embeddings<D>(
&self,
model: &str,
) -> EmbeddingsBuilder<<Client as EmbeddingsClient>::EmbeddingModel, D>where
D: Embed,
fn embeddings<D>(
&self,
model: &str,
) -> EmbeddingsBuilder<<Client as EmbeddingsClient>::EmbeddingModel, D>where
D: Embed,
Create an embedding builder with the given embedding model. Read more
Source§fn embeddings_with_ndims<D>(
&self,
model: &str,
ndims: usize,
) -> EmbeddingsBuilder<Self::EmbeddingModel, D>where
D: Embed,
fn embeddings_with_ndims<D>(
&self,
model: &str,
ndims: usize,
) -> EmbeddingsBuilder<Self::EmbeddingModel, D>where
D: Embed,
Create an embedding builder with the given name and the number of dimensions in the embedding generated by the model. Read more
Source§impl ProviderClient for Client
impl ProviderClient for Client
Source§fn from_env() -> Client
fn from_env() -> Client
Create a new Cohere client from the COHERE_API_KEY environment variable.
Panics if the environment variable is not set.
Source§fn boxed(self) -> Box<dyn ProviderClient>where
Self: Sized + 'static,
fn boxed(self) -> Box<dyn ProviderClient>where
Self: Sized + 'static,
A helper method to box the client.
Source§fn from_env_boxed<'a>() -> Box<dyn ProviderClient + 'a>where
Self: Sized + 'a,
fn from_env_boxed<'a>() -> Box<dyn ProviderClient + 'a>where
Self: Sized + 'a,
Create a boxed client from the process’s environment.
Panics if an environment is improperly configured.
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> AsCompletion for Twhere
T: CompletionClientDyn + Clone + 'static,
impl<T> AsCompletion for Twhere
T: CompletionClientDyn + Clone + 'static,
fn as_completion(&self) -> Option<Box<dyn CompletionClientDyn>>
Source§impl<T> AsEmbeddings for Twhere
T: EmbeddingsClientDyn + Clone + 'static,
impl<T> AsEmbeddings for Twhere
T: EmbeddingsClientDyn + Clone + 'static,
fn as_embeddings(&self) -> Option<Box<dyn EmbeddingsClientDyn>>
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, M, R> CompletionClientDyn for Twhere
T: CompletionClient<CompletionModel = M>,
M: CompletionModel<StreamingResponse = R> + 'static,
R: Clone + Unpin + 'static,
impl<T, M, R> CompletionClientDyn for Twhere
T: CompletionClient<CompletionModel = M>,
M: CompletionModel<StreamingResponse = R> + 'static,
R: Clone + Unpin + 'static,
Source§fn completion_model<'a>(&self, model: &str) -> Box<dyn CompletionModelDyn + 'a>
fn completion_model<'a>(&self, model: &str) -> Box<dyn CompletionModelDyn + 'a>
Create a completion model with the given name.
Source§fn agent<'a>(&self, model: &str) -> AgentBuilder<CompletionModelHandle<'a>>
fn agent<'a>(&self, model: &str) -> AgentBuilder<CompletionModelHandle<'a>>
Create an agent builder with the given completion model.
Source§impl<T, M> EmbeddingsClientDyn for Twhere
T: EmbeddingsClient<EmbeddingModel = M>,
M: EmbeddingModel + 'static,
impl<T, M> EmbeddingsClientDyn for Twhere
T: EmbeddingsClient<EmbeddingModel = M>,
M: EmbeddingModel + 'static,
Source§fn embedding_model<'a>(&self, model: &str) -> Box<dyn EmbeddingModelDyn + 'a>
fn embedding_model<'a>(&self, model: &str) -> Box<dyn EmbeddingModelDyn + 'a>
Create an embedding model with the given name.
Note: default embedding dimension of 0 will be used if model is not known.
If this is the case, it’s better to use function
embedding_model_with_ndimsSource§fn embedding_model_with_ndims<'a>(
&self,
model: &str,
ndims: usize,
) -> Box<dyn EmbeddingModelDyn + 'a>
fn embedding_model_with_ndims<'a>( &self, model: &str, ndims: usize, ) -> Box<dyn EmbeddingModelDyn + 'a>
Create an embedding model with the given name and the number of dimensions in the embedding generated by the model.