Gemini: Add config.yaml setting for thought signatures (#5025)

06691e8b9d933d11a779707d5fa42fa999ca1864

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
2 files changed, +5 -1Showing whitespace changes
default/config.yaml+2 -0
@@ -287,6 +287,8 @@ claude:
287287gemini:
288288 # API endpoint version ("v1beta" or "v1alpha")
289289 apiVersion: 'v1beta'
290+ # Adds thought signatures to requests (if available). Only for Gemini 3 and above.
291+ thoughtSignatures: true
290292 # Enables caching of the system prompt (if supported). Only for OpenRouter.
291293 # -- IMPORTANT! --
292294 # Use only when the prompt before the chat history is static and doesn't change between requests
src/prompt-converters.js+3 -1
@@ -31,6 +31,8 @@ const GEMINI_MEDIA_RESOLUTION = {
3131 high: 'media_resolution_high',
3232};
3333
34+const enableThoughtSignatures = !!getConfigValue('gemini.thoughtSignatures', true, 'boolean');
35+
3436/**
3537 * @typedef {object} PromptNames
3638 * @property {string} charName Character name
@@ -574,7 +576,7 @@ export function convertGooglePrompt(messages, model, useSysPrompt, names) {
574576 const textSignature = message.signature;
575577
576578 parts.forEach((part) => {
577579 if (enableThoughtSignatures && textSignature && typeof part.text === 'string') {
578580 part.thoughtSignature = textSignature;
579581 } else if (/gemini-3/.test(model)) {
580582 // Gemini 3: Fall back to bypass magic for function calls (mandatory) and images