Skip to main content

PDFSearchTool

We are still working on improving tools, so there might be unexpected behavior or changes in the future.

Description

The PDFSearchTool is a RAG tool designed for semantic searches within PDF content. It allows for inputting a search query and a PDF document, leveraging advanced search techniques to find relevant content efficiently. This capability makes it especially useful for extracting specific information from large PDF files quickly.

Installation

To get started with the PDFSearchTool, first, ensure the crewai_tools package is installed with the following command:

Example

Here’s how to use the PDFSearchTool to search within a PDF document:
Code

Arguments

  • pdf: Optional The PDF path for the search. Can be provided at initialization or within the run method’s arguments. If provided at initialization, the tool confines its search to the specified document.

Custom model and embeddings

By default, the tool uses OpenAI for both embeddings and summarization. To customize the model, you can use a config dictionary as follows. Note: a vector database is required because generated embeddings must be stored and queried from a vectordb.
Code

URL Validation

URL inputs are validated: file:// URIs and requests targeting private or reserved IP ranges are blocked to prevent server-side request forgery (SSRF) attacks.