Update serper_dev_tool.py

This commit is contained in:
João Moura
2024-07-14 17:59:17 -03:00
committed by GitHub
parent ac3ee8576d
commit f447f71a8e

View File

@@ -38,15 +38,12 @@ class SerperDevTool(BaseTool):
save_file = kwargs.get('save_file', self.save_file) save_file = kwargs.get('save_file', self.save_file)
n_results = kwargs.get('n_results', self.n_results) n_results = kwargs.get('n_results', self.n_results)
payload = json.dumps( payload = { "q": search_query, "num": n_results }
{ payload["gl"] = self.country if self.country
"q": search_query, payload["location"] = self.country if self.location
"num": n_results, payload["hl"] = self.country if self.locale
"gl": self.country,
"location": self.location, payload = json.dumps(payload)
"hl": self.locale,
}
)
headers = { headers = {
'X-API-KEY': os.environ['SERPER_API_KEY'], 'X-API-KEY': os.environ['SERPER_API_KEY'],