pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
pub fn new(api_key: &str) -> Self
pub fn from_url(api_key: &str, base_url: &str) -> Self
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create a new Cohere client from the COHERE_API_KEY environment variable.
Panics if the environment variable is not set.
pub fn post(&self, path: &str) -> RequestBuilder
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.
pub fn embeddings<D: Embed>( &self, model: &str, input_type: &str, ) -> EmbeddingsBuilder<EmbeddingModel, D>
pub fn completion_model(&self, model: &str) -> CompletionModel
pub fn agent(&self, model: &str) -> AgentBuilder<CompletionModel>
pub fn extractor<T: JsonSchema + for<'a> Deserialize<'a> + Serialize + Send + Sync>( &self, model: &str, ) -> ExtractorBuilder<T, CompletionModel>
Trait Implementations§
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> 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