Gemini (1.5 Flash latest) not working in Agent

I am trying to run an agent with Gemini but it isn’t working. I keep getting this error -
[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:streamGenerateContent?alt=sse: [400 Bad Request] * GenerateContentRequest.tools[0].function_declarations[0].parameters.properties: should be non-empty for OBJECT type

It works fine with the Basic LLM chain though.

Information on your n8n setup

  • n8n version: 1.63.4
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: windows 11 pro

Hey @Anthony_Lee

It seems when using the tool agent, Gemini doesn’t like tools which don’t take an dynamic input. I see your tool intends to do a google search for a topic but I don’t see the dynamic field for “topic” which the agent I’m assuming will pass in?

Using another LLM model (GPT4o) works without modification so could possibily be a bug that is worth reporting.

As a workaround, add in another query/body param (say “p” for example) but select “let the model decide” or use a placeholder. Run again and it shouldn’t hang with this error.

1 Like

That was the solution! Thank you!!!

(For those reading, I simply added a body parameter called “input” and set it as optional in the HTTP tool. Thankfully the Google custom search ignores that input).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.