Example
Ragas — implementation sample

A real, runnable mini-project. Download it and run with Docker.

June 28, 2026

Ragas — implementation sample

A tiny Ragas sample: it scores a RAG answer for faithfulness and response relevancy, judged by an OpenAI model + embeddings.

Configure

cd samples/ragas_1
cp .env.sample .env
# edit .env: set OPENAI_API_KEY (judge LLM + embeddings)

Run with Docker

cd samples/ragas_1
docker build -t aas-ragas .
docker run --rm --env-file .env aas-ragas

Run with Docker (in a devcontainer with DooD)

The foreground docker run may print nothing under Docker-outside-of-Docker — run detached and follow the logs:

docker logs -f "$(docker run -d --env-file .env aas-ragas)"

Run locally

cd samples/ragas_1
pip install -r requirements.txt
python app.py

Example run

Scores use an LLM judge, so they vary slightly run to run. One run with gpt-4o-mini:

{'faithfulness': 1.0000, 'answer_relevancy': 0.9701}

Files

.env.sample
# Copy to `.env` and add your OpenAI API key (judge LLM + embeddings).
#   cp .env.sample .env
OPENAI_API_KEY=

MODEL=gpt-4o-mini