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 (*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
}
}
}
Click to show internal directories.
Click to hide internal directories.