Victor Virgolino
Victor Virgolino

Reputation: 11

Issue with Multiple Tool Executions in LangChain using ChatGoogleGenerativeAI Model

I'm working on a project where I'm trying to create an agent in LangChain using the ChatGoogleGenerativeAI model (gemini-1.5-flash) via create_tool_calling_agent. My goal is to build something similar to the create_openai_tools_agent using GPT-4, but without using the OpenAI API due to cost.

While I've managed to get the agent to work for single tool executions, I run into an issue when it tries to invoke a tool multiple times during the same task. The error I receive is as follows:

google.api_core.exceptions.InvalidArgument: 400 * GenerateContentRequest.contents[3].parts[0].function_response.name: Name cannot be empty.

It seems like the issue arises when the agent tries to call a tool more than once in a single task, which is strange since it works perfectly fine with single tool calls.

I also tried the same setup with create_openai_tools_agent, and it works fine with multiple tool invocations there. However, I want to avoid using OpenAI due to cost concerns.

Has anyone encountered this issue with the ChatGoogleGenerativeAI model in LangChain? Any suggestions on how to resolve or work around this error with multiple tool invocations?

GitHub repo (minus API keys): LangChain Agent Repository

Thanks in advance for your help!

Example: i'm working with a csv with data from students, if i ask for the data of one student it works fine, but when i ask for the data of student A and student B it breaks.

Upvotes: 1

Views: 355

Answers (0)

Related Questions