From 2fe67ada97d32f7ae2a2be1ec5976f2df82a38db Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Fri, 17 Apr 2026 17:23:41 -0300 Subject: [PATCH] fix(translator): only apply thoughtSignature to the first functionCall part in Gemini parallel tool calls --- open-sse/translator/request/openai-to-gemini.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/open-sse/translator/request/openai-to-gemini.ts b/open-sse/translator/request/openai-to-gemini.ts index f71a578c..149685f4 100644 --- a/open-sse/translator/request/openai-to-gemini.ts +++ b/open-sse/translator/request/openai-to-gemini.ts @@ -225,7 +225,7 @@ function openaiToGeminiBase(model, body, stream, toolNameOptions: GeminiToolName .map((tc) => resolveGeminiThoughtSignature(tc.id, extractClientThoughtSignature(tc))) .find((signature) => typeof signature === "string" && signature.length > 0); - const shouldUseEmbeddedSignature = !parts.some((p) => p.thoughtSignature); + let shouldUseEmbeddedSignature = !parts.some((p) => p.thoughtSignature); for (const tc of msg.tool_calls) { if (tc.type !== "function") continue; @@ -239,6 +239,10 @@ function openaiToGeminiBase(model, body, stream, toolNameOptions: GeminiToolName ? firstPersistedSignature || signatureForToolCall || DEFAULT_THINKING_GEMINI_SIGNATURE : undefined; + if (embeddedThoughtSignature) { + shouldUseEmbeddedSignature = false; + } + // Gemini expects the signature on the functionCall part itself. parts.push({ ...(embeddedThoughtSignature ? { thoughtSignature: embeddedThoughtSignature } : {}),