mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 23:32:39 +00:00
update basetool dependencies to use root crewai repo
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import os
|
||||
from typing import Type
|
||||
|
||||
from crewai.tools import BaseTool
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from crewai_tools.tools.base_tool import BaseTool
|
||||
|
||||
|
||||
class EXABaseToolToolSchema(BaseModel):
|
||||
"""Input for EXABaseTool."""
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
import os
|
||||
import requests
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
|
||||
from .exa_base_tool import EXABaseTool
|
||||
|
||||
|
||||
class EXASearchTool(EXABaseTool):
|
||||
def _run(
|
||||
self,
|
||||
**kwargs: Any,
|
||||
) -> Any:
|
||||
search_query = kwargs.get('search_query')
|
||||
if search_query is None:
|
||||
search_query = kwargs.get('query')
|
||||
def _run(
|
||||
self,
|
||||
**kwargs: Any,
|
||||
) -> Any:
|
||||
search_query = kwargs.get("search_query")
|
||||
if search_query is None:
|
||||
search_query = kwargs.get("query")
|
||||
|
||||
payload = {
|
||||
"query": search_query,
|
||||
"type": "magic",
|
||||
}
|
||||
payload = {
|
||||
"query": search_query,
|
||||
"type": "magic",
|
||||
}
|
||||
|
||||
headers = self.headers.copy()
|
||||
headers["x-api-key"] = os.environ['EXA_API_KEY']
|
||||
headers = self.headers.copy()
|
||||
headers["x-api-key"] = os.environ["EXA_API_KEY"]
|
||||
|
||||
response = requests.post(self.search_url, json=payload, headers=headers)
|
||||
results = response.json()
|
||||
if 'results' in results:
|
||||
results = super()._parse_results(results['results'])
|
||||
return results
|
||||
response = requests.post(self.search_url, json=payload, headers=headers)
|
||||
results = response.json()
|
||||
if "results" in results:
|
||||
results = super()._parse_results(results["results"])
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user