# tuanduy35399/holland-career-rag-ml-api architecture

> Architecture diagram of the GitHub repository tuanduy35399/holland-career-rag-ml-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tuanduy35399/holland-career-rag-ml-api
- Repository: https://github.com/tuanduy35399/holland-career-rag-ml-api

## Overview

Holland Career GraphRAG is a FastAPI backend with two user-facing capabilities: predicting major groups from subject scores and Holland type, and advising on a specific major through conversational RAG. The chat flow routes a question through query rewriting, hypothetical-document generation, vector and graph retrieval, result fusion and reranking, then generates a sourced answer. A separate indexing workflow prepares major data for graph and vector search. The README documents Neo4j and an NVIDIA API key; sampled code also configures a local LLM endpoint. Some indexing and integration details are supported only by the index or README.

Main entry points: [`graphRAG/indexing/build_index.py`](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/build_index.py) (Index Builder), [`graphRAG/retrieval/retrieve.py`](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/retrieve.py) (Retriever), [`graphRAG/api/main.py`](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/api/main.py) (FastAPI API), [`graphRAG/llm/answer_generator.py`](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/llm/answer_generator.py) (Answer Generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and Prediction"]
  node_api["FastAPI API<br/>[main.py]"]
  node_predict["Major Predictor<br/>[main.py]"]
end

subgraph group_indexing["Knowledge Indexing"]
  node_build["Index Builder<br/>[build_index.py]"]
  node_loader["Major Loader<br/>[load_majors.py]"]
  node_cleaner["Text Cleaning<br/>[clean_text.py]"]
  node_normalizer["Text Normalizing<br/>[normalize.py]"]
  node_metadata["Metadata Extraction<br/>[extractor.py]"]
  node_embedding["BGE Embeddings<br/>[bge_m3.py]"]
  node_graphbuilder["Graph Builder<br/>[graph_builder.py]"]
  node_graphstore[("Neo4j Store<br/>[graph_store.py]")]
  node_vectorstore[("Chroma Store<br/>[chroma.py]")]
end

subgraph group_retrieval["RAG Retrieval"]
  node_retriever["Retriever<br/>[retrieve.py]"]
  node_rewrite["Query Rewrite<br/>[query_rewrite.py]"]
  node_hyde["HyDE Query<br/>[hyde.py]"]
  node_vectorsearch["Vector Search<br/>[vector_search.py]"]
  node_graphsearch["Graph Search<br/>[graph_search.py]"]
  node_hybrid["Hybrid Fusion<br/>[hybrid_search.py]"]
  node_reranker["Result Reranker<br/>[bge_reranker.py]"]
end

subgraph group_generation["Answer Generation"]
  node_answer["Answer Generator"]
  node_prompts["Prompt Templates<br/>[prompts.py]"]
  node_llm["Custom LLM<br/>[custom.py]"]
end

node_user(("User"))
node_neo4j[("Neo4j Database")]
node_localmodel["Local LLM Endpoint"]

node_user -->|"submits request"| node_api
node_api -->|"routes prediction"| node_predict
node_api -->|"requests retrieval"| node_retriever
node_api -->|"generates answer"| node_answer
node_build -->|"loads majors"| node_loader
node_build -->|"cleans text"| node_cleaner
node_build -->|"normalizes text"| node_normalizer
node_build -->|"extracts metadata"| node_metadata
node_build -->|"configures embeddings"| node_embedding
node_build -->|"builds graph"| node_graphbuilder
node_build -->|"creates vector index"| node_vectorstore
node_graphbuilder -->|"writes graph"| node_graphstore
node_graphstore -.->|"connects to"| node_neo4j
node_retriever -->|"rewrites query"| node_rewrite
node_retriever -->|"generates query"| node_hyde
node_retriever -->|"searches vectors"| node_vectorsearch
node_retriever -->|"searches graph"| node_graphsearch
node_retriever -->|"fuses results"| node_hybrid
node_retriever -->|"reranks results"| node_reranker
node_rewrite -->|"uses template"| node_prompts
node_hyde -->|"uses template"| node_prompts
node_vectorsearch -.->|"searches index"| node_vectorstore
node_graphsearch -.->|"searches index"| node_graphstore
node_answer -->|"builds prompt"| node_prompts
node_answer -->|"calls completion"| node_llm
node_api -->|"configures provider"| node_llm
node_llm -->|"calls endpoint"| node_localmodel

click node_api "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/api/main.py"
click node_predict "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/api/main.py"
click node_build "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/build_index.py"
click node_loader "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/ingestion/loader/load_majors.py"
click node_cleaner "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/ingestion/processes/clean_text.py"
click node_normalizer "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/ingestion/processes/normalize.py"
click node_metadata "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/metadata/extractor.py"
click node_embedding "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/embedding/bge_m3.py"
click node_graphbuilder "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/graph/graph_builder.py"
click node_graphstore "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/graph/graph_store.py"
click node_vectorstore "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/vector/chroma.py"
click node_retriever "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/retrieve.py"
click node_rewrite "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/rewrite/query_rewrite.py"
click node_hyde "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/rewrite/hyde.py"
click node_vectorsearch "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/search/vector_search.py"
click node_graphsearch "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/search/graph_search.py"
click node_hybrid "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/search/hybrid_search.py"
click node_reranker "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/reranker/bge_reranker.py"
click node_answer "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/llm/answer_generator.py"
click node_prompts "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/llm/prompts.py"
click node_llm "https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/llm/custom.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_predict,node_user toneBlue
class node_build,node_loader,node_cleaner,node_normalizer,node_metadata,node_embedding,node_graphbuilder,node_graphstore,node_vectorstore,node_neo4j toneAmber
class node_retriever,node_rewrite,node_hyde,node_vectorsearch,node_graphsearch,node_hybrid,node_reranker toneMint
class node_answer,node_prompts,node_llm toneRose
class node_localmodel toneIndigo
```

## Components

### API and Prediction

- [FastAPI API](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/api/main.py): `graphRAG/api/main.py`
- [Major Predictor](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/api/main.py): `graphRAG/api/main.py`

### Knowledge Indexing

- [Index Builder](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/build_index.py): `graphRAG/indexing/build_index.py`
- [Major Loader](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/ingestion/loader/load_majors.py): `graphRAG/ingestion/loader/load_majors.py`
- [Text Cleaning](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/ingestion/processes/clean_text.py): `graphRAG/ingestion/processes/clean_text.py`
- [Text Normalizing](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/ingestion/processes/normalize.py): `graphRAG/ingestion/processes/normalize.py`
- [Metadata Extraction](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/metadata/extractor.py): `graphRAG/indexing/metadata/extractor.py`
- [BGE Embeddings](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/embedding/bge_m3.py): `graphRAG/indexing/embedding/bge_m3.py`
- [Graph Builder](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/graph/graph_builder.py): `graphRAG/indexing/graph/graph_builder.py`
- [Neo4j Store](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/graph/graph_store.py): `graphRAG/indexing/graph/graph_store.py`
- [Chroma Store](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/indexing/vector/chroma.py): `graphRAG/indexing/vector/chroma.py`

### RAG Retrieval

- [Retriever](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/retrieve.py): `graphRAG/retrieval/retrieve.py`
- [Query Rewrite](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/rewrite/query_rewrite.py): `graphRAG/retrieval/rewrite/query_rewrite.py`
- [HyDE Query](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/rewrite/hyde.py): `graphRAG/retrieval/rewrite/hyde.py`
- [Vector Search](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/search/vector_search.py): `graphRAG/retrieval/search/vector_search.py`
- [Graph Search](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/search/graph_search.py): `graphRAG/retrieval/search/graph_search.py`
- [Hybrid Fusion](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/search/hybrid_search.py): `graphRAG/retrieval/search/hybrid_search.py`
- [Result Reranker](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/retrieval/reranker/bge_reranker.py): `graphRAG/retrieval/reranker/bge_reranker.py`

### Answer Generation

- [Answer Generator](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/llm/answer_generator.py): `graphRAG/llm/answer_generator.py`
- [Prompt Templates](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/llm/prompts.py): `graphRAG/llm/prompts.py`
- [Custom LLM](https://github.com/tuanduy35399/holland-career-rag-ml-api/blob/main/graphRAG/llm/custom.py): `graphRAG/llm/custom.py`

### Other components

- **User**
- **Neo4j Database**
- **Local LLM Endpoint**

## Connections

- User → FastAPI API: submits request (evidence: `README.md`)
- FastAPI API → Major Predictor: routes prediction (evidence: `graphRAG/api/main.py`)
- FastAPI API → Retriever: requests retrieval (evidence: `graphRAG/api/main.py`)
- FastAPI API → Answer Generator: generates answer (evidence: `graphRAG/api/main.py`)
- Index Builder → Major Loader: loads majors (evidence: `graphRAG/indexing/build_index.py`)
- Index Builder → Text Cleaning: cleans text (evidence: `graphRAG/indexing/build_index.py`)
- Index Builder → Text Normalizing: normalizes text (evidence: `graphRAG/indexing/build_index.py`)
- Index Builder → Metadata Extraction: extracts metadata (evidence: `graphRAG/indexing/build_index.py`)
- Index Builder → BGE Embeddings: configures embeddings (evidence: `graphRAG/indexing/build_index.py`)
- Index Builder → Graph Builder: builds graph (evidence: `graphRAG/indexing/build_index.py`)
- Index Builder → Chroma Store: creates vector index (evidence: `graphRAG/indexing/build_index.py`)
- Graph Builder → Neo4j Store: writes graph (evidence: `graphRAG/indexing/build_index.py`)
- Neo4j Store → Neo4j Database: connects to (evidence: `README.md`)
- Retriever → Query Rewrite: rewrites query (evidence: `graphRAG/retrieval/retrieve.py`)
- Retriever → HyDE Query: generates query (evidence: `graphRAG/retrieval/retrieve.py`)
- Retriever → Vector Search: searches vectors (evidence: `graphRAG/retrieval/retrieve.py`)
- Retriever → Graph Search: searches graph (evidence: `graphRAG/retrieval/retrieve.py`)
- Retriever → Hybrid Fusion: fuses results (evidence: `graphRAG/retrieval/retrieve.py`)
- Retriever → Result Reranker: reranks results (evidence: `graphRAG/retrieval/retrieve.py`)
- Query Rewrite → Prompt Templates: uses template (evidence: `graphRAG/retrieval/rewrite/query_rewrite.py`)
- HyDE Query → Prompt Templates: uses template (evidence: `graphRAG/llm/prompts.py`)
- Vector Search → Chroma Store: searches index
- Graph Search → Neo4j Store: searches index
- Answer Generator → Prompt Templates: builds prompt (evidence: `graphRAG/llm/answer_generator.py`)
- Answer Generator → Custom LLM: calls completion (evidence: `graphRAG/llm/answer_generator.py`)
- FastAPI API → Custom LLM: configures provider (evidence: `graphRAG/api/main.py`)
- Custom LLM → Local LLM Endpoint: calls endpoint (evidence: `graphRAG/llm/custom.py`)
