mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
treating for uninstalled dependencies
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
from linkup import LinkupClient
|
||||
try:
|
||||
from linkup import LinkupClient
|
||||
LINKUP_AVAILABLE = True
|
||||
except ImportError:
|
||||
LINKUP_AVAILABLE = False
|
||||
|
||||
from pydantic import PrivateAttr
|
||||
|
||||
class LinkupSearchTool:
|
||||
@@ -10,6 +15,11 @@ class LinkupSearchTool:
|
||||
"""
|
||||
Initialize the tool with an API key.
|
||||
"""
|
||||
if not LINKUP_AVAILABLE:
|
||||
raise ImportError(
|
||||
"The 'linkup' package is required to use the LinkupSearchTool. "
|
||||
"Please install it with: uv add linkup"
|
||||
)
|
||||
self._client = LinkupClient(api_key=api_key)
|
||||
|
||||
def _run(self, query: str, depth: str = "standard", output_type: str = "searchResults") -> dict:
|
||||
|
||||
@@ -90,7 +90,7 @@ class SpiderTool(BaseTool):
|
||||
self.spider = Spider(api_key=api_key)
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"`spider-client` package not found, please run `pip install spider-client`"
|
||||
"`spider-client` package not found, please run `uv add spider-client`"
|
||||
)
|
||||
except Exception as e:
|
||||
raise RuntimeError(f"Failed to initialize Spider client: {str(e)}")
|
||||
|
||||
Reference in New Issue
Block a user