Skip to content

Commit bf167d0

Browse files
author
Conrad CJ Wilson
committed
feat: ragpilot — RAG & knowledge-systems reference (vector+metadata retrieval, knowledge graph, grounded gen, eval harness)
0 parents  commit bf167d0

25 files changed

Lines changed: 668 additions & 0 deletions

.dockerignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.git
2+
.github
3+
__pycache__
4+
*.pyc
5+
*.pyo
6+
.pytest_cache
7+
.coverage
8+
htmlcov
9+
.venv
10+
venv
11+
.env
12+
.env.*
13+
*.db
14+
*.sqlite
15+
data/

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MOCK_MODE=true
2+
EMBEDDING_DIM=384
3+
LLM_MODEL=meta-llama/llama-3.2-3b

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.11"
20+
- run: pip install ruff
21+
- run: ruff check backend/app
22+
23+
test:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.11"
30+
- run: pip install -r backend/requirements.txt pytest
31+
- run: cd backend && python -m pytest tests -q
32+
33+
docs-check:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- run: test -f README.md && echo "README present"

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"""ragpilot — RAG & Knowledge-Systems reference implementation.
2+
3+
Built to demonstrate the exact capability set in an Applied AI Engineer (RAG &
4+
Knowledge Systems) brief: retrieval-augmented generation over unstructured
5+
business data (meeting notes, CRM records), metadata-filtered vector search,
6+
knowledge-graph relationship mapping, grounded generation with citations, and an
7+
evaluation harness for retrieval/answer quality + hallucination control.
8+
9+
Runs headless in MOCK_MODE (deterministic hashed embeddings, no model/GPU).
10+
Swap real adapters (sentence-transformers embedder, pgvector store, LLM client)
11+
into the marked slots — the retrieval, graph, grounding, and eval contracts
12+
stay identical.
13+
14+
## Run
15+
```bash
16+
docker build -f backend/Dockerfile -t ragpilot:latest .
17+
docker run --rm -p 8000:8000 ragpilot:latest
18+
curl -X POST http://localhost:8000/ingest -H 'content-type: application/json' \
19+
-d '{"title":"Q3 investor sync","raw_text":"Acme Capital led the Series B. Northwind Partners co-invested. Jane Doe represents Acme Capital.","source_type":"meeting_note","author":"Carlos"}'
20+
curl -X POST http://localhost:8000/query -H 'content-type: application/json' \
21+
-d '{"question":"Who led the Series B?","entity":"Acme Capital"}'
22+
curl http://localhost:8000/eval
23+
```
24+
25+
## Architecture
26+
```
27+
ingest ─▶ chunk ─▶ embed ─▶ store (chunks+embeddings)
28+
29+
query ─▶ embed ─▶ retrieve (vector sim + metadata filter)
30+
31+
graph_paths (entity relations)
32+
33+
generate (grounded, citations)
34+
35+
eval (MRR, grounding rate, citations)
36+
```
37+
38+
## Maps to the JD
39+
- RAG pipelines for investor intelligence .......... `retrieval.query`
40+
- Extract insights from unstructured ............... `ingest` (chunk + entity extraction)
41+
- Embeddings + vector search + metadata filter .. `store.retrieve`
42+
- Knowledge graph / relationship mapping .......... `store.add_edge` / `graph_paths`
43+
- Reliable source attribution .................... `Answer.citations`
44+
- Minimize hallucination ........................ `grounded` flag + citation requirement
45+
- Evaluate retrieval + answer quality ........... `evaluation.EvalMetrics`
46+
- CRM integration pattern ....................... see sibling repo `leadpilot`
47+
48+
## Endpoints
49+
- POST /ingest — ingest a document (meeting note / CRM record / report)
50+
- POST /query — RAG query (returns grounded Answer + citations + graph paths)
51+
- GET /graph?entity= — knowledge-graph relations for an entity
52+
- GET /eval — retrieval/answer quality metrics
53+
- POST /reset — clear state
54+
"""

backend/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM python:3.11-slim
2+
3+
ENV PYTHONDONTWRITEBYTECODE=1
4+
ENV PYTHONUNBUFFERED=1
5+
ENV PYTHONPATH=/app/backend
6+
7+
WORKDIR /app/backend
8+
9+
COPY backend/requirements.txt ./
10+
RUN pip install --no-cache-dir -r requirements.txt
11+
12+
COPY backend/ragpilot ./ragpilot
13+
14+
EXPOSE 8000
15+
16+
CMD ["uvicorn", "ragpilot.main:app", "--host", "0.0.0.0", "--port", "8000"]
2.95 KB
Binary file not shown.
1.14 KB
Binary file not shown.
3.54 KB
Binary file not shown.
3.18 KB
Binary file not shown.
3.06 KB
Binary file not shown.

0 commit comments

Comments
 (0)