# pranavkumarpk01/generative-ai architecture

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

- Interactive diagram: https://gitdiagram.com/pranavkumarpk01/generative-ai
- Repository: https://github.com/pranavkumarpk01/generative-ai

## Overview

The repository contains several independent demos rather than one integrated application: a PDF-backed HR-policy RAG workflow, a GitHub CRUD tutorial, and a FastAPI user service. The RAG path ingests and indexes document chunks, then embeds questions, retrieves context, and generates answers. Other documented-in-source GitHub capabilities include issue and pull-request operations. Edges follow the shown callers; unsampled modules and undocumented wiring are not inferred.

Main entry points: [`Rag/ingestion.py`](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/ingestion.py) (Ingestion workflow), [`Rag/query.py`](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/query.py) (Question workflow), [`Github api demo/demo.py`](https://github.com/pranavkumarpk01/generative-ai/blob/main/Github%20api%20demo/demo.py) (CRUD demo runner), [`Github api demo/github_api_client.py`](https://github.com/pranavkumarpk01/generative-ai/blob/main/Github%20api%20demo/github_api_client.py) (GitHub API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rag["HR Policy RAG"]
  node_policy_pdf["Policy PDF"]
  node_ingestion["Ingestion workflow<br/>[ingestion.py]"]
  node_pdf_loader["PDF loader<br/>[loader.py]"]
  node_text_cleanup["Text preprocessing<br/>[preprocessing.py]"]
  node_chunking["Text chunking<br/>[chunking.py]"]
  node_embedding["Embedding generation<br/>[embedding.py]"]
  node_index_writer["Vector indexing<br/>[vectorstore.py]"]
  node_question_flow["Question workflow<br/>[query.py]"]
  node_query_embedding["Query embedding<br/>[query.py]"]
  node_answer_generation["Context answer<br/>[query.py]"]
end

subgraph group_github["GitHub API Demo"]
  node_demo_runner["CRUD demo runner<br/>[demo.py]"]
  node_github_config["GitHub settings<br/>[config.py]"]
  node_github_client["GitHub API client"]
end

subgraph group_users["User API"]
  node_user_routes["User endpoints<br/>[main.py]"]
end

node_operator(("CLI user"))
node_ollama["Ollama service"]
node_qdrant[("Qdrant vector store")]
node_github_user(("CLI user"))
node_github_service["GitHub service"]
node_api_user(("API caller"))
node_mongo[("MongoDB users")]

node_operator -->|"starts ingestion"| node_ingestion
node_policy_pdf -->|"PDF input"| node_pdf_loader
node_ingestion -->|"loads PDF"| node_pdf_loader
node_ingestion -->|"cleans text"| node_text_cleanup
node_ingestion -->|"splits text"| node_chunking
node_ingestion -->|"embeds chunks"| node_embedding
node_ingestion -->|"indexes chunks"| node_index_writer
node_embedding -->|"requests embeddings"| node_ollama
node_index_writer -->|"writes vectors"| node_qdrant
node_operator -->|"asks question"| node_question_flow
node_question_flow -->|"embeds question"| node_query_embedding
node_query_embedding -->|"requests embedding"| node_ollama
node_question_flow -->|"searches vectors"| node_qdrant
node_question_flow -->|"passes context"| node_answer_generation
node_answer_generation -->|"generates answer"| node_ollama
node_github_user -->|"runs demo"| node_demo_runner
node_demo_runner -->|"uses samples"| node_github_config
node_demo_runner -->|"invokes operations"| node_github_client
node_github_client -->|"loads settings"| node_github_config
node_github_client -->|"sends API requests"| node_github_service
node_api_user -->|"calls endpoints"| node_user_routes
node_user_routes -->|"reads and writes"| node_mongo

click node_policy_pdf "https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/hr_policy_detailed_5_pages.pdf"
click node_ingestion "https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/ingestion.py"
click node_pdf_loader "https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/utils/loader.py"
click node_text_cleanup "https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/utils/preprocessing.py"
click node_chunking "https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/utils/chunking.py"
click node_embedding "https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/utils/embedding.py"
click node_index_writer "https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/utils/vectorstore.py"
click node_question_flow "https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/query.py"
click node_query_embedding "https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/query.py"
click node_answer_generation "https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/query.py"
click node_demo_runner "https://github.com/pranavkumarpk01/generative-ai/blob/main/Github%20api%20demo/demo.py"
click node_github_config "https://github.com/pranavkumarpk01/generative-ai/blob/main/Github%20api%20demo/config.py"
click node_github_client "https://github.com/pranavkumarpk01/generative-ai/blob/main/Github%20api%20demo/github_api_client.py"
click node_user_routes "https://github.com/pranavkumarpk01/generative-ai/blob/main/api/main.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_policy_pdf,node_ingestion,node_pdf_loader,node_text_cleanup,node_chunking,node_embedding,node_index_writer,node_question_flow,node_query_embedding,node_answer_generation,node_operator,node_github_user toneBlue
class node_demo_runner,node_github_config,node_github_client,node_qdrant,node_mongo toneAmber
class node_user_routes,node_api_user toneMint
class node_ollama,node_github_service toneIndigo
```

## Components

### HR Policy RAG

- [Policy PDF](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/hr_policy_detailed_5_pages.pdf): `Rag/hr_policy_detailed_5_pages.pdf`
- [Ingestion workflow](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/ingestion.py): `Rag/ingestion.py`
- [PDF loader](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/utils/loader.py): `Rag/utils/loader.py`
- [Text preprocessing](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/utils/preprocessing.py): `Rag/utils/preprocessing.py`
- [Text chunking](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/utils/chunking.py): `Rag/utils/chunking.py`
- [Embedding generation](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/utils/embedding.py): `Rag/utils/embedding.py`
- [Vector indexing](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/utils/vectorstore.py): `Rag/utils/vectorstore.py`
- [Question workflow](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/query.py): `Rag/query.py`
- [Query embedding](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/query.py): `Rag/query.py`
- [Context answer](https://github.com/pranavkumarpk01/generative-ai/blob/main/Rag/query.py): `Rag/query.py`

### GitHub API Demo

- [CRUD demo runner](https://github.com/pranavkumarpk01/generative-ai/blob/main/Github%20api%20demo/demo.py): `Github api demo/demo.py`
- [GitHub settings](https://github.com/pranavkumarpk01/generative-ai/blob/main/Github%20api%20demo/config.py): `Github api demo/config.py`
- [GitHub API client](https://github.com/pranavkumarpk01/generative-ai/blob/main/Github%20api%20demo/github_api_client.py): `Github api demo/github_api_client.py`

### User API

- [User endpoints](https://github.com/pranavkumarpk01/generative-ai/blob/main/api/main.py): `api/main.py`

### Other components

- **CLI user**
- **Ollama service**
- **Qdrant vector store**
- **CLI user**
- **GitHub service**
- **API caller**
- **MongoDB users**

## Connections

- CLI user → Ingestion workflow: starts ingestion (evidence: `Rag/ingestion.py`)
- Policy PDF → PDF loader: PDF input
- Ingestion workflow → PDF loader: loads PDF (evidence: `Rag/ingestion.py`)
- Ingestion workflow → Text preprocessing: cleans text (evidence: `Rag/ingestion.py`)
- Ingestion workflow → Text chunking: splits text (evidence: `Rag/ingestion.py`)
- Ingestion workflow → Embedding generation: embeds chunks (evidence: `Rag/ingestion.py`)
- Ingestion workflow → Vector indexing: indexes chunks (evidence: `Rag/ingestion.py`)
- Embedding generation → Ollama service: requests embeddings (evidence: `Rag/utils/embedding.py`)
- Vector indexing → Qdrant vector store: writes vectors (evidence: `Rag/utils/vectorstore.py`)
- CLI user → Question workflow: asks question (evidence: `Rag/query.py`)
- Question workflow → Query embedding: embeds question (evidence: `Rag/query.py`)
- Query embedding → Ollama service: requests embedding (evidence: `Rag/query.py`)
- Question workflow → Qdrant vector store: searches vectors (evidence: `Rag/query.py`)
- Question workflow → Context answer: passes context (evidence: `Rag/query.py`)
- Context answer → Ollama service: generates answer (evidence: `Rag/query.py`)
- CLI user → CRUD demo runner: runs demo (evidence: `Github api demo/demo.py`)
- CRUD demo runner → GitHub settings: uses samples (evidence: `Github api demo/demo.py`)
- CRUD demo runner → GitHub API client: invokes operations (evidence: `Github api demo/demo.py`)
- GitHub API client → GitHub settings: loads settings (evidence: `Github api demo/github_api_client.py`)
- GitHub API client → GitHub service: sends API requests (evidence: `Github api demo/github_api_client.py`)
- API caller → User endpoints: calls endpoints (evidence: `api/main.py`)
- User endpoints → MongoDB users: reads and writes (evidence: `api/main.py`)
