The Digital Twin Assistant is a containerized Retrieval-Augmented Generation (RAG) application that lets users interact with a digital representation of a person’s profile.
It processes profile documents, generates embeddings with Ollama, stores them in ChromaDB, retrieves relevant context, and produces answers through LangChain and a local LLM. The application provides a Gradio interface, persistent storage, Prometheus metrics, and a Grafana dashboard/panels, which are created via Terraform commands.
uv for local development and testsDownload or Clone the repository and enter its root directory:
cd digital-twin
Unless otherwise stated, run all Docker, uv, and test commands from the project root, where docker-compose.yaml and pyproject.toml are located.
Create the Docker environment file:
cp .env.docker.example .env.docker
Update its values according to your environment.
The document used for RAG can be stored in the documents folder.
curl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen3-embedding:0.6b
ollama pull qwen3:1.7b
Verify the installed models:
ollama list
Allow containers to access Ollama:
sudo systemctl edit ollama
Add:
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Restart Ollama:
sudo systemctl daemon-reload
sudo systemctl restart ollama
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
| sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
sudo docker compose up --build
Services:
http://127.0.0.1:7860http://127.0.0.1:3000http://127.0.0.1:8000Stop the services:
sudo docker compose down
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
source ~/.bashrc
Install dependencies:
uv sync
Run the tests:
uv run pytest
A valid .env file is required for local execution and testing.
From the Terraform configuration directory:
terraform init
terraform plan
terraform apply
Grafana must be running before applying the Terraform configuration.