Gemini: Add config.yaml setting for thought signatures (#5025)
Signed| @@ -287,6 +287,8 @@ claude: | ||
| 287 | 287 | gemini: |
| 288 | 288 | # API endpoint version ("v1beta" or "v1alpha") |
| 289 | 289 | apiVersion: 'v1beta' |
| 290 | + # Adds thought signatures to requests (if available). Only for Gemini 3 and above. | |
| 291 | + thoughtSignatures: true | |
| 290 | 292 | # Enables caching of the system prompt (if supported). Only for OpenRouter. |
| 291 | 293 | # -- IMPORTANT! -- |
| 292 | 294 | # Use only when the prompt before the chat history is static and doesn't change between requests |
| @@ -31,6 +31,8 @@ const GEMINI_MEDIA_RESOLUTION = { | ||
| 31 | 31 | high: 'media_resolution_high', |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | +const enableThoughtSignatures = !!getConfigValue('gemini.thoughtSignatures', true, 'boolean'); | |
| 35 | + | |
| 34 | 36 | /** |
| 35 | 37 | * @typedef {object} PromptNames |
| 36 | 38 | * @property {string} charName Character name |
| @@ -574,7 +576,7 @@ export function convertGooglePrompt(messages, model, useSysPrompt, names) { | ||
| 574 | 576 | const textSignature = message.signature; |
| 575 | 577 | |
| 576 | 578 | parts.forEach((part) => { |
| 577 | 579 | if (enableThoughtSignatures && textSignature && typeof part.text === 'string') { |
| 578 | 580 | part.thoughtSignature = textSignature; |
| 579 | 581 | } else if (/gemini-3/.test(model)) { |
| 580 | 582 | // Gemini 3: Fall back to bypass magic for function calls (mandatory) and images |