P3, P4 · RAG systems: graph-backed financial RAG and a re-ranked retrieval API

Two retrieval systems: a production financial-intelligence platform combining a temporal knowledge graph with vector search, and a medical decision-support API using a vector index plus re-ranking.

L4 · Applied AI engineer≈ 5 min read
Key points · the two-minute version
  1. P3: temporal knowledge graph + Qdrant + ColBERT, with entities validated against the graph and RAGAS/DeepEval gates. Subcontract work, so claim only your parts.
  2. P4: chat-model NER → Pinecone (30) → Cohere Rerank (5), with fixed 502s and 503s naming missing settings.
  3. Describe systems precisely (e.g. Atlas Search was a separate lexical endpoint, not fused).
  4. Use a graph when relationships and time are the question.
You should be able to
  • Explain when a knowledge graph complements vector search
  • Describe a retrieve-then-re-rank API with clean failure semantics
  • Present subcontract work without overclaiming

P3 · Financial intelligence RAG (production, subcontract)

  • Problem: financial questions are temporal and multi-hop; plain vector search can't order events or walk relationships.
  • Stack: Graphiti + FalkorDB temporal knowledge graph (replacing the deprecated Zep Community Edition) · Qdrant dense retrieval · ColBERT re-ranking · six Pydantic entity types (Company, FinancialEvent, AnalystRating, FinancialMetric, MacroEvent, Sector) with validation cross-checked against the graph · Langfuse tracing · RAGAS + DeepEval regression suites.
  • Role: subcontractor. [fill] the components personally built. Never name the end client.
  • Why a graph: document-to-structured-data products often use graph stores for relationships; the same reason applies here.
  • Follow-ups: Q6 ColBERT · Q7 evaluation · Q10 hallucination · story S1.

What to learn from it: retrieval and generation fail differently; measure them separately, and use a graph when relationships and time are the question.

P4 · FastKwan: TCM retrieval API (Pinecone + Cohere Rerank)

  • What: a FastAPI service for Traditional Chinese Medicine decision support. POST /syndrome: a chat model extracts symptoms (NER) → Pinecone finds 30 candidate syndromes → Cohere Rerank to top 5. POST /prescription: same symptoms in a prescriptions namespace (50 candidates) → rerank. POST /lifestyle: MongoDB Atlas Search autocomplete on the disease name.
  • Precision note: Atlas Search serves a separate lexical endpoint; it isn't fused with Pinecone results. Describe it accurately.
  • Reliability details worth quoting: upstream failures return 502 with a fixed message (details only in server logs); a missing setting returns 503 naming the missing variables; /health always open; query 1–4,000 characters; nothing required just to start the server.
  • Numbers (repository): 68 tests, 100% line coverage. First commit Jul 2023. [confirm] client or own.
  • Use when they say "Pinecone" or "reranking". → Q4, Q6

What to learn from it: a simple retrieve-then-re-rank design with clean failure semantics is often all a product needs.

How to talk about these in an interview

  • Lead with the problem shape, not the tools: "temporal, multi-hop questions" (P3) or "symptom text to a short, ranked candidate list" (P4).
  • Name the decision: graph for relationships over time; re-ranking from 30 to 5 for precision.
  • Name how quality was checked: regression suites (RAGAS, DeepEval) for P3; tests and fixed failure semantics for P4.
  • Scope your role on subcontract work, and never name the end client.

Check yourself

How do you present subcontract work honestly?

State the role (subcontractor), name only the components you personally built, describe the system's architecture without the end client's name, and separate your measured results from the team's.

What comes next

13.5 Agents and guardrails.

Build it to remember

Two hands-on projects that exercise this lesson. Pick one, build it end to end, and keep it in your portfolio.

Project 1

Temporal finance Q&A

Ingest company news into a temporal graph plus vectors, and answer "what changed between dates" questions with an eval suite.

  • Graphiti
  • FalkorDB or Neo4j
  • Qdrant
  • ColBERT via RAGatouille
  • Langfuse

Practises The P3 architecture at small scale.

Project 2

Symptom-to-condition retrieval API

Extract entities, retrieve 30 candidates, re-rank to 5, and return clean failure semantics, with 100% line coverage.

  • FastAPI
  • Pinecone or pgvector
  • a re-rank API
  • MongoDB Atlas Search

Practises The P4 pattern with reliability details.

Can you answer every check-yourself question out loud without opening the answer?