How vitellaro-matteo/cdm-rag works
cdm-rag is a FastAPI question-answering service over the CDM banking schema. Its principal workflow routes a question to exact graph-based lookups, vector retrieval, or both, then generates a context-grounded answer; a separate entity endpoint returns resolved schema details without an LLM. The graph is built from schema documents after resolving inheritance and relationships, and also supplies retrieval chunks for the vector index. The README documents these major stages; some runtime wiring is described there but not present in the sampled implementation excerpts.
Main entry points: api.py FastAPI endpoints · router.py Question router · graph.py Entity graph · store.py Chroma index
Components 13
HTTP API
- FastAPI endpoints
cdm_rag/api.py
Schema Modeling
- CDM corpus
corpus_subset - Inheritance resolver
cdm_rag/inheritance.py - Relationship parser
cdm_rag/relationships.py - Entity graph
cdm_rag/graph.py
Context Retrieval
- Retrieval chunks
cdm_rag/chunks.py - Text embeddings
cdm_rag/embeddings.py - Chroma index
cdm_rag/store.py
Answer Generation
- Question router
cdm_rag/router.py - Grounded generation
cdm_rag/generate.py - LLM client
cdm_rag/llm_client.py
Other components
- Questioner
- Groq service
Connections 19
- Questioner → FastAPI endpoints: asks via
- CDM corpus → Inheritance resolver: provides schema
- CDM corpus → Relationship parser: provides schema
- Inheritance resolver → Entity graph: resolves attributes
- Relationship parser → Entity graph: supplies edges
- Entity graph → Retrieval chunks: builds chunks
- Retrieval chunks → Chroma index: indexes text
- Retrieval chunks → Text embeddings: supplies text
- Text embeddings → Chroma index: writes vectors
- FastAPI endpoints → Entity graph: entity lookup
- FastAPI endpoints → Question router: routes question
- FastAPI endpoints → Chroma index: loads index
- Question router → Entity graph: looks up structure
- Question router → Chroma index: searches chunks
- Question router → Text embeddings: embeds query
- Question router → Grounded generation: passes context
- Grounded generation → LLM client: requests answer
- LLM client → Groq service: calls provider
- FastAPI endpoints → Questioner: returns result