# karthik-333/ai-interview-simulation architecture

> Architecture diagram of the GitHub repository karthik-333/ai-interview-simulation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/karthik-333/ai-interview-simulation
- Repository: https://github.com/karthik-333/ai-interview-simulation

## Overview

AI Interview Simulation is a FastAPI backend that accepts resume PDFs, indexes their content for retrieval, and answers interview questions using resume context and a local LLM. The main workflows run through the API and services: resume upload proceeds through PDF extraction, chunking, embedding, and vector storage; question answering proceeds through embedding, semantic retrieval, prompt construction, and generation. Interview sessions are also persisted through SQLAlchemy. The graph reflects the README and shown source references; unsampled implementations and runtime details are not inferred.

Main entry points: [`backend/app/rag/pipeline.py`](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/pipeline.py) (RAG Pipeline), [`backend/app/services/interview_service.py`](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/services/interview_service.py) (Interview Service), [`backend/app/api/interviews.py`](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/api/interviews.py) (Interview API), [`backend/app/main.py`](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/main.py) (FastAPI App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and Services"]
  node_app["FastAPI App<br/>[main.py]"]
  node_resume_api["Resume API<br/>[resume.py]"]
  node_interview_api["Interview API<br/>[interviews.py]"]
  node_schemas["Interview Schemas<br/>[interview.py]"]
  node_resume_service["Resume Service<br/>[resume_service.py]"]
  node_interview_service["Interview Service"]
end

subgraph group_resume["Resume Ingestion"]
  node_pdf["PDF Extraction<br/>[pdf_loader.py]"]
  node_chunker["Text Chunking<br/>[chunker.py]"]
  node_embedding["Embeddings<br/>[embedding.py]"]
  node_vector[("Resume Vector Store<br/>[vector_store.py]")]
end

subgraph group_answer["Question Answering"]
  node_pipeline["RAG Pipeline<br/>[pipeline.py]"]
  node_prompt["Prompt Builder<br/>[prompt_builder.py]"]
  node_llm["Answer Generation<br/>[llm.py]"]
end

subgraph group_persistence["Data and Configuration"]
  node_settings["Runtime Settings<br/>[settings.py]"]
  node_session_service["Database Session<br/>[database.py]"]
  node_interview_model["Interview Model<br/>[interview.py]"]
end

node_candidate(("Candidate"))
node_ollama["Ollama LLM"]
node_postgres[("PostgreSQL")]

node_candidate -->|"sends requests"| node_app
node_app -->|"registers router"| node_resume_api
node_app -->|"registers router"| node_interview_api
node_candidate -->|"uploads PDF"| node_resume_api
node_resume_api -->|"calls"| node_resume_service
node_resume_service -->|"ingests file"| node_pdf
node_pdf -->|"extracts text for"| node_chunker
node_chunker -->|"embeds chunks"| node_embedding
node_embedding -->|"stores vectors via"| node_vector
node_candidate -->|"asks question"| node_interview_api
node_interview_api -->|"validates with"| node_schemas
node_interview_api -->|"calls"| node_interview_service
node_interview_service -->|"runs"| node_pipeline
node_pipeline -->|"embeds query"| node_embedding
node_pipeline -->|"searches chunks"| node_vector
node_pipeline -->|"builds prompt"| node_prompt
node_pipeline -->|"requests answer"| node_llm
node_llm -->|"calls model"| node_ollama
node_interview_service -->|"opens session"| node_session_service
node_interview_service -->|"creates record"| node_interview_model
node_session_service -->|"connects to"| node_postgres
node_llm -->|"reads model setting"| node_settings
node_vector -->|"reads store path"| node_settings

click node_app "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/main.py"
click node_resume_api "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/api/resume.py"
click node_interview_api "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/api/interviews.py"
click node_schemas "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/schemas/interview.py"
click node_resume_service "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/services/resume_service.py"
click node_interview_service "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/services/interview_service.py"
click node_pdf "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/pdf_loader.py"
click node_chunker "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/chunker.py"
click node_embedding "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/embedding.py"
click node_vector "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/vector_store.py"
click node_pipeline "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/pipeline.py"
click node_prompt "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/prompt_builder.py"
click node_llm "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/llm.py"
click node_settings "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/core/settings.py"
click node_session_service "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/core/database.py"
click node_interview_model "https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/models/interview.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_app,node_resume_api,node_interview_api,node_schemas,node_resume_service,node_interview_service toneBlue
class node_pdf,node_chunker,node_embedding,node_vector,node_postgres toneAmber
class node_pipeline,node_prompt,node_llm toneMint
class node_settings,node_session_service,node_interview_model toneRose
class node_candidate,node_ollama toneIndigo
```

## Components

### API and Services

- [FastAPI App](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/main.py): `backend/app/main.py`
- [Resume API](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/api/resume.py): `backend/app/api/resume.py`
- [Interview API](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/api/interviews.py): `backend/app/api/interviews.py`
- [Interview Schemas](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/schemas/interview.py): `backend/app/schemas/interview.py`
- [Resume Service](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/services/resume_service.py): `backend/app/services/resume_service.py`
- [Interview Service](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/services/interview_service.py): `backend/app/services/interview_service.py`

### Resume Ingestion

- [PDF Extraction](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/pdf_loader.py): `backend/app/rag/pdf_loader.py`
- [Text Chunking](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/chunker.py): `backend/app/rag/chunker.py`
- [Embeddings](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/embedding.py): `backend/app/rag/embedding.py`
- [Resume Vector Store](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/vector_store.py): `backend/app/rag/vector_store.py`

### Question Answering

- [RAG Pipeline](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/pipeline.py): `backend/app/rag/pipeline.py`
- [Prompt Builder](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/prompt_builder.py): `backend/app/rag/prompt_builder.py`
- [Answer Generation](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/rag/llm.py): `backend/app/rag/llm.py`

### Data and Configuration

- [Runtime Settings](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/core/settings.py): `backend/app/core/settings.py`
- [Database Session](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Interview Model](https://github.com/karthik-333/ai-interview-simulation/blob/main/backend/app/models/interview.py): `backend/app/models/interview.py`

### Other components

- **Candidate**
- **Ollama LLM**
- **PostgreSQL**

## Connections

- Candidate → FastAPI App: sends requests (evidence: `README.md`)
- FastAPI App → Resume API: registers router (evidence: `backend/app/main.py`)
- FastAPI App → Interview API: registers router (evidence: `backend/app/main.py`)
- Candidate → Resume API: uploads PDF (evidence: `README.md`)
- Resume API → Resume Service: calls (evidence: `backend/app/api/resume.py`)
- Resume Service → PDF Extraction: ingests file (evidence: `backend/app/services/resume_service.py`)
- PDF Extraction → Text Chunking: extracts text for (evidence: `backend/app/rag/ingest_resume.py`)
- Text Chunking → Embeddings: embeds chunks (evidence: `backend/app/rag/ingest_resume.py`)
- Embeddings → Resume Vector Store: stores vectors via (evidence: `backend/app/rag/ingest_resume.py`)
- Candidate → Interview API: asks question (evidence: `backend/app/api/interviews.py`)
- Interview API → Interview Schemas: validates with (evidence: `backend/app/api/interviews.py`)
- Interview API → Interview Service: calls (evidence: `backend/app/api/interviews.py`)
- Interview Service → RAG Pipeline: runs (evidence: `backend/app/services/interview_service.py`)
- RAG Pipeline → Embeddings: embeds query (evidence: `backend/app/rag/pipeline.py`)
- RAG Pipeline → Resume Vector Store: searches chunks (evidence: `backend/app/rag/pipeline.py`)
- RAG Pipeline → Prompt Builder: builds prompt (evidence: `backend/app/rag/pipeline.py`)
- RAG Pipeline → Answer Generation: requests answer (evidence: `backend/app/rag/pipeline.py`)
- Answer Generation → Ollama LLM: calls model (evidence: `backend/app/rag/llm.py`)
- Interview Service → Database Session: opens session (evidence: `backend/app/services/interview_service.py`)
- Interview Service → Interview Model: creates record (evidence: `backend/app/services/interview_service.py`)
- Database Session → PostgreSQL: connects to (evidence: `backend/app/core/database.py`)
- Answer Generation → Runtime Settings: reads model setting (evidence: `backend/app/rag/llm.py`)
- Resume Vector Store → Runtime Settings: reads store path (evidence: `backend/app/rag/vector_store.py`)
