> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-service-account.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini

The Gemini model provides access to Google's Gemini models.

## Parameters

| Parameter                            | Type                       | Default              | Description                                                                                                        |
| ------------------------------------ | -------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `id`                                 | `str`                      | `"gemini-3.5-flash"` | The id of the Gemini model to use                                                                                  |
| `name`                               | `str`                      | `"Gemini"`           | The name of the model                                                                                              |
| `provider`                           | `str`                      | `"Google"`           | The provider of the model                                                                                          |
| `function_declarations`              | `Optional[List[Any]]`      | `None`               | Function declarations to make available to the model                                                               |
| `generation_config`                  | `Optional[Any]`            | `None`               | Generation configuration parameters for the model                                                                  |
| `safety_settings`                    | `Optional[List[Any]]`      | `None`               | Safety settings to filter content                                                                                  |
| `generative_model_kwargs`            | `Optional[Dict[str, Any]]` | `None`               | Additional keyword arguments for the generative model                                                              |
| `search`                             | `bool`                     | `False`              | Add the Google Search tool so the model can search the web                                                         |
| `grounding`                          | `bool`                     | `False`              | Enable grounding with Google Search retrieval                                                                      |
| `grounding_dynamic_threshold`        | `Optional[float]`          | `None`               | Dynamic retrieval threshold for grounding                                                                          |
| `url_context`                        | `bool`                     | `False`              | Add the URL context tool so the model can read URLs from the prompt                                                |
| `vertexai_search`                    | `bool`                     | `False`              | Enable retrieval from a Vertex AI Search datastore                                                                 |
| `vertexai_search_datastore`          | `Optional[str]`            | `None`               | Resource name of the Vertex AI Search datastore. Required when `vertexai_search` is True                           |
| `parallel_search`                    | `bool`                     | `False`              | Enable Parallel web search grounding (Vertex AI only)                                                              |
| `parallel_api_key`                   | `Optional[str]`            | `None`               | API key for Parallel web search                                                                                    |
| `parallel_config`                    | `Optional[Dict[str, Any]]` | `None`               | Custom configuration for Parallel search, passed as `custom_configs` (e.g. domain filtering)                       |
| `file_search_store_names`            | `Optional[List[str]]`      | `None`               | Gemini File Search store names to search                                                                           |
| `file_search_metadata_filter`        | `Optional[str]`            | `None`               | Metadata filter applied to File Search results                                                                     |
| `temperature`                        | `Optional[float]`          | `None`               | Controls randomness in the model's output                                                                          |
| `top_p`                              | `Optional[float]`          | `None`               | Controls diversity via nucleus sampling                                                                            |
| `top_k`                              | `Optional[int]`            | `None`               | Controls diversity via top-k sampling                                                                              |
| `max_output_tokens`                  | `Optional[int]`            | `None`               | Maximum number of tokens to generate                                                                               |
| `stop_sequences`                     | `Optional[List[str]]`      | `None`               | Sequences where the model stops generating further tokens                                                          |
| `logprobs`                           | `Optional[bool]`           | `None`               | Whether to return log probabilities of the output tokens                                                           |
| `presence_penalty`                   | `Optional[float]`          | `None`               | Penalizes new tokens based on whether they appear in the text so far                                               |
| `frequency_penalty`                  | `Optional[float]`          | `None`               | Penalizes new tokens based on their frequency in the text so far                                                   |
| `seed`                               | `Optional[int]`            | `None`               | Random seed for deterministic sampling                                                                             |
| `response_modalities`                | `Optional[List[str]]`      | `None`               | Output modalities to request: `"TEXT"`, `"IMAGE"`, and/or `"AUDIO"`                                                |
| `speech_config`                      | `Optional[Dict[str, Any]]` | `None`               | Speech generation configuration for audio output                                                                   |
| `cached_content`                     | `Optional[Any]`            | `None`               | Cached content identifier for context caching                                                                      |
| `thinking_budget`                    | `Optional[int]`            | `None`               | Thinking token budget for Gemini 2.5 models                                                                        |
| `include_thoughts`                   | `Optional[bool]`           | `None`               | Include thought summaries in the response                                                                          |
| `thinking_level`                     | `Optional[str]`            | `None`               | Thinking level: `"low"` or `"high"`                                                                                |
| `request_params`                     | `Optional[Dict[str, Any]]` | `None`               | Additional parameters to include in the request                                                                    |
| `timeout`                            | `Optional[float]`          | `None`               | Request timeout in seconds                                                                                         |
| `collect_metrics_on_completion`      | `bool`                     | `True`               | Collect token metrics only on the final streaming chunk. Gemini reports cumulative counts per chunk                |
| `credentials`                        | `Optional[Credentials]`    | `None`               | Google Cloud credentials for Vertex AI                                                                             |
| `api_key`                            | `Optional[str]`            | `None`               | The API key for Google AI (defaults to GOOGLE\_API\_KEY env var)                                                   |
| `vertexai`                           | `bool`                     | `False`              | Use the Vertex AI API. Also enabled when the GOOGLE\_GENAI\_USE\_VERTEXAI env var is `"true"`                      |
| `project_id`                         | `Optional[str]`            | `None`               | Google Cloud project ID for Vertex AI. Falls back to the GOOGLE\_CLOUD\_PROJECT env var                            |
| `location`                           | `Optional[str]`            | `None`               | Google Cloud location for Vertex AI. Falls back to the GOOGLE\_CLOUD\_LOCATION env var                             |
| `client_params`                      | `Optional[Dict[str, Any]]` | `None`               | Additional parameters for client configuration                                                                     |
| `client`                             | `Optional[GeminiClient]`   | `None`               | A pre-configured instance of the Gemini client                                                                     |
| `model_type`                         | `ModelType`                | `ModelType.MODEL`    | Functional role of this model (`MODEL`, `OUTPUT_MODEL`, or `PARSER_MODEL`). Set by the agent during initialization |
| `supports_native_structured_outputs` | `bool`                     | `True`               | True if the model supports structured outputs natively                                                             |
| `supports_json_schema_outputs`       | `bool`                     | `False`              | True if the model requires a JSON schema for structured outputs                                                    |
| `system_prompt`                      | `Optional[str]`            | `None`               | System prompt from the model added to the Agent                                                                    |
| `instructions`                       | `Optional[List[str]]`      | `None`               | Instructions from the model added to the Agent                                                                     |
| `tool_message_role`                  | `str`                      | `"tool"`             | Role used for tool messages                                                                                        |
| `assistant_message_role`             | `str`                      | `"assistant"`        | Role used for assistant messages                                                                                   |
| `cache_response`                     | `bool`                     | `False`              | Cache model responses to avoid redundant API calls during development                                              |
| `cache_ttl`                          | `Optional[int]`            | `None`               | Time-to-live for cached model responses, in seconds. If None, cache never expires                                  |
| `cache_dir`                          | `Optional[str]`            | `None`               | Directory for cached model responses. If None, uses the default cache location                                     |
| `retries`                            | `int`                      | `0`                  | Number of retries to attempt before raising a ModelProviderError                                                   |
| `delay_between_retries`              | `int`                      | `1`                  | Delay between retries, in seconds                                                                                  |
| `exponential_backoff`                | `bool`                     | `False`              | If True, the delay between retries is doubled each time                                                            |
| `retry_with_guidance`                | `bool`                     | `True`               | Retry the model invocation with a guidance message for known errors avoidable with extra instructions              |
| `retry_with_guidance_limit`          | `int`                      | `1`                  | Number of times to retry the model invocation with guidance                                                        |
