Built to demonstrate the exact capability set in an Applied AI Engineer (RAG & Knowledge Systems) brief: retrieval-augmented generation over unstructured business data (meeting notes, CRM records), metadata-filtered vector search, knowledge-graph relationship mapping, grounded generation with citations, a golden eval harness (faithfulness / grounding / MRR), and a swappable vector backend (SQLite default, pgvector for production).
Two modes, one contract:
- MOCK_MODE=true (default): deterministic hashed embeddings + templated grounded answers. Zero dependencies, no model/GPU, no cloud — runs anywhere.
- MOCK_MODE=false: real
sentence-transformersembeddings + an LLM (OpenAI or Amazon Bedrock Converse API). The retrieval / graph / grounding / eval contracts stay identical — only the adapters change.
pip install -r backend/requirements.txt
cd backend && python -m uvicorn ragpilot.main:app --port 8000
curl -X POST http://localhost:8000/ingest -H 'content-type: application/json' \
-d '{"title":"Q3 investor sync","raw_text":"Acme Capital led the Series B. Northwind Partners co-invested.","source_type":"meeting_note","author":"Carlos"}'
curl -X POST http://localhost:8000/query -H 'content-type: application/json' \
-d '{"question":"Who led the Series B?","entity":"Acme Capital"}'
curl http://localhost:8000/eval/golden # runs the golden eval setexport MOCK_MODE=false
export VECTOR_BACKEND=pgvector
export DATABASE_URL=postgresql://user:pass@host:5432/ragpilot
export EMBED_MODEL=all-MiniLM-L6-v2
# optional LLM providers:
export OPENAI_API_KEY=sk-... # OR
export AWS_REGION=us-east-1 # + BEDROCK_MODEL=anthropic.claude-v2
cd backend && python -m uvicorn ragpilot.main:app --port 8000pgvector requires the vector extension on the DB (auto-created on init()).
Procfileandrailway.tomlare included. SetMOCK_MODE,VECTOR_BACKEND,DATABASE_URLas platform env vars.railway upbuilds the Dockerfile and health-checks/health.- Default
sqlitebackend needs no database — deploys with zero config.
ingest ─▶ chunk ─▶ embed (mock | sentence-transformers) ─▶ store (sqlite | pgvector)
│
query ─▶ embed ─▶ retrieve (vector sim + metadata filter)
│
graph_paths (entity relations)
│
generate (grounded, citations)
│
eval (MRR, grounding rate, faithfulness) + /eval/golden (held-out set)
- RAG pipelines for investor intelligence ..........
retrieval.query - Extract insights from unstructured ...............
ingest(chunk + entity extraction) - Hybrid search / re-ranking .......................
store.retrieve(cosine + metadata) - Hallucination control / grounding ...............
retrievalcitation gate +evalset - Agent / eval frameworks .........................
evalset.run_golden(MRR/faithfulness) - Cloud deploy (Bedrock-class) ...................
adapters._llm_complete(OpenAI/Bedrock)
- MOCK_MODE embeddings are lexical, not semantic — the golden MRR reflects
that ceiling. Real
sentence-transformersembeddings raise retrieval quality substantially (swap is a one-line env change). - Faithfulness is a lexical-overlap proxy; production swaps in an NLI/entailment
scorer. The harness is built so that swap is local to
evalset.faithfulness. - Embeddings + vector search + metadata filter ..
store.retrieve - Knowledge graph / relationship mapping ..........
store.add_edge/graph_paths - Reliable source attribution ....................
Answer.citations - Minimize hallucination ........................
groundedflag + citation requirement - Evaluate retrieval + answer quality ...........
evaluation.EvalMetrics - CRM integration pattern ....................... see sibling repo
leadpilot
- POST /ingest — ingest a document (meeting note / CRM record / report)
- POST /query — RAG query (returns grounded Answer + citations + graph paths)
- GET /graph?entity= — knowledge-graph relations for an entity
- GET /eval — retrieval/answer quality metrics
- POST /reset — clear state
Swap in real adapters (sentence-transformers embedder, pgvector store, LLM client) by implementing the slots in ragpilot/adapters.py — the retrieval, graph, grounding, and eval contracts stay identical.