Skip to main content

Chat with your existing database without using vector DB.

Project description

DBChat

An agentic AI application for chatting with existing databases

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://localhost: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://localhost: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.

alt text

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

  • Complete image as docker and run ui and backend
  • fix bug of connections
  • Test for mysql , pg and sqllite etc
  • put a nice readme with how it works
  • clean up some code for now

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

py_dbchat-0.0.2rc121.post1.tar.gz (629.5 kB view details)

Uploaded Source

Built Distribution

py_dbchat-0.0.2rc121.post1-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file py_dbchat-0.0.2rc121.post1.tar.gz.

File metadata

  • Download URL: py_dbchat-0.0.2rc121.post1.tar.gz
  • Upload date:
  • Size: 629.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.2

File hashes

Hashes for py_dbchat-0.0.2rc121.post1.tar.gz
Algorithm Hash digest
SHA256 a483f7b8a27f534e4328afdb419bdae0f599afe88733b0c22a6881773cbe4525
MD5 e9e826fb67af9c111e962d20f38f0f02
BLAKE2b-256 cfe97d2e0ce28132d0be74a4c71af9ebb1afbdb600ef3983de8af119c3762f5b

See more details on using hashes here.

Provenance

File details

Details for the file py_dbchat-0.0.2rc121.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for py_dbchat-0.0.2rc121.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 3628081b8484f645c50e6b782fc41a9dddc53b3db439bf0c5db4b18ccb2a451a
MD5 46f3f3f870fdeba0bfc8e1bf8cbd6230
BLAKE2b-256 7a060bbe8017bee9cdbf35a3617ce6288ab6050672a0088ca496da71138b2776

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page