Build a small retrieval service with cited results
In this article (3 sections)
Start with an owned corpus and a simple lexical baseline. A citation must resolve to the version and passage that supports the answer.
Run a local baseline
The integration lab ranks two fixture documents.
from integration_cases import retrieval_service_case
result = retrieval_service_case()
assert result["ranked_ids"][0] == "D1"
assert result["citation_resolves"] is True
assert result["answer"]["citations"][0]["doc"] == "D1"
assert result["model_or_vector_service"] is FalseInventory sources, permissions, versions and deletion. Chunk with document/page/section metadata, implement keyword ranking and define an API response with result ID, snippet, score and source URL/version. Filter authorization before ranking.
Evaluate recall@k on labelled questions, including unanswerable and stale cases. Add embeddings or reranking only against the same set and label actual execution. A generated answer must map atomic claims to retrieved evidence and abstain when support is missing.
The FDE for Freshers course uses this as a bridge into its production RAG artifact.
Exercise
Index ten local Markdown files, label fifteen queries and implement cited retrieval plus deletion. Report baseline recall before adding another method.
Continue learning
This article is part of the FDE integration and deployment foundations sequence. Use the neighbouring tasks when you need the prerequisite or the next application.
- Review the prerequisite or neighbouring task in Handle expired credentials without exposing them in errors.
- Continue with Connect an agent to a read-only internal tool.
Reference: NIST AI RMF Generative AI Profile.
Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.
This article is part of our FDE for Freshers programme — 6–7 months. Build your engineering foundations, then take AI from discovery to delivery.
Explore FDE for Freshers