Skip to content

GoogleSerperAPIWrapper gives error " Input should be a valid string [type=string_type, input_value={'description': 'Dr. Mihi...n field', 'type': 'str'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.10/v/string_type." #2046

@Ansumanbhujabal

Description

@Ansumanbhujabal

Description

While using GoogleSerperAPIWrapper as a tool in CrewAi Multi agents system , frequently getting this error these days . Which generally makes the agent slow .


I encountered an error while trying to use the tool. This was the error: Arguments validation failed: 1 validation error for Googlesearchtool
search_query
  Input should be a valid string [type=string_type, input_value={'description': 'Dr. Mihi...n field', 'type': 'str'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/string_type.
 Tool GoogleSearchTool accepts these inputs: Tool Name: GoogleSearchTool
Tool Arguments: {'search_query': {'description': None, 'type': 'str'}}
Tool Description: Performs a search using the GoogleSearchTool.

Steps to Reproduce

Sample Serper use

search = GoogleSerperAPIWrapper()
@tool("GoogleSearchTool")
def Google_search_tool(search_query: str):
    """Performs a search using the GoogleSearchTool."""
    return search().run(search_query)
## Defining Agents

famous_personality_reviewer_agent = Agent(role=
                          "Senior Content Validator and fact checker",
                          goal="Validate the content with facts and get the most correct content", 
                          backstory=
                          """
                          You are a Senior Content Validator and fact checker  who has been assigned to validate the task 
                          for the {career_name} field if {famous_personalities_name} You will give best fact based 
                          """,
                          llm=llm,
                          tools = [Google_search_tool],
                          verbose=True)

inputs = {
        "career_name": "Automobile Engineer",
       "famous_personalities_name": "Dr. Mihir Shah \nRajendra Singh \nAnupam Mishra \nAyyappa Masagi "
               }

Error is

I encountered an error while trying to use the tool. This was the error: Arguments validation failed: 1 validation error for Googlesearchtool
search_query
  Input should be a valid string [type=string_type, input_value={'description': 'Dr. Mihi...n field', 'type': 'str'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/string_type.
 Tool GoogleSearchTool accepts these inputs: Tool Name: GoogleSearchTool
Tool Arguments: {'search_query': {'description': None, 'type': 'str'}}
Tool Description: Performs a search using the GoogleSearchTool.

Dependecies

agentneo==1.2.3
cachetools==5.5.0
certifi==2024.12.14
crewai==0.95.0
crewai-tools==0.32.0
GitPython==3.1.44
google-api-core==2.24.0
google-auth==2.37.0
google-cloud-aiplatform==1.77.0
google-cloud-bigquery==3.27.0
google-cloud-core==2.4.1
google-cloud-resource-manager==1.14.0
google-cloud-storage==2.19.0
google-crc32c==1.6.0
google-resumable-media==2.7.2
googleapis-common-protos==1.66.0
groq==0.13.1
grpc-google-iam-v1==0.14.0
langchain==0.3.17
langchain-cohere==0.3.4
langchain-community==0.3.16
langchain-core==0.3.33
langchain-exa==0.2.1
langchain-experimental==0.3.4
langchain-groq==0.2.2
langchain-openai==0.2.14
langchain-pinecone==0.2.0
langchain-text-splitters==0.3.5
pydantic==2.10.4
pydantic-settings==2.7.1
pydantic_core==2.27.2
scrapegraph_py==1.10.0
selenium==4.27.1
serpapi==0.1.5
setuptools==75.8.0

Expected behavior

This error should not be coming.

Screenshots/Code snippets

Image

Operating System

Ubuntu 20.04

Python Version

3.10

crewAI Version

0.95.0

crewAI Tools Version

0.32.0

Virtual Environment

Venv

Evidence

Image

Possible Solution

None

Additional context

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions