agent: Fix tool use in Gemini (#30689)

Thread doesn't run pending tools when `stop_reason` is not `ToolUse`.
Perhaps we should change that so that it always runs pending tools if
there are some, but for now this change just fixes setting `stop_reason`
for Google models.

Release Notes:

- N/A
This commit is contained in:
Oleksiy Syvokon 2025-05-14 15:43:17 +03:00 committed by GitHub
parent dce6e96c16
commit d42cb111f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -628,6 +628,7 @@ impl GoogleEventMapper {
// responds with `finish_reason: STOP`
if wants_to_use_tool {
self.stop_reason = StopReason::ToolUse;
events.push(Ok(LanguageModelCompletionEvent::Stop(StopReason::ToolUse)));
}
events
}