Chat with your existing database without using vector DB.
Project description
DBChat
An agentic AI tool designed to seamlessly interact with existing databases using an agentic AI approach. This project aims to simplify the process of querying databases, making it more intuitive and accessible for everyone, regardless of their technical background.
Features
- Uses an Agentic approach to answer to user's question
- Safe from user executing malicious DDL queries.
- Can add Data-safety by only exposing certain tables and columns in the schema.
- Doesn't expect the LLM to generate executable code, rather behaves as an reasoning engine
- reduced hallucinations and more deterministic in nature
- no need for vector DBs
- Supports all relational databases supported by sql alchemy. Refer https://docs.sqlalchemy.org/en/20/dialects/
How to Run?
docker pull dhanilan/dbchat
docker run -p 5173:5173 -p 8000:8000 dhanilan/dbchat
default database to save connections and conversation is mongo at mongodb://localhost:27017/dbchat
if you want to save them at specific mongo database pass it as an env
docker run -p 5173:5173 -p 8000:8000 -e DB_URL=mongodb://host.docker.internal:27017/dbchat dhanilan/dbchat
if you want to run spider dataset from https://yale-lily.github.io/spider
docker run -p 5173:5173 -p 8000:8000 -e DB_URL=mongodb://host.docker.internal:27017/dbchat -e ATTACH_SPIDER_DATASET=1 dhanilan/dbchat
using docker-compose
The docker compose also comes with a chinook database for testing. You can use it by adding a connection to the chinook database in the UI
use postgresql+psycopg2://postgres:postgres@chinook:5143/chinook
as the connection string
update the docker-compose.yml with the required envs if neccessary and run
docker-compose up -d
Architecture
Built with Autogen.
Development
Dev container contains all the necessary deps , mongodb storing the schema and chat history , conversations, settings etc and also a chinook database in postgres for playing around
Installing dependencies
UI
pip install -r requirements.txt
server
cd src/ui && npm i
To run the Application in local
UI
cd src/ui && npm run dev
API
cd src && uvicorn api.main:app
Open the UI
By default opens in http://localhost:5173/
Goto setting to save the OPEN AI API key
connect to dev container chinook db
postgresql+psycopg2://postgres:postgres@localhost:5432/chinook
Roadmap
- clean up some code for now
- Add more tests
- add feature to annotate the schema
- add few shots of the conversation to the schema
- add feature to add custom prompts
- add access control for tables and columns `
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file py_dbchat-0.0.2rc126.post1.tar.gz
.
File metadata
- Download URL: py_dbchat-0.0.2rc126.post1.tar.gz
- Upload date:
- Size: 629.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ede667b6797c953b606eb25e91ca104c0cc70d757f0c2b3a63ecea0f71c306ce |
|
MD5 | ce30abf4c707f55c38f25a314c943aa3 |
|
BLAKE2b-256 | 58bf5a6da4b24928dad261e91d6ee8aa50d651899ca73d87d787ccd270c01e9a |
File details
Details for the file py_dbchat-0.0.2rc126.post1-py3-none-any.whl
.
File metadata
- Download URL: py_dbchat-0.0.2rc126.post1-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0539313dcfba4361fc3fee4c5f9a67ce245007c5ede365fca6b36980febcc31 |
|
MD5 | d39363111ee7e9ccf2b1643bb309a82f |
|
BLAKE2b-256 | a4ccdc1a0e82df9029eecf6a4a77a7cfce0abd1df46cc4fa4845a0d7d1a94796 |