crewAI: SerperDevTool._run() missing 1 required positional argument: 'search_query'.

A.I says: I encountered an error while trying to use the tool. This was the error: SerperDevTool._run() missing 1 required positional argument: ‘search_query’. Tool Search the internet accepts these inputs: Search the internet(search_query: ‘string’) - A tool that can be used to semantic search a query from a txt’s content.

I am just running from the example, copy and paste. `` import os from crewai import Agent, Task, Crew, Process from crewai_tools import SerperDevTool

#os.environ[“OPENAI_API_KEY”] = “YOUR_API_KEY” os.environ[“SERPER_API_KEY”] = “I have filled this in with a valid key” # serper.dev API key

os.environ[“OPENAI_API_BASE”] =‘http://localhost:11434/v1’ os.environ[“OPENAI_MODEL_NAME”] =‘mistral’ # Adjust based on available model os.environ[“OPENAI_API_KEY”] =‘null’ #switching between null and ollama makes no difference, the error as mentioned remains.

search_tool = SerperDevTool() ``

The rest is exactly copy and paste from the front page example.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 63 (5 by maintainers)

Most upvoted comments

Do I still have to configure all model files to introduce “Result” as stop word?

@0xC0FFEE71 last time I check this was not necessary anymore

@BracerJack @thiagosrib @ThinksFast

Updated to the latest v0.28.5 as of 11 April 2024, same issue: I encountered an error while trying to use the tool. This was the error: SerperDevTool._run() missing 1 required positional argument: ‘search_query’. Tool Search the internet accepts these inputs: Search the internet(search_query: ‘string’) - A tool that can be used to semantic search a query from a txt’s content.

This one could be a bug we shipped a couple thins in the tools that I think impacted, this will get the team looking into it first thing in the morning

Hey folks, good new this should be fixed on the new version we are now testing, 0.30.0rc3, if you want ot give it a try you can do to with pip install 'crewai[tools]'==0.30.0rc3 lmk how it goes!

Adding Set the input parameter as : search_query' didn’t really help in my case, even when using your agent and task:

[DEBUG]: == Working Agent: Researcher
[INFO]: == Starting Task: Find and summarize the latest AI news. Set the input parameter as : search_query


> Entering new CrewAgentExecutor chain...
Action: Search the internet(search_query="latest AI news")
Action Input: {'search_query': 'latest AI news'}

Action 'Search the internet(search_query="latest AI news")' don't exist, these are the only available Actions: Search the internet: Search the internet(search_query: 'string') - A tool that can be used to semantic search a query from a txt's content.

I seem to have solved the problem. When you define the task that involves serper search tool, in the task description add this particular line: ‘Set the input parameter as : search_query’. By default it sets the parameter as ‘query’ which is not allowed by serper, so… try this