pub struct GeminiLlm { /* private fields */ }Expand description
Concrete Gemini LLM implementation using gemini-live Client.
The gemini-live Client is created once at construction time and reused for
all generate() calls, matching the JS GenAI SDK pattern where a single
GoogleGenAI instance is shared across requests.
Implementations§
Source§impl GeminiLlm
impl GeminiLlm
Sourcepub fn new(params: GeminiLlmParams) -> Self
pub fn new(params: GeminiLlmParams) -> Self
Create a new GeminiLlm from parameters.
Resolves defaults for model, variant, API key, project, and location
from parameters first, then falls back to environment variables.
The gemini-live Client is created once here and reused for all calls.
Sourcepub fn is_supported(model: &str) -> bool
pub fn is_supported(model: &str) -> bool
Check if a model name is supported by GeminiLlm.
Sourcepub fn variant(&self) -> GoogleLlmVariant
pub fn variant(&self) -> GoogleLlmVariant
Get the variant (VertexAI vs GeminiApi).
Trait Implementations§
Source§impl BaseLlm for GeminiLlm
impl BaseLlm for GeminiLlm
Source§fn warm_up<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn warm_up<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Pre-warm the HTTP connection pool by making a lightweight request.
Establishes the TCP+TLS connection so the first real generate()
call doesn’t pay the ~100-300ms handshake penalty. reqwest’s
connection pool keeps it alive for subsequent calls.
Source§fn generate<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn capabilities(&self) -> ModelCapabilities
fn capabilities(&self) -> ModelCapabilities
model_id; back-ends
with authoritative knowledge should override.Auto Trait Implementations§
impl Freeze for GeminiLlm
impl !RefUnwindSafe for GeminiLlm
impl Send for GeminiLlm
impl Sync for GeminiLlm
impl Unpin for GeminiLlm
impl !UnwindSafe for GeminiLlm
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].