Skip to content

Commit 6addcf6

Browse files
committed
Fix role mismatch in gemini_investigate's conversation loop: function-call results were being sent with role 'user' instead of role 'function', contradicting geminiChat's own documented contract (see its doc comment) and Gemini's function-calling API spec. This likely degraded the model's ability to correctly track which turns were its own tool results vs new instructions across multi-step investigations.
1 parent 4b2f2b4 commit 6addcf6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

connectors/gemini/delegate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ export async function runInvestigation({ task, max_steps = 6 }) {
815815
transcript.push(`[step ${step}] ${name}(${JSON.stringify(args || {})}) -> ${resultText.length > 300 ? resultText.slice(0, 300) + "…" : resultText}`);
816816
responseParts.push({ functionResponse: { name, response: { result: resultText } } });
817817
}
818-
contents.push({ role: "user", parts: responseParts });
818+
contents.push({ role: "function", parts: responseParts });
819819
}
820820

821821
return { answer: `(Investigation stopped after reaching the step cap of ${cappedSteps} without a final answer -- the task may need to be narrowed, or more steps requested up to the hard cap of ${HARD_MAX_STEPS}.)`, steps: cappedSteps, transcript };

0 commit comments

Comments
 (0)