client / tools /tools.py
Ashhar
first working version
9a7b472
raw
history blame
1.13 kB
import tools.webScraper as WS
import time
from dotenv import load_dotenv
load_dotenv()
def getGoogleSearchResults(query: str):
startTime = time.time()
results = WS.scrapeGoogleSearch(query)
timeTaken = time.time() - startTime
return {
"response": results,
"display": {
"text": f"Searched Google [{round(timeTaken * 1000)} ms]",
"icon": "icons/google_search.png",
}
}
toolsInfo = {
"getGoogleSearchResults": {
"func": getGoogleSearchResults,
"schema": {
"type": "function",
"function": {
"name": "getGoogleSearchResults",
"description": "Get google search results for a given query",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Query to search for"
}
},
"required": ["query"]
}
}
},
},
}