Leveraging LLMs and analytics mechanisms to provide natural language queries, CAP simplifies Cardano data analysis through real-time insights and intuitive, customizable dashboards.
Before running CAP, ensure you have the following installed on your system:
- Python 3.11+
- Docker & Docker Compose
- Virtualenv (for local setup)
- Git
- Install Homebrew (if not installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install dependencies:
brew install [email protected] docker docker-compose
- Start Docker (if not already running):
open -a Docker
- Update system and install dependencies:
sudo apt update && sudo apt upgrade -y sudo apt install python3.11 python3.11-venv python3-pip docker.io docker-compose -y
- Start Docker service:
sudo systemctl start docker sudo systemctl enable docker
DISCLAIMER: While CAP may work on WSL2, it is not officially supported. Some features, especially those relying on networking and Docker, may require additional configuration or may not work as expected. Use at your own discretion.
- Enable WSL2 and Install Ubuntu:
- Follow Microsoft’s guide: https://learn.microsoft.com/en-us/windows/wsl/install
- Install dependencies in WSL:
sudo apt update && sudo apt upgrade -y sudo apt install python3.11 python3.11-venv python3-pip docker.io docker-compose -y
- Start Docker within WSL:
sudo systemctl start docker
-
Copy environment file:
cp .env.example .env
Set
VIRTUOSO_HOST=localhost
and define your password (use the same password in thedocker run
command below). -
Run supporting services:
# Run Jaeger for tracing docker run -d --name jaeger \ -p 4317:4317 \ -p 4318:4318 \ -p 16686:16686 \ jaegertracing/all-in-one:latest # Run Virtuoso for triplestore docker run -d --name virtuoso \ --platform linux/amd64 \ -p 8890:8890 -p 1111:1111 \ -e DBA_PASSWORD=mysecretpassword \ -e SPARQL_UPDATE=true \ tenforce/virtuoso
-
Set up Python environment:
python3.11 -m venv venv source venv/bin/activate pip install --upgrade pip pip install --no-cache-dir -e ".[dev]"
-
Run CAP server:
uvicorn src.cap.main:app --host 0.0.0.0 --port 8000
Now, you can access CAP's API at: http://localhost:8000/docs
With CAP and its dependencies running, you can also run its tests
# activate virtual environment
source venv/bin/activate
# Run all tests
pytest
# Run specific test file
pytest src/tests/test_api.py
# Run specifit test function
pytest -s src/tests/test_integration.py::test_full_graph_lifecycle
# Run with coverage report
pytest --cov=src/cap
-
Copy the environment file:
cp .env.example .env
Set
VIRTUOSO_HOST=virtuoso
in the.env
file.Note: If you're not using an ARM64 system (e.g., Mac M1/M2/M3), remove
platform: linux/amd64
lines fromdocker-compose.yml
. -
Build and start services:
docker compose up -d
Wait a couple of minutes until the services are up. Check them on:
- Jaeger UI → http://localhost:16686
- Virtuoso → http://localhost:8890
- CAP API → http://localhost:8000/docs
-
View logs:
# View all service logs docker compose logs -f # View specific service logs docker compose logs -f api
-
Stop services:
docker compose down
-
Stop services and remove volumes:
docker compose down -v
-
Run tests inside Docker:
docker compose exec api pytest
Once running, access API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- GitHub: https://github.com/mobr-ai/cap/documentation/ontology
- Live Website: https://mobr.ai/cardano
Distributed tracing is enabled with Jaeger. You can monitor traces and debug performance at:
- Jaeger UI: http://localhost:16686