/db2chat

Blog post: https://50daysml.blogspot.com/2024/04/day-112-db2chat-talk-with-your-sqlite3.html

Primary LanguagePython

This is db2chat - chat with your (SQLite) database

Hosted webapp: https://db2chat.streamlit.app/

You will need a free Groq or a paid OpenAI API key to execute queries.

There are 3 default databases loaded in the webapp:

How to use

  1. Input your Groq/OpenAI API key and select a model (mistral-8x7b, gpt-4, llama3-8b, gemma-7b-it)
image
  1. Load your sqlite3 db file (optional)
image
  1. Select a database to chat with (default is chinook) + click 'Connect'
image

You can view your db's schema:

image
  1. Enter a query, run and get your chart
image

You can see the executed SQL query by hovering the (?)

image

Why SQLite?

I wanted the app to be less dependant on outside/hosted services. With sqlite3's file databases (size is small as well), the concept of talking with a database can be easily demonstrated

Known limitations

  • The model might generate special characters when calling variables/tables. For troubleshooting, the returned error includes the problematic SQL query
  • Using general-purpose off-the-shelf models