mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 12:03:23 +00:00
fix(ai): preserve unsigned tool call context for Gemini 3 with anti-mimicry note
Instead of skipping unsigned tool calls entirely (which lobotomizes context), convert them to text with an explicit note telling the model this is historical context from a different model and not a format to mimic. This preserves tool call/result context when switching from providers without thought signatures (e.g. Claude via Antigravity) to Gemini 3.
This commit is contained in:
parent
1405e30492
commit
5d3e7d5aaa
2 changed files with 6 additions and 2 deletions
|
|
@ -135,11 +135,12 @@ export function convertMessages<T extends GoogleApiType>(model: Model<T>, contex
|
|||
// Gemini 3 requires thoughtSignature on all function calls when thinking mode is enabled.
|
||||
// When replaying history from providers without thought signatures (e.g. Claude via Antigravity),
|
||||
// convert unsigned function calls to text to avoid API validation errors.
|
||||
// We include a note telling the model this is historical context to prevent mimicry.
|
||||
const isGemini3 = model.id.toLowerCase().includes("gemini-3");
|
||||
if (isGemini3 && !thoughtSignature) {
|
||||
const argsStr = JSON.stringify(block.arguments, null, 2);
|
||||
parts.push({
|
||||
text: `[Tool Call: ${block.name}]\nArguments: ${argsStr}`,
|
||||
text: `[Historical context: a different model called tool "${block.name}" with arguments: ${argsStr}. Do not mimic this format - use proper function calling.]`,
|
||||
});
|
||||
} else {
|
||||
const part: Part = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue