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