Skip to content

Instantly share code, notes, and snippets.

@k-nowicki
Created October 14, 2024 14:32
Show Gist options
  • Save k-nowicki/38e83865e32a4dad1f0affb917ad3149 to your computer and use it in GitHub Desktop.
Save k-nowicki/38e83865e32a4dad1f0affb917ad3149 to your computer and use it in GitHub Desktop.
AutogenStudion Skill for google search
# 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