From 037e80c6a30878712744356d5bf42e7c2499c8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Thu, 2 May 2024 23:15:32 -0300 Subject: [PATCH] cutting new verison with exa search tool --- .../tools/exa_tools/exa_search_tool.py | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/crewai_tools/tools/exa_tools/exa_search_tool.py b/src/crewai_tools/tools/exa_tools/exa_search_tool.py index d26357e8c..541c673b9 100644 --- a/src/crewai_tools/tools/exa_tools/exa_search_tool.py +++ b/src/crewai_tools/tools/exa_tools/exa_search_tool.py @@ -5,24 +5,23 @@ 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') + 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, - } + payload = { + "query": search_query, + } - 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']) - else: - 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