Update serper_dev_tool.py

stirng -> string
This commit is contained in:
Ikko Eltociear Ashimine
2024-03-17 12:32:08 +09:00
committed by GitHub
parent cf4f49c6e9
commit c09f62cf47

View File

@@ -31,10 +31,10 @@ class SerperDevTool(BaseTool):
results = response.json() results = response.json()
if 'organic' in results: if 'organic' in results:
results = results['organic'] results = results['organic']
stirng = [] string = []
for result in results: for result in results:
try: try:
stirng.append('\n'.join([ string.append('\n'.join([
f"Title: {result['title']}", f"Title: {result['title']}",
f"Link: {result['link']}", f"Link: {result['link']}",
f"Snippet: {result['snippet']}", f"Snippet: {result['snippet']}",
@@ -43,7 +43,7 @@ class SerperDevTool(BaseTool):
except KeyError: except KeyError:
next next
content = '\n'.join(stirng) content = '\n'.join(string)
return f"\nSearch results: {content}\n" return f"\nSearch results: {content}\n"
else: else:
return results return results