gemini

package
v6.8.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package gemini implements thinking configuration for Gemini models.

Gemini models have two formats:

  • Gemini 2.5: Uses thinkingBudget (numeric)
  • Gemini 3.x: Uses thinkingLevel (string: minimal/low/medium/high) or thinkingBudget=-1 for auto/dynamic mode

Output format is determined by ThinkingConfig.Mode and ThinkingSupport.Levels:

  • ModeAuto: Always uses thinkingBudget=-1 (both Gemini 2.5 and 3.x)
  • len(Levels) > 0: Uses thinkingLevel (Gemini 3.x discrete levels)
  • len(Levels) == 0: Uses thinkingBudget (Gemini 2.5)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Applier

type Applier struct{}

Applier applies thinking configuration for Gemini models.

Gemini-specific behavior:

  • Gemini 2.5: thinkingBudget format, flash series supports ZeroAllowed
  • Gemini 3.x: thinkingLevel format, cannot be disabled
  • Use ThinkingSupport.Levels to decide output format

func NewApplier

func NewApplier() *Applier

NewApplier creates a new Gemini thinking applier.

func (*Applier) Apply

func (a *Applier) Apply(body []byte, config thinking.ThinkingConfig, modelInfo *registry.ModelInfo) ([]byte, error)

Apply applies thinking configuration to Gemini request body.

Expected output format (Gemini 2.5):

{
  "generationConfig": {
    "thinkingConfig": {
      "thinkingBudget": 8192,
      "includeThoughts": true
    }
  }
}

Expected output format (Gemini 3.x):

{
  "generationConfig": {
    "thinkingConfig": {
      "thinkingLevel": "high",
      "includeThoughts": true
    }
  }
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL