From 9a09ea7703821997db911ff4b469d3dcf24d4bde Mon Sep 17 00:00:00 2001 From: Lorenze Jay Date: Thu, 30 Jan 2025 16:04:33 -0800 Subject: [PATCH] better docs and download missing packaged --- src/crewai_tools/tools/exa_tools/README.md | 4 ++-- .../tools/exa_tools/exa_search_tool.py | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/crewai_tools/tools/exa_tools/README.md b/src/crewai_tools/tools/exa_tools/README.md index 8d556dab3..1d1d20150 100644 --- a/src/crewai_tools/tools/exa_tools/README.md +++ b/src/crewai_tools/tools/exa_tools/README.md @@ -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 diff --git a/src/crewai_tools/tools/exa_tools/exa_search_tool.py b/src/crewai_tools/tools/exa_tools/exa_search_tool.py index 6bf834d6c..f094b0495 100644 --- a/src/crewai_tools/tools/exa_tools/exa_search_tool.py +++ b/src/crewai_tools/tools/exa_tools/exa_search_tool.py @@ -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