# debarun1234/nestle-hr-ai-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/debarun1234/nestle-hr-ai-assistant
- Repository: https://github.com/debarun1234/nestle-hr-ai-assistant

## Overview

1. **Repository shape**
   - This is a **notebook-first prototype**, not a packaged web service or multi-service application.
   - The main executable artifact is **`ags_nestle_genai.ipynb`**, which likely contains the full assistant pipeline end to end.

2. **Primary business input**
   - The assistant is grounded in a single source document: **`nestle_hr_policy.pdf`**.
   - That PDF is the knowledge base the assistant is intended to answer from, so it is the main domain-data boundary in the system.

3. **Core AI runtime**
   - The model layer uses **Hugging Face Transformers** with **Meta LLaMA 3.1 8B**.
   - The README shows direct loading of the tokenizer/model and moving the model to **CUDA GPU**, so inference is designed for **local GPU-backed execution** rather than a hosted model API.

4. **Assistant orchestration**
   - The notebook likely performs the orchestration steps needed to turn policy text into answers:
     - load/read the policy document
     - prepare context or prompts
     - send user questions to the LLM
     - return a grounded response
   - The notebook is the place where document handling and inference are wired together.

5. **User interaction layer**
   - The UI is built with **Gradio**, which provides a lightweight conversational interface.
   - In architecture terms, Gradio is the presentation boundary: it receives the user’s HR question and displays the model’s answer.

6. **Request/response flow**
   - The runtime flow is essentially:
     - **User question** in Gradio
     - passed into the notebook’s assistant logic
     - **policy document context** is applied
     - **LLaMA 3.1** generates a response
     - answer is shown back in Gradio
   - No separate backend, queue, or database is indicated.

7. **Document and knowledge boundaries**
   - The repo contains only a small set of artifacts, so knowledge appears to be **static and file-based**.
   - There is no sign of an indexing service, vector store, or external HR system in the repository tree provided, so the main dependency is the PDF itself.

8. **Execution environment**
   - The project is intended to run in a **Python environment** created from `requirements.txt`.
   - The README explicitly calls out a virtual environment and `huggingface-cli login`, so the setup depends on authenticated Hugging Face access.

9. **Infrastructure dependencies**
   - The architecture assumes access to:
     - **Hugging Face model weights**
     - a machine with **sufficient GPU memory**
   - This means the system is compute-heavy and not positioned as a thin client.

10. **Supporting artifacts**
   - **`Nestle_HR_Assistant_Code_debarun.docx`** appears to be documentation of the implementation, not a runtime component.
   - The screenshot file is also non-runtime.
   - These are useful for understanding or demonstrating the solution, but they do not affect the runtime architecture.

11. **What is not present**
   - There is no evidence of:
     - a persistent database
     - a separate API server
     - background workers
     - authentication/authorization logic for end users
     - deployment infrastructure
   - So the architecture is best drawn as a **single-machine notebook app with local model inference and a Gradio front end**.

12. **Best diagram framing**
   - The cleanest architecture diagram would show three main blocks:
     - **Policy document source** (`nestle_hr_policy.pdf`)
     - **Notebook/assistant logic** (`ags_nestle_genai.ipynb`)
     - **Gradio UI + Hugging Face LLaMA 3.1 inference**
   - With external dependencies for **Hugging Face authentication/model download** and **GPU execution**.

Main entry points: [`ags_nestle_genai.ipynb`](https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/ags_nestle_genai.ipynb) (Assistant notebook), [`README.md`](https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/README.md) (README), [`nestle_hr_policy.pdf`](https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/nestle_hr_policy.pdf) (HR policy), [`requirements.txt`](https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/requirements.txt) (Python env)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_app["Assistant app"]
  node_n_notebook["Assistant notebook<br/>orchestration notebook"]
  node_n_ui["Gradio UI<br/>chat interface"]
  node_n_llm(("LLaMA 3.1<br/>local HF model"))
end

subgraph group_grp_data["Knowledge source"]
  node_n_policy["HR policy<br/>source document"]
end

subgraph group_grp_support["Support files"]
  node_n_hf{{"Hugging Face<br/>model supply"}}
  node_n_gpu["CUDA GPU<br/>runtime hardware"]
  node_n_requirements["Python env<br/>dependency setup<br/>[requirements.txt]"]
  node_n_readme["README<br/>usage guide<br/>[README.md]"]
end

node_n_policy -->|"provides context"| node_n_notebook
node_n_notebook -->|"serves answers"| node_n_ui
node_n_ui -->|"submits question"| node_n_notebook
node_n_notebook -->|"calls inference"| node_n_llm
node_n_llm -->|"runs on"| node_n_gpu
node_n_hf -->|"downloads weights"| node_n_llm
node_n_requirements -->|"sets runtime"| node_n_notebook
node_n_readme -->|"documents setup"| node_n_notebook
node_n_readme -->|"notes login"| node_n_hf

click node_n_notebook "https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/ags_nestle_genai.ipynb"
click node_n_policy "https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/nestle_hr_policy.pdf"
click node_n_requirements "https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/requirements.txt"
click node_n_readme "https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/README.md"

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_n_notebook,node_n_ui,node_n_llm toneBlue
class node_n_policy toneAmber
class node_n_hf,node_n_gpu,node_n_requirements,node_n_readme toneMint
```

## Components

### Assistant app

Notebook-driven assistant orchestration and UI.

- [Assistant notebook](https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/ags_nestle_genai.ipynb): orchestration notebook · Main executable artifact that loads the policy, builds prompts, and coordinates inference. · `ags_nestle_genai.ipynb`
- **Gradio UI**: chat interface · Lightweight conversational front end for entering HR questions and showing answers.
- **LLaMA 3.1**: local HF model · Meta LLaMA 3.1 8B loaded through Hugging Face Transformers for local GPU inference.

### Knowledge source

Static policy document used as the grounded input.

- [HR policy](https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/nestle_hr_policy.pdf): source document · Primary knowledge base used to ground responses. · `nestle_hr_policy.pdf`

### Support files

Documentation and packaging artifacts around the prototype.

- **Hugging Face**: model supply · External model and tokenizer source, authenticated via huggingface-cli login.
- **CUDA GPU**: runtime hardware · Local accelerator required for model loading and generation.
- [Python env](https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/requirements.txt): dependency setup · Requirements-defined Python environment used to run the notebook. · `requirements.txt`
- [README](https://github.com/debarun1234/nestle-hr-ai-assistant/blob/main/README.md): usage guide · Setup and execution instructions for the prototype. · `README.md`

## Connections

- HR policy → Assistant notebook: provides context · The notebook reads the policy document as the grounding source.
- Assistant notebook → Gradio UI: serves answers · Notebook logic powers the conversational interface.
- Gradio UI → Assistant notebook: submits question · User prompts enter through the Gradio front end.
- Assistant notebook → LLaMA 3.1: calls inference · The assistant logic sends prompts to the local LLM runtime.
- LLaMA 3.1 → CUDA GPU: runs on · Model inference is executed on CUDA hardware.
- Hugging Face → LLaMA 3.1: downloads weights · Model and tokenizer are obtained from Hugging Face.
- Python env → Assistant notebook: sets runtime · Python dependencies define the execution environment.
- README → Assistant notebook: documents setup · README explains how to launch the notebook-based assistant.
- README → Hugging Face: notes login · Setup depends on authenticated Hugging Face access.
