This project is an implementation of question answering sql rag in InfluxDB and langgraph.
- Docker installed.
- An account in Langsmith.
- llama3.2
- llama3-groq-tool-use
- OLLAMA
Currently, the project supports the following memory savers and switching them in .env
file:
- MemorySaver
- PostgresSaver
- Clone the repository.
- Copy the
.env.example
to.env
and update the values as per your environment. Some value would be available after up and running the docker containers. - Up the docker containers
docker-compose up -d --build
InfluxDB
- Run
docker-compose exec -it influxdb3 bash
- Create the token:
influxdb3 create token --admin
- Set
INFLUXDB3_AUTH_TOKEN
:export INFLUXDB3_AUTH_TOKEN=admin_token
- Create the database:
influxdb3 create database sensors
- Write into the database:
influxdb3 write --database sensors --file /home/data/air-sensor-data.lp
influxdb3 write --database sensors --file /home/data/sensor-meta-data.lp
- Verify:
influxdb3 query --database=sensors "SHOW TABLES"
- Delete if needed:
influxdb3 delete table --database sensors air_sensors
influxdb3 delete table --database sensors sensor_meta
Update the .env
file with the token and database name.
Ollama
- Run
docker-compose exec -it ollama bash
- Install models:
ollama pull llama3.2
ollama pull llama3-groq-tool-use
- Start the server:
ollama serve
Langgraph Studio
- Run
docker-compose exec -it langgraph bash
- Run
langgraph dev --host 0.0.0.0 --port 2024
- Studio UI. On failure, browse to
Langgraph Platform > Langgraph Studio
. - Langsmith UI.
CLI
- Run
docker-compose exec -it langgraph bash
- Run
python rag.py
- To end the chat type
exit
orquit
.
Frontend UI
- Adjust
views/.env
- Go to:
http://localhost:8501/
or replacelocalhost
with the IP address of the machine.
It is recommended to perform unit test before commiting the code. To run unit test, run the following command
pytest
This repo uses pre-commit
hooks to check type and linting before committing the code.
Install:
pip install pre-commit
Enable:
pre-commit install
This project is licensed under the MIT License - see the LICENSE file for details.