Analitiq is a cutting-edge application designed to revolutionize the way businesses interact with their data. By leveraging the power of natural language processing, Analitiq allows users to input queries through a simple chat interface and effortlessly generates SQL queries compatible with PostgreSQL, Redshift, and other SQLAlchemy-supported databases. This user-friendly interface demystifies data analysis, making it accessible to a wider range of professionals, regardless of their technical expertise.
- Installing Requirements
- Setting Up
- Running Analitiq
- Limitations
- Dependencies
- Contributing
- License
- Support
Ensure you have Docker, Git, and Python (>= 3.9) installed. Use the following commands to install Git and Docker:
sudo yum update -y
sudo yum install git -y
sudo yum install docker -y
sudo service docker start
Clone the repository and build the Docker image:
git clone {REPO URL}
Store your DB connection credentials and AI API key in .streamlit/secrets.toml
.
openai_api_key = "your-openai-api-key"
[db_credentials]
host = "your-db-host"
port = your-db-port
username = "your-username"
password = "your-password"
database = "your-database"
schema = "your-schema"
Providing information about your table structure in context/sample_db.txt
enhances query understanding and accuracy of the responses.
The context are store in a ChromaDB database.
If you would like to use external ChromaDB, set up the environmental variables for the external host and port.
CHROMA_DB_HOST = os.environ.get("CHROMA_DB_HOST")
CHROMA_DB_PORT = os.environ.get("CHROMA_DB_PORT")
After the repo is cloned, navigate to the directory of the docker file and launch the docker container.
sudo docker build -t dockerfile .
Once the pre-requisites have been installed and docker container is running you can access the app on port 80 of your browser by navigating to http://localhost:8501
Navigate to the cloned repository directory and run:
pip install -r requirements.txt
streamlit run app/core.py
If you don't get the desired results try to be precise about the tables and columns that contain the requested data in your prompt.
- AWS Redshift is the only supported database at the moment.
- The app scans tables inside your public schema. Other schemas are ignored.
- Asking questions that require table joins might not always work. The app will try to figure out the joins, but it might not always be successful. In such cases you can help the app by providing context about your tables.
You need an OpenAI API key to use this app. You can get one here Based on the llama-index project. Uses Streamlit for the UI.
This project is licensed under the MIT License.