Created
October 14, 2024 14:32
-
-
Save k-nowicki/38e83865e32a4dad1f0affb917ad3149 to your computer and use it in GitHub Desktop.
AutogenStudion Skill for google search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Autogen skill | |
# Name: google_search | |
# Description: Returns num of search results for query | |
from googlesearch import search | |
def google_search(query, num=5): | |
""" | |
Function to get google search resluts for query. | |
:param query: A query that will be searched for. | |
:param num: number of resluts that will be returned | |
:return: A list of SearchResult with properties: | |
- title | |
- url | |
- description | |
""" | |
return search(query, num_results=num, advanced=True) | |
# Usage: | |
# results = google_search("query", 5) | |
# | |
# for result in results: | |
# print(f"URL: {result.url}") | |
# print(f"Title: {result.title}") | |
# print(f"Description: {result.description}") | |
# print("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment