Hi everybody,
I’m using the data_extract_agent
to extract plain text from data input and uploaded files, including PDFs. However, it shows an error indicating it can’t read the uploaded file. I’m wondering if the FileReadTool
supports PDF, DOCX, and PNG file types?
@Maythunguyen FileReadTool
can read only text-based file formats while you also have PNG. Try to remove all PNGs from your project and see if the error persists. See the docs:
The FileReadTool
conceptually represents a suite of functionalities within the crewai_tools package aimed at facilitating file reading and content retrieval. This suite includes tools for processing batch text files, reading runtime configuration files, and importing data for analytics. It supports a variety of text-based file formats such as .txt
, .csv
, .json
, and more. Depending on the file type, the suite offers specialized functionality, such as converting JSON content into a Python dictionary for ease of use.
Thanks, @rokbenko. What if I want the agent to read the PDF file? Is there any proper way to do that?
CrewAI offers a lot of RAG tools for specific file formats:
Simply provide all the RAG tools you need to the agent as follows:
from crewai import Agent
from crewai_tools import (
PDFSearchTool,
DOCXSearchTool,
TXTSearchTool,
)
my_agent = Agent(
...,
tools=[
PDFSearchTool(),
DOCXSearchTool(),
TXTSearchTool(),
],
)