| from tavily import TavilyClient | |
| from os import getenv | |
| from dotenv import load_dotenv | |
| import mysql.connector | |
| load_dotenv() | |
| conn = mysql.connector.connect( | |
| host=getenv('MYSQL_HOST'), | |
| user=getenv('MYSQL_USER'), | |
| password=getenv('MYSQL_PASSWORD'), | |
| database=getenv('MYSQL_DATABASE') | |
| ) | |
| load_dotenv() | |
| tavily_client = TavilyClient(api_key=getenv('TAVILY_API')) | |
| def searchTool(question:str) -> dict: | |
| response = tavily_client.search(question) | |
| return response | |
| def sqlQuery(query:str): | |
| cursor = conn.cursor() | |
| cursor.execute(query) | |
| result = cursor.fetchall() | |
| return result | |
| if __name__ == "__main__": | |
| print(searchTool("How to create a new branch in git?")) | |