Interact with your Snowflake database using natural language queries
User-friendly application that enables users to interact with their Snowflake DataBase using natural language queries.
Here is the link to the EdoChat
EdoChat leverages OpenAI's GPT model to convert natural language into SQL queries, making it ideal for users who may not have a firm grasp of SQL syntax. And it has a transformative impact on data interaction by expediting and streamlining data-driven decision-making.
Let's take a look at the tech stack on which the chat is built:
Streamlit
: The UI magicSnowflake
: The database powerhouseGPT-3.5 and LangChain
: The language model maestrosSupabase
: The vector database virtuoso
Here's a glance at snowChat's architecture:
- Conversational AI: Harnesses ChatGPT to translate natural language into precise SQL queries.
- Conversational Memory: Retains context for interactive, dynamic responses.
- Snowflake Integration: Offers seamless, real-time data insights straight from your Snowflake database.
- Self-healing SQL: Proactively suggests solutions for SQL errors, streamlining data access.
- Interactive User Interface: Transforms data querying into an engaging conversation, complete with a chat reset option.
To start, follow these steps:
-
Clone this repository: git clone
https://github.com/maciejbrasewicz/edo-chat
-
Install the required packages:
cd edo-chat
pip install -r requirements.txt
-
Get the Data Definition Language (DDL) for all tables from
snowflake.account_usage.tables
. -
Use ChatGPT to convert the DDL to markdown format.
-
Store the schema files for each table in the docs/ folder.
-
Create an account with Supabase, set up a free database, and configure environment variables for the .streamlit folder in secrets.toml (remember to include your Snowflake credentials).
Your final secrets.toml should look like this:
OPENAI_API_KEY= "your openAI API key"
[streamlit]
SUPABASE_URL = "<https://yourapp.supabase.co>"
SUPABASE_SERVICE_KEY = "your Supabase key"
[snowflake]
ACCOUNT = "youraccount"
USER_name = "youruser"
PASSWORD = "yourpassword"
DATABASE = "yourdatabase"
SCHEMA = "yourschema"
WAREHOUSE = "yourwarehouse"
ROLE = "your snowflake role"
-
Run the Supabase scripts found under supabase/scripts.sql in the Supabase SQL editor to activate the pgvector extension, create tables and set up a function.
-
Run python ingest.py to convert your documents into vectors and store them in the Supabase table named 'documents.'
The 'documents' table in Supabase should look like this:
- Run the Streamlit app to start chatting:
streamlit run main.py
- Platform Integration: Connect chat with popular communication platforms like Slack or Discord for seamless interaction.
- Voice Integration: Implement voice recognition and text-to-speech functionality to make the chatbot more interactive and user-friendly.
- Advanced Analytics: Integrate with popular data visualization libraries like Plotly or Matplotlib to generate interactive visualizations based on the user's queries (AutoGPT).
This project uses the following license: MIT License.
You can reach me at [email protected]
.