Skip to content

Commit

Permalink
fix(js/plugins/googleai): work around googleai forced tool calling in…
Browse files Browse the repository at this point in the history
…finite loop
  • Loading branch information
pavelgj committed Dec 13, 2024
1 parent 7893efd commit 863549a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/plugins/googleai/src/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,12 @@ export function defineGoogleAIModel(
}

let toolConfig: ToolConfig | undefined;
if (requestConfig.functionCallingConfig) {
if (
requestConfig.functionCallingConfig &&
// This is a workround for issue: https://github.com/firebase/genkit/issues/1520
// TODO: remove this when the issue is resolved upstream in the Gemini API
!messages[messages.length - 1].content.find((c) => c.toolResponse)
) {
toolConfig = {
functionCallingConfig: {
allowedFunctionNames:
Expand Down

0 comments on commit 863549a

Please sign in to comment.