pub struct Gemini { /* private fields */ }
Expand description
Client for the Gemini API
Implementations§
Source§impl Gemini
impl Gemini
Sourcepub fn new<K: AsRef<str>>(api_key: K) -> Result<Self, Error>
pub fn new<K: AsRef<str>>(api_key: K) -> Result<Self, Error>
Create a new client with the specified API key
Sourcepub fn pro<K: AsRef<str>>(api_key: K) -> Result<Self, Error>
pub fn pro<K: AsRef<str>>(api_key: K) -> Result<Self, Error>
Create a new client for the Gemini Pro model
Sourcepub fn with_model<K: AsRef<str>, M: Into<Model>>(
api_key: K,
model: M,
) -> Result<Self, Error>
pub fn with_model<K: AsRef<str>, M: Into<Model>>( api_key: K, model: M, ) -> Result<Self, Error>
Create a new client with the specified API key and model
Sourcepub fn with_base_url<K: AsRef<str>>(
api_key: K,
base_url: Url,
) -> Result<Self, Error>
pub fn with_base_url<K: AsRef<str>>( api_key: K, base_url: Url, ) -> Result<Self, Error>
Create a new client with custom base URL
Sourcepub fn with_model_and_base_url<K: AsRef<str>, M: Into<Model>>(
api_key: K,
model: M,
base_url: Url,
) -> Result<Self, Error>
pub fn with_model_and_base_url<K: AsRef<str>, M: Into<Model>>( api_key: K, model: M, base_url: Url, ) -> Result<Self, Error>
Create a new client with the specified API key, model, and base URL
Sourcepub fn generate_content(&self) -> ContentBuilder
pub fn generate_content(&self) -> ContentBuilder
Start building a content generation request
Sourcepub fn embed_content(&self) -> EmbedBuilder
pub fn embed_content(&self) -> EmbedBuilder
Start building a content embedding request
Sourcepub fn batch_generate_content(&self) -> BatchBuilder
pub fn batch_generate_content(&self) -> BatchBuilder
Start building a batch content generation request
Sourcepub fn get_batch(&self, name: &str) -> BatchHandle
pub fn get_batch(&self, name: &str) -> BatchHandle
Get a handle to a batch operation by its name.
Sourcepub fn list_batches(
&self,
page_size: impl Into<Option<u32>>,
) -> impl Stream<Item = Result<BatchOperation, Error>> + Send
pub fn list_batches( &self, page_size: impl Into<Option<u32>>, ) -> impl Stream<Item = Result<BatchOperation, Error>> + Send
Lists batch operations.
This method returns a stream that handles pagination automatically.
Sourcepub fn create_cache(&self) -> CacheBuilder
pub fn create_cache(&self) -> CacheBuilder
Create cached content with a fluent API.
Sourcepub fn get_cached_content(&self, name: &str) -> CachedContentHandle
pub fn get_cached_content(&self, name: &str) -> CachedContentHandle
Get a handle to cached content by its name.
Sourcepub fn list_cached_contents(
&self,
page_size: impl Into<Option<i32>>,
) -> impl Stream<Item = Result<CachedContentSummary, Error>> + Send
pub fn list_cached_contents( &self, page_size: impl Into<Option<i32>>, ) -> impl Stream<Item = Result<CachedContentSummary, Error>> + Send
Lists cached contents.
This method returns a stream that handles pagination automatically.
Sourcepub fn create_file<B: Into<Vec<u8>>>(&self, bytes: B) -> FileBuilder
pub fn create_file<B: Into<Vec<u8>>>(&self, bytes: B) -> FileBuilder
Start building a file resource
Sourcepub async fn get_file(&self, name: &str) -> Result<FileHandle, Error>
pub async fn get_file(&self, name: &str) -> Result<FileHandle, Error>
Get a handle to a file by its name.
Sourcepub fn list_files(
&self,
page_size: impl Into<Option<u32>>,
) -> impl Stream<Item = Result<FileHandle, Error>> + Send
pub fn list_files( &self, page_size: impl Into<Option<u32>>, ) -> impl Stream<Item = Result<FileHandle, Error>> + Send
Lists files.
This method returns a stream that handles pagination automatically.