# chandu038/knowledge-rag-assistant architecture

> Architecture diagram of the GitHub repository chandu038/knowledge-rag-assistant, 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/chandu038/knowledge-rag-assistant
- Repository: https://github.com/chandu038/knowledge-rag-assistant

## Overview

Knowledge RAG Assistant is a Streamlit study-notes app: users add typed or uploaded material, ask questions, and receive answers informed by note retrieval or general knowledge. Its main runtime separates the UI, ingestion and note operations, and answer generation; a separate agent script provides iterative web-search tool calls. The README documents the RAG workflow, while source excerpts show the concrete calls and storage/model integrations. The web-search agent is not wired into the Streamlit app, so it is shown as a separate capability.

Main entry points: [`my_first_agent/assistant.py`](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py) (Knowledge Assistant), [`my_first_agent/app.py`](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/app.py) (Streamlit App), [`my_first_agent/req.py`](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/req.py) (Tool Agent Runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Study Interface"]
  node_streamlit["Streamlit App<br/>[app.py]"]
  node_chat["Chat Interaction<br/>[app.py]"]
  node_note_ui["Note Management UI<br/>[app.py]"]
end

subgraph group_notes["Notes and Retrieval"]
  node_note_operations["Note Operations<br/>[assistant.py]"]
  node_file_extract["File Extraction<br/>[assistant.py]"]
  node_chunking["Text Chunking<br/>[assistant.py]"]
  node_retrieval["Note Retrieval<br/>[assistant.py]"]
  node_chroma[("Persistent Note Store")]
end

subgraph group_answers["Answer Generation"]
  node_assistant["Knowledge Assistant<br/>[assistant.py]"]
  node_date_time["Date and Time<br/>[assistant.py]"]
  node_prompting["Context and Prompt<br/>[assistant.py]"]
  node_answer_cleanup["Answer Cleanup<br/>[assistant.py]"]
end

subgraph group_webagent["Web Search Agent"]
  node_agent_runner["Tool Agent Runner<br/>[req.py]"]
  node_tool_dispatch["Tool Dispatch<br/>[req.py]"]
  node_web_search["Web Search Tool<br/>[req.py]"]
end

node_student(("Student"))
node_groq["Groq LLM"]
node_tavily["Tavily Search"]

node_student -->|"uses"| node_streamlit
node_streamlit -->|"renders"| node_chat
node_streamlit -->|"renders"| node_note_ui
node_chat -->|"asks"| node_assistant
node_assistant -->|"checks"| node_date_time
node_assistant -->|"searches"| node_retrieval
node_assistant -->|"builds context"| node_prompting
node_prompting -->|"requests answer"| node_groq
node_assistant -->|"cleans response"| node_answer_cleanup
node_answer_cleanup -->|"returns answer"| node_chat
node_note_ui -->|"adds, lists, deletes"| node_note_operations
node_note_ui -->|"submits file"| node_file_extract
node_file_extract -->|"extracts then chunks"| node_chunking
node_chunking -->|"adds chunks"| node_note_operations
node_note_operations -->|"reads and writes"| node_chroma
node_retrieval -->|"queries"| node_chroma
node_agent_runner -->|"requests tool calls"| node_groq
node_agent_runner -->|"dispatches calls"| node_tool_dispatch
node_tool_dispatch -->|"invokes"| node_web_search
node_web_search -->|"searches web"| node_tavily

click node_streamlit "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/app.py"
click node_chat "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/app.py"
click node_note_ui "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/app.py"
click node_assistant "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py"
click node_date_time "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py"
click node_prompting "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py"
click node_answer_cleanup "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py"
click node_note_operations "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py"
click node_file_extract "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py"
click node_chunking "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py"
click node_retrieval "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py"
click node_agent_runner "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/req.py"
click node_tool_dispatch "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/req.py"
click node_web_search "https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/req.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_streamlit,node_chat,node_note_ui toneBlue
class node_note_operations,node_file_extract,node_chunking,node_retrieval,node_chroma toneAmber
class node_assistant,node_date_time,node_prompting,node_answer_cleanup toneMint
class node_agent_runner,node_tool_dispatch,node_web_search toneRose
class node_student,node_groq,node_tavily toneIndigo
```

## Components

### Study Interface

- [Streamlit App](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/app.py): `my_first_agent/app.py`
- [Chat Interaction](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/app.py): `my_first_agent/app.py`
- [Note Management UI](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/app.py): `my_first_agent/app.py`

### Notes and Retrieval

- [Note Operations](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py): `my_first_agent/assistant.py`
- [File Extraction](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py): `my_first_agent/assistant.py`
- [Text Chunking](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py): `my_first_agent/assistant.py`
- [Note Retrieval](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py): `my_first_agent/assistant.py`
- **Persistent Note Store**

### Answer Generation

- [Knowledge Assistant](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py): `my_first_agent/assistant.py`
- [Date and Time](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py): `my_first_agent/assistant.py`
- [Context and Prompt](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py): `my_first_agent/assistant.py`
- [Answer Cleanup](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/assistant.py): `my_first_agent/assistant.py`

### Web Search Agent

- [Tool Agent Runner](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/req.py): `my_first_agent/req.py`
- [Tool Dispatch](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/req.py): `my_first_agent/req.py`
- [Web Search Tool](https://github.com/chandu038/knowledge-rag-assistant/blob/main/my_first_agent/req.py): `my_first_agent/req.py`

### Other components

- **Student**
- **Groq LLM**
- **Tavily Search**

## Connections

- Student → Streamlit App: uses (evidence: `README.md`)
- Streamlit App → Chat Interaction: renders (evidence: `my_first_agent/app.py`)
- Streamlit App → Note Management UI: renders (evidence: `my_first_agent/app.py`)
- Chat Interaction → Knowledge Assistant: asks (evidence: `my_first_agent/app.py`)
- Knowledge Assistant → Date and Time: checks (evidence: `my_first_agent/assistant.py`)
- Knowledge Assistant → Note Retrieval: searches (evidence: `my_first_agent/assistant.py`)
- Knowledge Assistant → Context and Prompt: builds context (evidence: `my_first_agent/assistant.py`)
- Context and Prompt → Groq LLM: requests answer (evidence: `my_first_agent/assistant.py`)
- Knowledge Assistant → Answer Cleanup: cleans response (evidence: `my_first_agent/assistant.py`)
- Answer Cleanup → Chat Interaction: returns answer (evidence: `my_first_agent/app.py`)
- Note Management UI → Note Operations: adds, lists, deletes (evidence: `my_first_agent/app.py`)
- Note Management UI → File Extraction: submits file (evidence: `my_first_agent/app.py`)
- File Extraction → Text Chunking: extracts then chunks (evidence: `my_first_agent/assistant.py`)
- Text Chunking → Note Operations: adds chunks (evidence: `my_first_agent/assistant.py`)
- Note Operations → Persistent Note Store: reads and writes (evidence: `my_first_agent/assistant.py`)
- Note Retrieval → Persistent Note Store: queries (evidence: `my_first_agent/assistant.py`)
- Tool Agent Runner → Groq LLM: requests tool calls (evidence: `my_first_agent/req.py`)
- Tool Agent Runner → Tool Dispatch: dispatches calls (evidence: `my_first_agent/req.py`)
- Tool Dispatch → Web Search Tool: invokes (evidence: `my_first_agent/req.py`)
- Web Search Tool → Tavily Search: searches web (evidence: `my_first_agent/req.py`)
