crewAIInc / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
20.23k stars 2.8k forks source link

[BUG] Unsupported data type when using PDFSearchTool #1448

Open sorin-costea opened 5 days ago

sorin-costea commented 5 days ago

Description

I get this error:

I encountered an error while trying to use the tool. This was the error: Unsupported data type.
 Tool Search a PDF's content accepts these inputs: Search a PDF's content(query: 'string') - A tool that can be used to semantic search a query the my.pdf PDF's content. query: 'Mandatory query you want to use to search the PDF's content'
# Agent: Researcher...
## Thought: In order to ...
## Using tool: Search a PDF's content
## Tool Input:
"{\"query\": \"key skills and qualifications\"}"

Steps to Reproduce

The code I use is (fluff removed for clarity):

from crewai_tools import PDFSearchTool
my_file_tool = PDFSearchTool(config=azure_config, pdf='my.pdf')
my_researcher = Agent(
    role="Researcher...",
    goal="Make sure to...",
    backstory=("As a..."),
    tools=[job_file_tool],
    ...
)
my_task = Task(
    description=("Analyze..."),
    agent=my_researcher,
    tools=[my_file_tool],
    ...
)
crew_test = Crew(
    agents=[my_researcher],
    tasks=[my_task],
    process=Process.sequential,
    full_output=True,
    verbose=True
)

Expected behavior

As I cannot influence the format of what the agent sends to the tools, I'd expect the agent would send properly query=string. Could it be the config=... is messing up things?

Screenshots/Code snippets

The error is in the description above

Operating System

Windows 11

Python Version

3.12

crewAI Version

0.67.1

crewAI Tools Version

0.12.1

Virtual Environment

Poetry

Evidence

The error is in the description above

Possible Solution

None

Additional context

Same behaviour when I use the DOCXSearchTool, so there's either something I completely misunderstand, or worse.

mrSingh007 commented 2 days ago

Facing the same issue in gemini:

pdf_search_tool = PDFSearchTool(pdf="lorem/Most_Admired_Wine.pdf", config=dict(
        embedder=dict(provider="google", config=dict(model="models/gemini-1.5-flash"))
    ))

...
    @agent
    def wine_tester(self) -> Agent:
        return Agent(
            config=self.agents_config['wine_tester'],
            verbose=True,
            llm='gemini/gemini-pro',
            tools=[pdf_search_tool]
        )

and error

I encountered an error while trying to use the tool. This was the error: 400 * BatchEmbedContentsRequest.model: unexpected model name format
* BatchEmbedContentsRequest.requests[0].model: unexpected model name format
.
 Tool Search a PDF's content accepts these inputs: Search a PDF's content(query: 'string') - A tool that can be used to semantic search a query the lorem/Most_Admired_Wine.pdf PDF's content. query: 'Mandatory query you want to use to search the PDF's content'