mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-02 07:42:40 +00:00
renaming exa tool
This commit is contained in:
24
src/crewai_tools/tools/exa_tools/exa_search_tool.py
Normal file
24
src/crewai_tools/tools/exa_tools/exa_search_tool.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import requests
|
||||
from typing import Any
|
||||
|
||||
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')
|
||||
|
||||
payload = {
|
||||
"query": search_query,
|
||||
}
|
||||
|
||||
response = requests.post(self.search_url, json=payload, headers=self.headers)
|
||||
results = response.json()
|
||||
if 'results' in results:
|
||||
results = super()._parse_results(results['results'])
|
||||
else:
|
||||
return results
|
||||
Reference in New Issue
Block a user