pub struct Cohere { /* private fields */ }Expand description
Cohere: its CohereConfig on a transport. Every model it builds
sends through that transport.
Implementations§
Source§impl Cohere
impl Cohere
Sourcepub fn with_http(self, http: impl HttpClientExt + 'static) -> Self
pub fn with_http(self, http: impl HttpClientExt + 'static) -> Self
The same configuration, sending through http.
Sourcepub fn config(&self) -> &CohereConfig
pub fn config(&self) -> &CohereConfig
The configuration this client sends with.
Source§impl Cohere
impl Cohere
Sourcepub fn new(api_key: impl Into<Secret>) -> Self
Available on crate feature reqwest only.
pub fn new(api_key: impl Into<Secret>) -> Self
reqwest only.Cohere with api_key and default settings, on the shared reqwest
client.
Sourcepub fn from_env() -> Result<Self, EnvError>
Available on crate feature reqwest only.
pub fn from_env() -> Result<Self, EnvError>
reqwest only.Cohere from COHERE_API_KEY, on the shared reqwest client.
Sourcepub fn completion(&self, model: impl Into<String>) -> Model<CohereChat>
pub fn completion(&self, model: impl Into<String>) -> Model<CohereChat>
The chat model for model, on Cohere’s OpenAI Compatibility API
until its wire opts in to the native chat API
(ChatRoute).
Sourcepub fn embedding(
&self,
model: impl Into<String>,
ndims: Option<usize>,
) -> Model<Embeddings>
pub fn embedding( &self, model: impl Into<String>, ndims: Option<usize>, ) -> Model<Embeddings>
The text-embedding model for model. ndims is the width it
reports, defaulting to the model’s known width.
Sourcepub fn image_embedding(&self) -> Model<ImageEmbeddings>
pub fn image_embedding(&self) -> Model<ImageEmbeddings>
The image-embedding model. Cohere embeds images with one fixed model, so it names none.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Cohere
impl !UnwindSafe for Cohere
impl Freeze for Cohere
impl Send for Cohere
impl Sync for Cohere
impl Unpin for Cohere
impl UnsafeUnpin for Cohere
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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