| # from llama_index.core.tools import QueryEngineTool | |
| # from sqlalchemy import create_engine | |
| # username = "test" | |
| # password = "test" | |
| # host = "localhost" | |
| # port = "5432" | |
| # mydatabase = "database" | |
| # # Initialize your query engine (replace query_engine with your actual query engine) | |
| # pg_uri = f"postgresql+psycopg2://{username}:{password}@{host}:{port}/{mydatabase}" | |
| # engine = create_engine(pg_uri) | |
| # # Create a tool configuration | |
| # sql_tool = QueryEngineTool.from_defaults( | |
| # engine, | |
| # name="SQLTool", | |
| # description="Searching from DB", | |
| # return_direct=True, | |
| # ) |