weaver logoWeaver

Google Gemini

Detailed guide to configuration options for Google Gemini models in Weaver

Google Gemini Provider Options

Weaver supports several provider-specific configuration options for Google Gemini models. These can be set in the Provider Options (JSON) field in the chat configuration settings.

Available Provider Options

Search Grounding

Enable Google Search integration for up-to-date information.

{
  "useSearchGrounding": true,
  "dynamicRetrievalConfig": {
    "mode": "MODE_DYNAMIC",
    "dynamicThreshold": 0.8
  }
}

Search grounding options:

  • useSearchGrounding - Boolean to enable/disable search
  • dynamicRetrievalConfig - Optional. Used in conjunction with useSearchGrounding
  • dynamicRetrievalConfig.mode - Can be MODE_DYNAMIC (search only when needed) or MODE_UNSPECIFIED (always search)
  • dynamicRetrievalConfig.dynamicThreshold - Threshold value (0.0-1.0) for when to trigger search

Note: To enable inline citations, please use the following system prompt:

**Inline Citation Format:**
 * Format citations exactly as: `{@cite:URL;;PageTitle}`.

   * **URL**: Direct source link.
   * **PageTitle**: Plain text title (no markdown/HTML) and remove any `|`.
   * URL and PageTitle separated by `;;`.
 * Group multiple sources clearly using `::` separator:

   * **Example single source:**
     `Toronto had record snowfall today. {@cite:https://example.com/;;Weather Update}`
   * **Example multi-source:**
     `LA had a parade today. {@cite:https://ex1.com/;;Parade News::https://ex2.com/;;Local Events}`
 * Avoid repeating citations for the same source; consolidate citations at the end of relevant sections.

Response Modalities

Enable different response types from Gemini models, including image generation with gemini-2.0-flash-exp.

{
  "responseModalities": ["TEXT", "IMAGE"]
}

Possible values:

  • TEXT - Text responses (default)
  • IMAGE - Image generation (only available with certain models)

Thinking Summaries

Set to true to display reasoning.

{
  "thinkingConfig": {
    "includeThoughts": true
  }
}

Thinking Budget

Set a cap on the number of thinking (reasoning) tokens used in Gemini thinking models. Thinking is enabled by default but can be turned off.

To turn thinking off, set thinkingBudget to 0:

{
  "thinkingConfig": {
    "thinkingBudget": 0
  }
}

Possible values

  • thinkingBudget - 0 to 24576

Budgets from 1 to 1024 tokens will be set to 1024.

Safety Settings

Configure content filtering and safety thresholds for Gemini responses.

{
  "safetySettings": [
    { "category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_MEDIUM_AND_ABOVE" },
    { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_LOW_AND_ABOVE" }
  ]
}

Available categories:

  • HARM_CATEGORY_HATE_SPEECH
  • HARM_CATEGORY_DANGEROUS_CONTENT
  • HARM_CATEGORY_HARASSMENT
  • HARM_CATEGORY_SEXUALLY_EXPLICIT

Threshold options:

  • HARM_BLOCK_THRESHOLD_UNSPECIFIED
  • BLOCK_LOW_AND_ABOVE
  • BLOCK_MEDIUM_AND_ABOVE
  • BLOCK_ONLY_HIGH
  • BLOCK_NONE

Structured Outputs

Toggle structured output for JSON responses.

{
  "structuredOutputs": true
}

Possible values:

  • true - Enable structured outputs (default)
  • false - Disable structured outputs

This is useful when working with JSON Schema that contains elements not supported by the OpenAPI schema version that Google Gemini uses.

Cached Content

Reference previously cached content to provide context for new responses.

{
  "cachedContent": "cachedContents/YOUR_CACHED_CONTENT_ID"
}

Combining Multiple Options

You can combine multiple provider options in a single configuration:

{
  "responseModalities": ["TEXT", "IMAGE"],
  "safetySettings": [
    { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE" }
  ],
  "useSearchGrounding": true
}

Model Compatibility

Check the Gemini documentation for the most up-to-date compatibility information. AI SDK

On this page