> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Gemini Interactions LLM

> GoogleInteractionsLLMService runs Gemini models through the Interactions API with streaming, function calling, and multimodal input.

## Overview

`GoogleInteractionsLLMService` provides integration with Google's Gemini models through the Interactions API. It takes the same settings as [`GoogleLLMService`](https://docs.pipecat.ai/api-reference/server/services/llm/google), 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.

> [card] [Example Implementation](https://github.com/pipecat-ai/pipecat/blob/main/examples/function-calling/function-calling-google-interactions.py)
>
> Complete example with function calling

> [card] [Gemini Documentation](https://ai.google.dev/gemini-api/docs)
>
> Official Google Gemini API documentation and features

## Installation

```bash theme={null}
uv add "pipecat-ai[google]"
```

The service requires `google-genai >= 2.0.0`.

## Prerequisites

### Required Environment Variables

* `GOOGLE_API_KEY`: Your Google Gemini API key for authentication

## Configuration

```python theme={null}
from pipecat.services.google.interactions.llm import GoogleInteractionsLLMService
```

**api\_key** `str` *required*

Google AI API key for authentication.

**settings** `GoogleInteractionsLLMService.Settings` (default: None)

Runtime-configurable model settings. See [Settings](#settings) below.

**tools** `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.

**tool\_config** `dict[str, Any]` (default: None)

Configuration for tool usage, in Gemini's `generateContent` format
(`function_calling_config`).

**http\_options** `HttpOptions` (default: None)

HTTP options for the Google API client. The API version defaults to `v1beta`
unless set here.

**stream\_idle\_timeout\_secs** `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.

**retry\_timeout\_secs** `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.

**retry\_on\_timeout** `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 the `settings` constructor argument using `GoogleInteractionsLLMService.Settings(...)`. These can be updated mid-conversation with `LLMUpdateSettingsFrame`. See [Service Settings](https://docs.pipecat.ai/pipecat/fundamentals/service-settings.md) for details.

The fields are those of `GoogleLLMService.Settings`; see [its Settings table](https://docs.pipecat.ai/api-reference/server/services/llm/google.md#settings) for types and descriptions. The defaults match, except where noted below.

| Parameter | Default | Behavior in this service |
| - | - | - |
| `top_k` | `None` | Ignored with a warning; the Interactions API has no such field. |
| `frequency_penalty` | `None` | Ignored with a warning; the Interactions API has no such field. |
| `presence_penalty` | `None` | Ignored with a warning; the Interactions API has no such field. |
| `thinking` | `None` | Only `thinking_level` and `include_thoughts` apply. A `thinking_budget` is ignored with a warning. If not provided, Pipecat sends the lowest thinking level for the model. |
| `safety_settings` | `None` | Content safety filters, as a list of `SafetySetting`. Categories left unspecified keep the Gemini API defaults. |

## Usage

### Basic Setup

```python theme={null}
import os

from pipecat.services.google.interactions.llm import GoogleInteractionsLLMService

llm = GoogleInteractionsLLMService(
    api_key=os.getenv("GOOGLE_API_KEY"),
    settings=GoogleInteractionsLLMService.Settings(
        system_instruction="You are a helpful assistant.",
    ),
)
```

### With Thinking Level

```python theme={null}
llm = GoogleInteractionsLLMService(
    api_key=os.getenv("GOOGLE_API_KEY"),
    settings=GoogleInteractionsLLMService.Settings(
        thinking=GoogleInteractionsLLMService.ThinkingConfig(
            thinking_level="high",
            include_thoughts=True,
        ),
    ),
)
```

## Notes

* **Supported features**: Streaming text, function calls (parallel and sequential), thought summaries, images, audio and documents, and token usage metrics. `run_inference()` accepts a `response_schema` to 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](https://docs.pipecat.ai/api-reference/server/events/service-events.md):

| Event | Description |
| - | - |
| `on_completion_timeout` | Called when an LLM completion request times out |
| `on_function_calls_started` | Called when function calls are received and execution is about to start |
| `on_function_calls_cancelled` | Called after one or more in-progress function calls are cancelled |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.