# kalyanm45/question-answering-system-using-rag architecture

> Architecture diagram of the GitHub repository kalyanm45/question-answering-system-using-rag, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kalyanm45/question-answering-system-using-rag
- Repository: https://github.com/kalyanm45/question-answering-system-using-rag

## Overview

This is a Streamlit document-question-answering app. A user first ingests PDFs from `Artifacts`, which are loaded, split, embedded, and indexed in a session-local FAISS store; the user can then submit questions, which a retrieval chain answers using retrieved context, a prompt, and Groq chat completion. The graph reflects the single sampled runtime file: its functions are responsibilities within one module, not separately verified services. The README documents the product’s RAG capabilities; implementation edges below are supported by `app.py`, while external provider calls are represented at the integration boundary.

Main entry points: [`app.py`](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py) (Retrieval chain), [`Artifacts/Articles.pdf`](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/Artifacts/Articles.pdf) (PDF documents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_ui["Streamlit interface<br/>[app.py]"]
  node_answer["Answer display<br/>[app.py]"]
end

subgraph group_indexing["Document indexing"]
  node_pdfs["PDF documents<br/>[Articles.pdf]"]
  node_loader["PDF loader<br/>[app.py]"]
  node_splitter["Text splitter<br/>[app.py]"]
  node_embedder["Google embeddings<br/>[app.py]"]
  node_faiss[("FAISS vector store<br/>[app.py]")]
end

subgraph group_answering["Question answering"]
  node_retriever["Vector retriever<br/>[app.py]"]
  node_retrieval["Retrieval chain<br/>[app.py]"]
  node_docchain["Document chain<br/>[app.py]"]
  node_prompt["Context prompt<br/>[app.py]"]
  node_llm["Groq chat model<br/>[app.py]"]
end

node_user(("User"))
node_google{{"Google Generative AI"}}
node_groq{{"Groq API"}}

node_user -->|"asks or ingests"| node_ui
node_ui -->|"starts ingestion"| node_loader
node_pdfs -->|"loads PDFs"| node_loader
node_loader -->|"splits documents"| node_splitter
node_splitter -->|"indexes chunks"| node_faiss
node_embedder -.->|"requests embeddings"| node_google
node_faiss -->|"embeds documents"| node_embedder
node_ui -->|"invokes query"| node_retrieval
node_retrieval -->|"retrieves context"| node_retriever
node_retriever -->|"searches vectors"| node_faiss
node_retrieval -->|"passes context"| node_docchain
node_docchain -->|"formats context"| node_prompt
node_docchain -->|"calls model"| node_llm
node_llm -.->|"requests completion"| node_groq
node_retrieval -->|"returns answer"| node_answer
node_answer -->|"displays response"| node_user

click node_ui "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py"
click node_pdfs "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/Artifacts/Articles.pdf"
click node_loader "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py"
click node_splitter "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py"
click node_embedder "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py"
click node_faiss "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py"
click node_retriever "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py"
click node_retrieval "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py"
click node_docchain "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py"
click node_prompt "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py"
click node_llm "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py"
click node_answer "https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.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_ui,node_answer,node_user toneBlue
class node_pdfs,node_loader,node_splitter,node_embedder,node_faiss toneAmber
class node_retriever,node_retrieval,node_docchain,node_prompt,node_llm,node_groq toneMint
class node_google toneIndigo
```

## Components

### User interface

- [Streamlit interface](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`
- [Answer display](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`

### Document indexing

- [PDF documents](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/Artifacts/Articles.pdf): `Artifacts/Articles.pdf`
- [PDF loader](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`
- [Text splitter](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`
- [Google embeddings](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`
- [FAISS vector store](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`

### Question answering

- [Vector retriever](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`
- [Retrieval chain](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`
- [Document chain](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`
- [Context prompt](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`
- [Groq chat model](https://github.com/kalyanm45/question-answering-system-using-rag/blob/main/app.py): `app.py`

### Other components

- **User**
- **Google Generative AI**
- **Groq API**

## Connections

- User → Streamlit interface: asks or ingests (evidence: `README.md`)
- Streamlit interface → PDF loader: starts ingestion (evidence: `app.py`)
- PDF documents → PDF loader: loads PDFs (evidence: `app.py`)
- PDF loader → Text splitter: splits documents (evidence: `app.py`)
- Text splitter → FAISS vector store: indexes chunks (evidence: `app.py`)
- Google embeddings → Google Generative AI: requests embeddings
- FAISS vector store → Google embeddings: embeds documents (evidence: `app.py`)
- Streamlit interface → Retrieval chain: invokes query (evidence: `app.py`)
- Retrieval chain → Vector retriever: retrieves context (evidence: `app.py`)
- Vector retriever → FAISS vector store: searches vectors (evidence: `app.py`)
- Retrieval chain → Document chain: passes context (evidence: `app.py`)
- Document chain → Context prompt: formats context (evidence: `app.py`)
- Document chain → Groq chat model: calls model (evidence: `app.py`)
- Groq chat model → Groq API: requests completion
- Retrieval chain → Answer display: returns answer (evidence: `app.py`)
- Answer display → User: displays response (evidence: `app.py`)
