tkwong / ChatDB

A web app built with Streamlit that allows you to chat with your databases using a GPT model.

Home Page:https://chat-db.streamlit.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ChatDB Streamlit App

A web app built with Streamlit that allows you to chat with your databases using a GPT model.

Features

  • Chat with your GPT model of choice

  • Ask about anything in your databases, and the bot will answer

    Expand...
  • View the results and the SQL queries that the GPT model generated

    • SQL queries are added below the bot's response

      Expand...
    • Expand the box to see the query and the result the bot received

      Expand...
    • If the model accidentally generates an invalid query or the query fails, the error will be displayed (example: apartments table is not in the database)

      Expand...
    • GPT 3.5 turbo (the default model) is really good at generating complex SQL queries from your questions, so just ask away!

      Expand...
  • Locally backup and restore your conversations and settings (API keys are encrypted before backup)

    Expand...

Demo

Chatdb.Demo.mp4

Getting started

  • Open the Streamlit app in your browser: Streamlit App
  • Go to the βš™οΈ Settings page
  • Provide your OpenAI API key and add some database connnections
  • Go to the πŸ€– Chats page
  • Create a new conversation by specifying the GPT model and selecting the databases you added
  • Start chatting πŸ—£ ↔️ πŸ€–

Compatibility

Currently supported databases:

  • PostgreSQL (using psycopg2)
  • MySQL and MariaDB (using mysqlclient)
  • Oracle (using cx_oracle)
  • Microsoft SQL Server (using pyodbc)

If your database or DB API are not here, feel free to open a feature request. Contributions are also very welcome!

Building

If you want to build and test locally:

  • Clone the repository
  • Install requirements with pip install -r requirements.txt (recommended to use a virtual environment)
  • Launch the app with streamlit run 🏠_Home.py

Acknowledgement

This project is part of an internship I performed at B.E.A.R. TELL.

About

A web app built with Streamlit that allows you to chat with your databases using a GPT model.

https://chat-db.streamlit.app/

License:MIT License


Languages

Language:Python 100.0%