Spaces:
Sleeping
Sleeping
File size: 1,266 Bytes
9a7b472 19598a5 9a7b472 1a5d173 9a7b472 19598a5 9a7b472 19598a5 9a7b472 1a5d173 9a7b472 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
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"]
}
}
},
},
}
|