Overview
GoogleInteractionsLLMService provides integration with Google’s Gemini models through the Interactions API. It takes the same settings as GoogleLLMService, so switching between the two is a change of class, and a conversation can move between them mid-call, including one with function calls.
Each request carries the full context with store=False, so Google keeps no copy of the conversation.
Example Implementation
Complete example with function calling
Gemini Documentation
Official Google Gemini API documentation and features
Installation
google-genai >= 2.0.0.
Prerequisites
Required Environment Variables
GOOGLE_API_KEY: Your Google Gemini API key for authentication
Configuration
str
required
Google AI API key for authentication.
GoogleInteractionsLLMService.Settings
default:"None"
Runtime-configurable model settings. See Settings below.
list[dict[str, Any]]
default:"None"
Tools to offer the model when the context carries none, in Gemini’s
generateContent format or the Interactions API’s. Built-in Gemini tools are
passed here.dict[str, Any]
default:"None"
Configuration for tool usage, in Gemini’s
generateContent format
(function_calling_config).HttpOptions
default:"None"
HTTP options for the Google API client. The API version defaults to
v1beta
unless set here.float | None
default:"20.0"
How long to wait for the next event of a streamed response before giving up on
it. This is a gap between events, not a limit on how long a response may take
overall. Set to
None to wait indefinitely.float | None
default:"5.0"
How long to wait for the first event before giving up on the request and
re-issuing it, when
retry_on_timeout is set.bool
default:"False"
Whether to re-issue the request once if the first event doesn’t arrive within
retry_timeout_secs.Settings
Runtime-configurable settings passed via thesettings constructor argument using GoogleInteractionsLLMService.Settings(...). These can be updated mid-conversation with LLMUpdateSettingsFrame. See Service Settings for details.
The fields are those of GoogleLLMService.Settings; see its Settings table for types and descriptions. The defaults match, except where noted below.
Usage
Basic Setup
With Thinking Level
Notes
- Supported features: Streaming text, function calls (parallel and sequential), thought summaries, images, audio and documents, and token usage metrics.
run_inference()accepts aresponse_schemato enforce the structure of the reply. - Empty responses: A completed response with no text and no function call logs a warning and pushes a non-fatal
ErrorFrame, so the application can react instead of the bot going silent.
Event Handlers
GoogleInteractionsLLMService supports the following event handlers, inherited from LLMService: