mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
moving EXA env dependency to tool execution
This commit is contained in:
@@ -16,7 +16,6 @@ class EXABaseTool(BaseTool):
|
|||||||
headers: dict = {
|
headers: dict = {
|
||||||
"accept": "application/json",
|
"accept": "application/json",
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
"x-api-key": os.environ['EXA_API_KEY'],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _parse_results(self, results):
|
def _parse_results(self, results):
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import requests
|
import requests
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@@ -16,7 +17,10 @@ class EXASearchTool(EXABaseTool):
|
|||||||
"query": search_query,
|
"query": search_query,
|
||||||
}
|
}
|
||||||
|
|
||||||
response = requests.post(self.search_url, json=payload, headers=self.headers)
|
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()
|
results = response.json()
|
||||||
if 'results' in results:
|
if 'results' in results:
|
||||||
results = super()._parse_results(results['results'])
|
results = super()._parse_results(results['results'])
|
||||||
|
|||||||
Reference in New Issue
Block a user