Gemini class

Google Gemini model adapter with REST, interactions, and live support.

Inheritance

Constructors

Gemini({String model = 'gemini-2.5-flash', bool useInteractionsApi = false, Object? retryOptions, String? baseUrl, Object? speechConfig, GeminiContextCacheManager cacheManager = const GeminiContextCacheManager(), Map<String, String>? environment, GoogleLLMVariant? apiBackendOverride, GeminiInteractionsInvoker? interactionsInvoker, GeminiLiveSessionFactory? liveSessionFactory, GeminiRestTransport? restTransport, GeminiGenerateHook? generateHook})
Creates a Gemini adapter for model.

Properties

apiBackend → GoogleLLMVariant
Resolved backend variant used for requests.
no setter
apiBackendOverride → GoogleLLMVariant?
Optional API backend override.
final
baseUrl String?
Optional base URL override for Gemini REST endpoints.
final
cacheManager → GeminiContextCacheManager
Context cache manager used for cache-aware requests.
final
environment Map<String, String>?
Optional environment override for API keys and flags.
final
hashCode int
The hash code for this object.
no setterinherited
interactionsInvoker GeminiInteractionsInvoker?
Optional interactions invoker override.
final
liveSessionFactory GeminiLiveSessionFactory?
Optional live session factory override.
final
model String
The model identifier sent to the backend.
getter/setter pairinherited
restTransport → GeminiRestTransport?
Optional REST transport override.
final
retryOptions Object?
Optional default retry options object or JSON-like map.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
speechConfig Object?
Optional speech config used for live connections.
final
useInteractionsApi bool
Whether to route requests through the interactions API.
final

Methods

connect(LlmRequest request) → BaseLlmConnection
Creates a live-capable connection for request.
generateContent(LlmRequest request, {bool stream = false}) Stream<LlmResponse>
Generates model responses for request.
override
maybeAppendUserContent(LlmRequest request) → void
Appends a fallback user turn when request has no trailing user content.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

supportedModels() List<RegExp>
Regex patterns supported by this adapter.