# salamfarukh13-blip/rag-dip-diet architecture

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

- Interactive diagram: https://gitdiagram.com/salamfarukh13-blip/rag-dip-diet
- Repository: https://github.com/salamfarukh13-blip/rag-dip-diet

## Overview

This is a Streamlit nutrition assistant that combines a DIP knowledge-base retrieval workflow with personalized meal guidance. In the chat flow, the dashboard collects a question and profile, retrieves relevant ChromaDB chunks, and calls the dual-LLM agent: IBM Granite analyzes DIP rules and quantities, then Groq formats the response. The dashboard also provides weight-based targets and a visual meal plan. The excerpts do not show the dashboard’s collection-loading implementation, so its retrieval connection to the store is evidenced by the displayed query call; other unsampled details are omitted.

Main entry points: [`agent.py`](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/agent.py) (RAG Orchestrator), [`app.py`](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py) (Streamlit Dashboard), [`ingest.py`](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/ingest.py) (Chunk Ingestion), [`dip_knowledge.txt`](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/dip_knowledge.txt) (DIP Knowledge Base)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_content["DIP Knowledge"]
  node_knowledge["DIP Knowledge Base<br/>[dip_knowledge.txt]"]
end

subgraph group_retrieval["Knowledge Retrieval"]
  node_retrieval_query["Context Retrieval<br/>[app.py]"]
  node_ingestion["Chunk Ingestion<br/>[ingest.py]"]
  node_vector_store[("ChromaDB Store<br/>[ingest.py]")]
end

subgraph group_agent["Answer Agent"]
  node_rag_agent["RAG Orchestrator<br/>[agent.py]"]
  node_targets_prompt["Targets And Prompt<br/>[agent.py]"]
  node_granite["Granite Analysis<br/>[agent.py]"]
  node_groq_format["Groq Formatting<br/>[agent.py]"]
end

subgraph group_dashboard["User Dashboard"]
  node_dashboard_app["Streamlit Dashboard<br/>[app.py]"]
  node_profile["Profile Inputs<br/>[app.py]"]
  node_meal_plan["Visual Meal Plan<br/>[app.py]"]
  node_chat["Chat Experience<br/>[app.py]"]
end

node_user(("User"))
node_watsonx["IBM watsonx.ai"]
node_groq_service["Groq API"]

node_user -->|"uses"| node_dashboard_app
node_dashboard_app -->|"collects"| node_profile
node_dashboard_app -->|"presents"| node_chat
node_dashboard_app -->|"presents"| node_meal_plan
node_profile -->|"supplies weight"| node_meal_plan
node_chat -->|"queries"| node_retrieval_query
node_retrieval_query -->|"searches"| node_vector_store
node_knowledge -->|"loaded from"| node_ingestion
node_ingestion -->|"writes chunks"| node_vector_store
node_chat -->|"invokes"| node_rag_agent
node_profile -->|"provides profile"| node_rag_agent
node_retrieval_query -->|"provides context"| node_rag_agent
node_rag_agent -->|"builds prompt"| node_targets_prompt
node_targets_prompt -->|"analyzes"| node_granite
node_granite -->|"calls"| node_watsonx
node_granite -->|"passes analysis"| node_groq_format
node_groq_format -->|"calls"| node_groq_service
node_rag_agent -->|"returns answer"| node_chat

click node_dashboard_app "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py"
click node_profile "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py"
click node_meal_plan "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py"
click node_chat "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py"
click node_retrieval_query "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py"
click node_knowledge "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/dip_knowledge.txt"
click node_ingestion "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/ingest.py"
click node_vector_store "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/ingest.py"
click node_rag_agent "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/agent.py"
click node_targets_prompt "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/agent.py"
click node_granite "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/agent.py"
click node_groq_format "https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/agent.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_knowledge,node_user toneBlue
class node_retrieval_query,node_ingestion,node_vector_store toneAmber
class node_rag_agent,node_targets_prompt,node_granite,node_groq_format,node_groq_service toneMint
class node_dashboard_app,node_profile,node_meal_plan,node_chat toneRose
class node_watsonx toneIndigo
```

## Components

### DIP Knowledge

- [DIP Knowledge Base](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/dip_knowledge.txt): `dip_knowledge.txt`

### Knowledge Retrieval

- [Context Retrieval](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py): `app.py`
- [Chunk Ingestion](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/ingest.py): `ingest.py`
- [ChromaDB Store](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/ingest.py): `ingest.py`

### Answer Agent

- [RAG Orchestrator](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/agent.py): `agent.py`
- [Targets And Prompt](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/agent.py): `agent.py`
- [Granite Analysis](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/agent.py): `agent.py`
- [Groq Formatting](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/agent.py): `agent.py`

### User Dashboard

- [Streamlit Dashboard](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py): `app.py`
- [Profile Inputs](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py): `app.py`
- [Visual Meal Plan](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py): `app.py`
- [Chat Experience](https://github.com/salamfarukh13-blip/rag-dip-diet/blob/master/app.py): `app.py`

### Other components

- **User**
- **IBM watsonx.ai**
- **Groq API**

## Connections

- User → Streamlit Dashboard: uses (evidence: `README.md`)
- Streamlit Dashboard → Profile Inputs: collects (evidence: `app.py`)
- Streamlit Dashboard → Chat Experience: presents (evidence: `app.py`)
- Streamlit Dashboard → Visual Meal Plan: presents (evidence: `app.py`)
- Profile Inputs → Visual Meal Plan: supplies weight (evidence: `app.py`)
- Chat Experience → Context Retrieval: queries (evidence: `app.py`)
- Context Retrieval → ChromaDB Store: searches (evidence: `app.py`)
- DIP Knowledge Base → Chunk Ingestion: loaded from (evidence: `ingest.py`)
- Chunk Ingestion → ChromaDB Store: writes chunks (evidence: `ingest.py`)
- Chat Experience → RAG Orchestrator: invokes (evidence: `app.py`)
- Profile Inputs → RAG Orchestrator: provides profile (evidence: `app.py`)
- Context Retrieval → RAG Orchestrator: provides context (evidence: `app.py`)
- RAG Orchestrator → Targets And Prompt: builds prompt (evidence: `agent.py`)
- Targets And Prompt → Granite Analysis: analyzes (evidence: `agent.py`)
- Granite Analysis → IBM watsonx.ai: calls (evidence: `agent.py`)
- Granite Analysis → Groq Formatting: passes analysis (evidence: `agent.py`)
- Groq Formatting → Groq API: calls (evidence: `agent.py`)
- RAG Orchestrator → Chat Experience: returns answer (evidence: `app.py`)
