pub struct GeminiModel { /* private fields */ }Available on crate feature
gemini only.Expand description
Google AI / Vertex AI model.
Implementations§
Source§impl GoogleModel
impl GoogleModel
Sourcepub fn new(
model_name: impl Into<String>,
api_key: impl Into<String>,
) -> GoogleModel
pub fn new( model_name: impl Into<String>, api_key: impl Into<String>, ) -> GoogleModel
Create a new Google AI model (uses API key).
Sourcepub fn vertex(
model_name: impl Into<String>,
project_id: impl Into<String>,
location: impl Into<String>,
) -> GoogleModel
pub fn vertex( model_name: impl Into<String>, project_id: impl Into<String>, location: impl Into<String>, ) -> GoogleModel
Create a Vertex AI model (uses project/location).
Sourcepub fn with_base_url(self, url: impl Into<String>) -> GoogleModel
pub fn with_base_url(self, url: impl Into<String>) -> GoogleModel
Set the base URL.
Sourcepub fn with_client(self, client: Client) -> GoogleModel
pub fn with_client(self, client: Client) -> GoogleModel
Set a custom HTTP client.
Sourcepub fn with_timeout(self, timeout: Duration) -> GoogleModel
pub fn with_timeout(self, timeout: Duration) -> GoogleModel
Set the default timeout.
Sourcepub fn with_profile(self, profile: ModelProfile) -> GoogleModel
pub fn with_profile(self, profile: ModelProfile) -> GoogleModel
Set a custom profile.
Sourcepub fn with_thinking(self, budget: Option<u64>) -> GoogleModel
pub fn with_thinking(self, budget: Option<u64>) -> GoogleModel
Enable thinking mode (for Flash Thinking models).
Sourcepub fn with_code_execution(self) -> GoogleModel
pub fn with_code_execution(self) -> GoogleModel
Enable code execution.
Sourcepub fn with_search(self) -> GoogleModel
pub fn with_search(self) -> GoogleModel
Enable Google Search grounding.
Sourcepub fn add_response_to_contents(
&self,
contents: &mut Vec<Content>,
response: &ModelResponse,
)
pub fn add_response_to_contents( &self, contents: &mut Vec<Content>, response: &ModelResponse, )
Add a model response to contents (for multi-turn).
Trait Implementations§
Source§impl Clone for GoogleModel
impl Clone for GoogleModel
Source§fn clone(&self) -> GoogleModel
fn clone(&self) -> GoogleModel
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 GoogleModel
impl Debug for GoogleModel
Source§impl Model for GoogleModel
impl Model for GoogleModel
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,
GoogleModel: '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,
GoogleModel: '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,
GoogleModel: '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,
GoogleModel: '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 GoogleModel
impl !RefUnwindSafe for GoogleModel
impl Send for GoogleModel
impl Sync for GoogleModel
impl Unpin for GoogleModel
impl !UnwindSafe for GoogleModel
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