File size: 582 Bytes
8578816
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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,
# )