Spaces:
Running
Running
import tools.webScraper as WS | |
import time | |
import utils as U | |
from dotenv import load_dotenv | |
load_dotenv() | |
def getGoogleSearchResults(query: str): | |
startTime = time.time() | |
if query: | |
results = WS.scrapeGoogleSearch(query) | |
else: | |
results = "" | |
timeTaken = time.time() - startTime | |
displayText = f"Searched Google [{round(timeTaken * 1000)} ms]" | |
U.pprint(displayText) | |
return { | |
"response": results, | |
"display": { | |
"text": displayText, | |
"icon": "icons/google_search.png", | |
} | |
} | |
toolsInfo = { | |
"getGoogleSearchResults": { | |
"func": getGoogleSearchResults, | |
"schema": { | |
"type": "function", | |
"function": { | |
"name": "getGoogleSearchResults", | |
"description": "Search google and return search results for a given query", | |
"parameters": { | |
"type": "object", | |
"properties": { | |
"query": { | |
"type": "string", | |
"description": "Query to search for" | |
} | |
}, | |
"required": ["query"] | |
} | |
} | |
}, | |
}, | |
} | |