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

# Google (Gemini)

> Using Google Gemini models with Upsonic

## Overview

Google provides the Gemini family of multimodal models with strong capabilities in reasoning, vision, and grounding. Upsonic supports both the Gemini API and Vertex AI.

**Model Class:** `GoogleModel`

**Provider Options:**

* `google-gla`: Gemini API (generativelanguage.googleapis.com)
* `google-vertex`: Vertex AI API (requires GCP setup)

## Authentication

```bash theme={null}
export GOOGLE_API_KEY="AIza..."
# OR (legacy)
export GEMINI_API_KEY="AIza..."

# For Vertex AI
export GOOGLE_CLOUD_PROJECT="your-project-id"
export GOOGLE_CLOUD_LOCATION="us-central1"  # Optional
```

## Examples

```python theme={null}
from upsonic import Agent, Task
from upsonic.models.google import GoogleModel

model = GoogleModel(model_name="gemini-2.5-flash", provider="google-gla")
agent = Agent(model=model)

task = Task("Hello, how are you?")
result = agent.do(task)
print(result)
```

## Model Settings

You can set model parameters in two ways: on the model or on the Agent.

**On the model:**

```python theme={null}
from upsonic import Agent, Task
from upsonic.models.google import GoogleModel, GoogleModelSettings

model = GoogleModel(
    model_name="gemini-2.5-flash",
    provider="google-gla",
    settings=GoogleModelSettings(max_tokens=1024, temperature=0.7)
)
agent = Agent(model=model)
```

**On the Agent:**

```python theme={null}
from upsonic import Agent, Task
from upsonic.models.google import GoogleModelSettings

agent = Agent(
    model="google-gla/gemini-2.5-flash",
    settings=GoogleModelSettings(max_tokens=1024)
)
```

## Parameters

| Parameter                 | Type                          | Description                           | Default | Source   |
| ------------------------- | ----------------------------- | ------------------------------------- | ------- | -------- |
| `max_tokens`              | `int`                         | Maximum tokens to generate            | 2048    | Base     |
| `temperature`             | `float`                       | Sampling temperature (0.0-2.0)        | 1.0     | Base     |
| `top_p`                   | `float`                       | Nucleus sampling threshold            | 0.95    | Base     |
| `seed`                    | `int`                         | Random seed for deterministic outputs | None    | Base     |
| `stop_sequences`          | `list[str]`                   | Sequences that stop generation        | None    | Base     |
| `presence_penalty`        | `float`                       | Penalty for token presence            | 0.0     | Base     |
| `frequency_penalty`       | `float`                       | Penalty for token frequency           | 0.0     | Base     |
| `google_safety_settings`  | `list[SafetySettingDict]`     | Content safety configuration          | None    | Specific |
| `google_thinking_config`  | `ThinkingConfigDict`          | Thinking behavior configuration       | None    | Specific |
| `google_labels`           | `dict[str, str]`              | Billing labels (Vertex AI only)       | None    | Specific |
| `google_video_resolution` | `'low' \| 'medium' \| 'high'` | Video processing resolution           | None    | Specific |
| `google_cached_content`   | `str`                         | Name of cached content to use         | None    | Specific |
