diff --git a/cookbook/assistants/vision.py b/cookbook/assistants/vision.py index e080289e5..89727e489 100644 --- a/cookbook/assistants/vision.py +++ b/cookbook/assistants/vision.py @@ -11,7 +11,7 @@ "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" - } + }, }, ] ) @@ -27,14 +27,14 @@ "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" - } + }, }, { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" - } + }, }, ], markdown=True, -) \ No newline at end of file +) diff --git a/cookbook/tools/googlesearch_1.py b/cookbook/tools/googlesearch_1.py index b2471cea4..d68771085 100644 --- a/cookbook/tools/googlesearch_1.py +++ b/cookbook/tools/googlesearch_1.py @@ -7,10 +7,10 @@ instructions=[ "Given a topic by the user, respond with 4 latest news items about that topic.", "Search for 10 news items and select the top 4 unique items.", - "Search in English and in French." + "Search in English and in French.", ], show_tool_calls=True, - debug_mode=True, + debug_mode=True, ) news_assistant.print_response("Mistral IA", markdown=True) diff --git a/phi/tools/googlesearch.py b/phi/tools/googlesearch.py index 71c708b84..cd4ad83a1 100644 --- a/phi/tools/googlesearch.py +++ b/phi/tools/googlesearch.py @@ -14,11 +14,12 @@ except ImportError: raise ImportError("`pycountry` not installed. Please install using `pip install pycountry`") + class GoogleSearch(Toolkit): """ GoogleSearch is a Python library for searching Google easily. It uses requests and BeautifulSoup4 to scrape Google. - + Args: fixed_max_results (Optional[int]): A fixed number of maximum results. fixed_language (Optional[str]): Language of the search results. @@ -26,7 +27,7 @@ class GoogleSearch(Toolkit): proxy (Optional[str]): Proxy settings for the request. timeout (Optional[int]): Timeout for the request, default is 10 seconds. """ - + def __init__( self, fixed_max_results: Optional[int] = None, @@ -76,10 +77,12 @@ def google_search(self, query: str, max_results: int = 5, language: str = "en") # Collect the search results res: List[Dict[str, str]] = [] for result in results: - res.append({ - "title": result.title, - "url": result.url, - "description": result.description, - }) + res.append( + { + "title": result.title, + "url": result.url, + "description": result.description, + } + ) return json.dumps(res, indent=2)