pub struct Client<T = Client> { /* private fields */ }Implementations§
Source§impl<T> Client<T>where
T: HttpClientExt + Default,
impl<T> Client<T>where
T: HttpClientExt + Default,
Sourcepub fn builder(api_key: &str) -> ClientBuilder<'_, T>
pub fn builder(api_key: &str) -> ClientBuilder<'_, T>
Create a new Google Gemini client builder.
§Example
use rig::providers::gemini::{ClientBuilder, self};
// Initialize the Google Gemini client
let gemini_client = Client::builder("your-google-gemini-api-key")
.build()Trait Implementations§
Source§impl<T> AsAudioGeneration for Client<T>
impl<T> AsAudioGeneration for Client<T>
Source§fn as_audio_generation(&self) -> Option<Box<dyn AudioGenerationClientDyn>>
fn as_audio_generation(&self) -> Option<Box<dyn AudioGenerationClientDyn>>
audio only.Source§impl<T> AsImageGeneration for Client<T>
impl<T> AsImageGeneration for Client<T>
Source§fn as_image_generation(&self) -> Option<Box<dyn ImageGenerationClientDyn>>
fn as_image_generation(&self) -> Option<Box<dyn ImageGenerationClientDyn>>
image only.Source§impl CompletionClient for Client<Client>
impl CompletionClient for Client<Client>
Source§fn completion_model(&self, model: &str) -> Self::CompletionModel
fn completion_model(&self, model: &str) -> Self::CompletionModel
Create a completion model with the given name. Gemini-specific parameters can be set using the GenerationConfig struct. Gemini API Reference
Source§type CompletionModel = CompletionModel
type CompletionModel = CompletionModel
Source§fn agent(&self, model: &str) -> AgentBuilder<Self::CompletionModel>
fn agent(&self, model: &str) -> AgentBuilder<Self::CompletionModel>
Source§fn extractor<T>(
&self,
model: &str,
) -> ExtractorBuilder<Self::CompletionModel, T>
fn extractor<T>( &self, model: &str, ) -> ExtractorBuilder<Self::CompletionModel, T>
Source§impl<T> EmbeddingsClient for Client<T>
impl<T> EmbeddingsClient for Client<T>
Source§fn embedding_model(&self, model: &str) -> EmbeddingModel<T>
fn embedding_model(&self, model: &str) -> EmbeddingModel<T>
Create an embedding model with the given name.
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
§Example
use rig::providers::gemini::{Client, self};
// Initialize the Google Gemini client
let gemini = Client::new("your-google-gemini-api-key");
let embedding_model = gemini.embedding_model(gemini::embedding::EMBEDDING_GECKO_001);Source§fn embedding_model_with_ndims(
&self,
model: &str,
ndims: usize,
) -> EmbeddingModel<T>
fn embedding_model_with_ndims( &self, model: &str, ndims: usize, ) -> EmbeddingModel<T>
Create an embedding model with the given name and the number of dimensions in the embedding generated by the model.
§Example
use rig::providers::gemini::{Client, self};
// Initialize the Google Gemini client
let gemini = Client::new("your-google-gemini-api-key");
let embedding_model = gemini.embedding_model_with_ndims("model-unknown-to-rig", 1024);Source§fn embeddings<D: Embed>(
&self,
model: &str,
) -> EmbeddingsBuilder<EmbeddingModel<T>, D>
fn embeddings<D: Embed>( &self, model: &str, ) -> EmbeddingsBuilder<EmbeddingModel<T>, D>
Create an embedding builder with the given embedding model.
§Example
use rig::providers::gemini::{Client, self};
// Initialize the Google Gemini client
let gemini = Client::new("your-google-gemini-api-key");
let embeddings = gemini.embeddings(gemini::embedding::EMBEDDING_GECKO_001)
.simple_document("doc0", "Hello, world!")
.simple_document("doc1", "Goodbye, world!")
.build()
.await
.expect("Failed to embed documents");Source§type EmbeddingModel = EmbeddingModel<T>
type EmbeddingModel = EmbeddingModel<T>
Source§fn embeddings_with_ndims<D: Embed>(
&self,
model: &str,
ndims: usize,
) -> EmbeddingsBuilder<Self::EmbeddingModel, D>
fn embeddings_with_ndims<D: Embed>( &self, model: &str, ndims: usize, ) -> EmbeddingsBuilder<Self::EmbeddingModel, D>
Source§impl ProviderClient for Client<Client>
impl ProviderClient for Client<Client>
Source§fn from_env() -> Self
fn from_env() -> Self
Create a new Google Gemini client from the GEMINI_API_KEY environment variable.
Panics if the environment variable is not set.
fn from_val(input: ProviderValue) -> Self
Source§fn boxed(self) -> Box<dyn ProviderClient>where
Self: Sized + 'static,
fn boxed(self) -> Box<dyn ProviderClient>where
Self: Sized + 'static,
Source§fn from_env_boxed<'a>() -> Box<dyn ProviderClient + 'a>where
Self: Sized + 'a,
fn from_env_boxed<'a>() -> Box<dyn ProviderClient + 'a>where
Self: Sized + 'a,
Source§fn from_val_boxed<'a>(input: ProviderValue) -> Box<dyn ProviderClient + 'a>where
Self: Sized + 'a,
fn from_val_boxed<'a>(input: ProviderValue) -> Box<dyn ProviderClient + 'a>where
Self: Sized + 'a,
Source§impl<T> TranscriptionClient for Client<T>
impl<T> TranscriptionClient for Client<T>
Source§fn transcription_model(&self, model: &str) -> TranscriptionModel<T>
fn transcription_model(&self, model: &str) -> TranscriptionModel<T>
Create a transcription model with the given name. Gemini-specific parameters can be set using the GenerationConfig struct. Gemini API Reference
Source§type TranscriptionModel = TranscriptionModel<T>
type TranscriptionModel = TranscriptionModel<T>
Source§impl<T> VerifyClient for Client<T>where
T: HttpClientExt + Clone + Debug + Default + WasmCompatSend + WasmCompatSync + 'static,
Client<T>: CompletionClient,
impl<T> VerifyClient for Client<T>where
T: HttpClientExt + Clone + Debug + Default + WasmCompatSend + WasmCompatSync + 'static,
Client<T>: CompletionClient,
Auto Trait Implementations§
impl<T> Freeze for Client<T>where
T: Freeze,
impl<T> RefUnwindSafe for Client<T>where
T: RefUnwindSafe,
impl<T> Send for Client<T>where
T: Send,
impl<T> Sync for Client<T>where
T: Sync,
impl<T> Unpin for Client<T>where
T: Unpin,
impl<T> UnwindSafe for Client<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsCompletion for Twhere
T: CompletionClientDyn + Clone + 'static,
impl<T> AsCompletion for Twhere
T: CompletionClientDyn + Clone + 'static,
fn as_completion(&self) -> Option<Box<dyn CompletionClientDyn>>
Source§impl<T> AsEmbeddings for Twhere
T: EmbeddingsClientDyn + Clone + 'static,
impl<T> AsEmbeddings for Twhere
T: EmbeddingsClientDyn + Clone + 'static,
fn as_embeddings(&self) -> Option<Box<dyn EmbeddingsClientDyn>>
Source§impl<T> AsTranscription for Twhere
T: TranscriptionClientDyn + Clone + 'static,
impl<T> AsTranscription for Twhere
T: TranscriptionClientDyn + Clone + 'static,
fn as_transcription(&self) -> Option<Box<dyn TranscriptionClientDyn>>
Source§impl<T> AsVerify for Twhere
T: VerifyClientDyn + Clone + 'static,
impl<T> AsVerify for Twhere
T: VerifyClientDyn + Clone + 'static,
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
Source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
Source§impl<T, M, R> CompletionClientDyn for Twhere
T: CompletionClient<CompletionModel = M>,
M: CompletionModel<StreamingResponse = R> + 'static,
R: Clone + Unpin + GetTokenUsage + 'static,
impl<T, M, R> CompletionClientDyn for Twhere
T: CompletionClient<CompletionModel = M>,
M: CompletionModel<StreamingResponse = R> + 'static,
R: Clone + Unpin + GetTokenUsage + 'static,
Source§fn completion_model<'a>(&self, model: &str) -> Box<dyn CompletionModelDyn + 'a>
fn completion_model<'a>(&self, model: &str) -> Box<dyn CompletionModelDyn + 'a>
Source§fn agent<'a>(&self, model: &str) -> AgentBuilder<CompletionModelHandle<'a>>
fn agent<'a>(&self, model: &str) -> AgentBuilder<CompletionModelHandle<'a>>
Source§impl<M, T> EmbeddingsClientDyn for Twhere
T: EmbeddingsClient<EmbeddingModel = M>,
M: EmbeddingModel + 'static,
impl<M, T> EmbeddingsClientDyn for Twhere
T: EmbeddingsClient<EmbeddingModel = M>,
M: EmbeddingModel + 'static,
Source§fn embedding_model<'a>(&self, model: &str) -> Box<dyn EmbeddingModelDyn + 'a>
fn embedding_model<'a>(&self, model: &str) -> Box<dyn EmbeddingModelDyn + 'a>
embedding_model_with_ndimsSource§fn embedding_model_with_ndims<'a>(
&self,
model: &str,
ndims: usize,
) -> Box<dyn EmbeddingModelDyn + 'a>
fn embedding_model_with_ndims<'a>( &self, model: &str, ndims: usize, ) -> Box<dyn EmbeddingModelDyn + 'a>
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> 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>
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>
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