better docs and download missing packaged

This commit is contained in:
Lorenze Jay
2025-01-30 16:04:33 -08:00
parent bcfe015d9d
commit 9a09ea7703
2 changed files with 15 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ This tool is designed to perform a semantic search for a specified query from a
## Installation
To incorporate this tool into your project, follow the installation instructions below:
```shell
pip install 'crewai[tools]'
uv add crewai[tools] exa_py
```
## Example
@@ -16,7 +16,7 @@ The following example demonstrates how to initialize the tool and execute a sear
from crewai_tools import EXASearchTool
# Initialize the tool for internet searching capabilities
tool = EXASearchTool()
tool = EXASearchTool(api_key="your_api_key")
```
## Steps to Get Started

View File

@@ -48,7 +48,19 @@ class EXASearchTool(BaseTool):
**kwargs,
)
if not EXA_INSTALLED:
raise ImportError("`exa-py` package not found, please run `uv add exa-py`")
import click
if click.confirm(
"You are missing the 'exa_py' package. Would you like to install it?"
):
import subprocess
subprocess.run(["uv", "add", "exa_py"], check=True)
else:
raise ImportError(
"You are missing the 'exa_py' package. Would you like to install it?"
)
self.client = Exa(api_key=api_key)
self.content = content
self.summary = summary