pub struct MistralModel { /* private fields */ }Available on crate feature
mistral only.Expand description
Mistral AI model client.
Implementations§
Source§impl MistralModel
impl MistralModel
Sourcepub const DEFAULT_BASE_URL: &'static str = "https://api.mistral.ai/v1"
pub const DEFAULT_BASE_URL: &'static str = "https://api.mistral.ai/v1"
Default Mistral API base URL.
Sourcepub fn new(
model_name: impl Into<String>,
api_key: impl Into<String>,
) -> MistralModel
pub fn new( model_name: impl Into<String>, api_key: impl Into<String>, ) -> MistralModel
Create a new Mistral model.
Sourcepub fn from_env(
model_name: impl Into<String>,
) -> Result<MistralModel, ModelError>
pub fn from_env( model_name: impl Into<String>, ) -> Result<MistralModel, ModelError>
Create from environment variable MISTRAL_API_KEY.
Sourcepub fn with_base_url(self, url: impl Into<String>) -> MistralModel
pub fn with_base_url(self, url: impl Into<String>) -> MistralModel
Set a custom base URL.
Sourcepub fn with_profile(self, profile: ModelProfile) -> MistralModel
pub fn with_profile(self, profile: ModelProfile) -> MistralModel
Set a custom profile.
Sourcepub fn with_timeout(self, timeout: Duration) -> MistralModel
pub fn with_timeout(self, timeout: Duration) -> MistralModel
Set the default timeout.
Trait Implementations§
Source§impl Clone for MistralModel
impl Clone for MistralModel
Source§fn clone(&self) -> MistralModel
fn clone(&self) -> MistralModel
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 moreSource§impl Debug for MistralModel
impl Debug for MistralModel
Source§impl Model for MistralModel
impl Model for MistralModel
Source§fn profile(&self) -> &ModelProfile
fn profile(&self) -> &ModelProfile
Get the model profile (capabilities, schema transforms).
Source§fn request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [ModelRequest],
settings: &'life2 ModelSettings,
params: &'life3 ModelRequestParameters,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ModelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
MistralModel: 'async_trait,
fn request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [ModelRequest],
settings: &'life2 ModelSettings,
params: &'life3 ModelRequestParameters,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ModelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
MistralModel: 'async_trait,
Make a request to the model.
Source§fn request_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_messages: &'life1 [ModelRequest],
_settings: &'life2 ModelSettings,
_params: &'life3 ModelRequestParameters,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<ModelResponseStreamEvent, ModelError>> + Send>>, ModelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
MistralModel: 'async_trait,
fn request_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_messages: &'life1 [ModelRequest],
_settings: &'life2 ModelSettings,
_params: &'life3 ModelRequestParameters,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<ModelResponseStreamEvent, ModelError>> + Send>>, ModelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
MistralModel: 'async_trait,
Make a streaming request to the model. Read more
Source§fn identifier(&self) -> String
fn identifier(&self) -> String
Get the full model identifier.
Source§fn count_tokens<'life0, 'life1, 'async_trait>(
&'life0 self,
_messages: &'life1 [ModelRequest],
) -> Pin<Box<dyn Future<Output = Result<u64, ModelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn count_tokens<'life0, 'life1, 'async_trait>(
&'life0 self,
_messages: &'life1 [ModelRequest],
) -> Pin<Box<dyn Future<Output = Result<u64, ModelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Count tokens for messages (if supported). Read more
Source§fn supports(&self, capability: ModelCapability) -> bool
fn supports(&self, capability: ModelCapability) -> bool
Check if the model supports a specific capability.
Auto Trait Implementations§
impl Freeze for MistralModel
impl !RefUnwindSafe for MistralModel
impl Send for MistralModel
impl Sync for MistralModel
impl Unpin for MistralModel
impl !UnwindSafe for MistralModel
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