treating for uninstalled dependencies

This commit is contained in:
João Moura
2025-01-03 03:34:34 -03:00
parent 16cdabbf35
commit 8047ee067c
2 changed files with 12 additions and 2 deletions

View File

@@ -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:

View File

@@ -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)}")