Struct GeminiBuilder
pub struct GeminiBuilder { /* private fields */ }Expand description
Typed builder for GeminiModelProvider.
Only alias is required; every credential input is optional and layered
at Self::build time in this order:
- Explicit API key from
Self::api_key - Managed OAuth via
Self::managed_auth(when wired and the profile exists) - CLI OAuth tokens from
~/.gemini/oauth_creds.json
Implementations§
Source§impl GeminiBuilder
impl GeminiBuilder
Sourcepub fn api_key(self, key: Option<&str>) -> Self
pub fn api_key(self, key: Option<&str>) -> Self
Explicit API key (from [providers.models.gemini.<alias>] api_key).
When set (and non-empty after trimming), takes precedence over every
OAuth path.
Sourcepub fn managed_auth(
self,
auth_service: AuthService,
profile_override: Option<String>,
) -> Self
pub fn managed_auth( self, auth_service: AuthService, profile_override: Option<String>, ) -> Self
Wire up managed OAuth via the shared AuthService, with an
optional profile override. When set and no explicit API key is
provided, the builder probes the service at build time; if a
managed profile exists, the resulting provider uses managed OAuth
instead of falling through to the CLI creds.
Sourcepub fn oauth_project_seed(self, seed: Option<String>) -> Self
pub fn oauth_project_seed(self, seed: Option<String>) -> Self
Seed value for the OAuth project resolution cache.
Sourcepub fn oauth_client(
self,
client_id: Option<String>,
client_secret: Option<String>,
) -> Self
pub fn oauth_client( self, client_id: Option<String>, client_secret: Option<String>, ) -> Self
Override the OAuth client credentials (defaults to the Gemini CLI public client when unset).
Sourcepub fn build(self) -> GeminiModelProvider
pub fn build(self) -> GeminiModelProvider
Resolve the credential layers and finalize the provider.
Auto Trait Implementations§
impl Freeze for GeminiBuilder
impl !RefUnwindSafe for GeminiBuilder
impl Send for GeminiBuilder
impl Sync for GeminiBuilder
impl Unpin for GeminiBuilder
impl UnsafeUnpin for GeminiBuilder
impl !UnwindSafe for GeminiBuilder
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> 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