# sumeetsingh501/enterprise_knowledge_assistant architecture

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

- Interactive diagram: https://gitdiagram.com/sumeetsingh501/enterprise_knowledge_assistant
- Repository: https://github.com/sumeetsingh501/enterprise_knowledge_assistant

## Overview

This is a Streamlit employee knowledge assistant: users build a local document index, ask policy questions, and receive grounded answers with citations and inspectable retrieved context. The README documents ingestion and retrieval stages not present in the supplied file tree; those components are represented with README-listed paths where available, but their implementation and some wiring could not be verified. The runtime entry point and session-memory use are visible in app.py.

Main entry points: [`app.py`](https://github.com/sumeetsingh501/enterprise_knowledge_assistant/blob/main/app.py) (Streamlit application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app["Streamlit application<br/>[app.py]"]
  node_config["Configuration"]
  node_sources_context["Sources and context view<br/>[app.py]"]
end

subgraph group_ingestion["Document ingestion"]
  node_local_docs["Company documents"]
  node_loader["Document loaders"]
  node_chunking["Chunking and ingestion"]
  node_embeddings["OpenAI embeddings"]
  node_faiss[("FAISS index")]
end

subgraph group_retrieval["Retrieval and ranking"]
  node_vector_search["Vector search"]
  node_bm25["BM25 search"]
  node_rrf["Hybrid fusion"]
  node_reranker["Semantic reranking"]
end

subgraph group_answering["Conversation and answers"]
  node_rewrite["Query rewriting"]
  node_memory["Session memory"]
  node_qa["Answer orchestration"]
  node_llm["Grounded LLM"]
end

node_employee(("Employee"))
node_openai["OpenAI API"]

node_employee -->|"asks questions"| node_app
node_app -->|"validates settings"| node_config
node_app -->|"builds index"| node_chunking
node_app -->|"asks query"| node_qa
node_app -->|"reads history"| node_memory
node_qa -->|"rewrites with history"| node_memory
node_local_docs -->|"loads files"| node_loader
node_loader -->|"provides documents"| node_chunking
node_chunking -->|"embeds chunks"| node_embeddings
node_embeddings -->|"requests embeddings"| node_openai
node_chunking -->|"stores vectors"| node_faiss
node_rewrite -->|"searches query"| node_vector_search
node_vector_search -->|"searches index"| node_faiss
node_rewrite -->|"searches query"| node_bm25
node_vector_search -->|"fuses results"| node_rrf
node_bm25 -->|"fuses results"| node_rrf
node_rrf -->|"ranks candidates"| node_reranker
node_qa -->|"rewrites query"| node_rewrite
node_qa -->|"retrieves context"| node_vector_search
node_qa -->|"retrieves context"| node_bm25
node_qa -->|"selects context"| node_reranker
node_qa -->|"generates answer"| node_llm
node_llm -->|"requests completion"| node_openai
node_qa -->|"returns citations"| node_sources_context
node_app -->|"displays results"| node_sources_context

click node_app "https://github.com/sumeetsingh501/enterprise_knowledge_assistant/blob/main/app.py"
click node_sources_context "https://github.com/sumeetsingh501/enterprise_knowledge_assistant/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_app,node_config,node_sources_context toneBlue
class node_local_docs,node_loader,node_chunking,node_embeddings,node_faiss toneAmber
class node_vector_search,node_bm25,node_rrf,node_reranker,node_openai toneMint
class node_rewrite,node_memory,node_qa,node_llm toneRose
class node_employee toneIndigo
```

## Components

### User interface

- [Streamlit application](https://github.com/sumeetsingh501/enterprise_knowledge_assistant/blob/main/app.py): `app.py`
- **Configuration**
- [Sources and context view](https://github.com/sumeetsingh501/enterprise_knowledge_assistant/blob/main/app.py): `app.py`

### Document ingestion

- **Company documents**
- **Document loaders**
- **Chunking and ingestion**
- **OpenAI embeddings**
- **FAISS index**

### Retrieval and ranking

- **Vector search**
- **BM25 search**
- **Hybrid fusion**
- **Semantic reranking**

### Conversation and answers

- **Query rewriting**
- **Session memory**
- **Answer orchestration**
- **Grounded LLM**

### Other components

- **Employee**
- **OpenAI API**

## Connections

- Employee → Streamlit application: asks questions (evidence: `README.md`)
- Streamlit application → Configuration: validates settings (evidence: `app.py`)
- Streamlit application → Chunking and ingestion: builds index (evidence: `app.py`)
- Streamlit application → Answer orchestration: asks query (evidence: `app.py`)
- Streamlit application → Session memory: reads history (evidence: `app.py`)
- Answer orchestration → Session memory: rewrites with history (evidence: `README.md`)
- Company documents → Document loaders: loads files (evidence: `README.md`)
- Document loaders → Chunking and ingestion: provides documents (evidence: `README.md`)
- Chunking and ingestion → OpenAI embeddings: embeds chunks (evidence: `README.md`)
- OpenAI embeddings → OpenAI API: requests embeddings (evidence: `README.md`)
- Chunking and ingestion → FAISS index: stores vectors (evidence: `README.md`)
- Query rewriting → Vector search: searches query (evidence: `README.md`)
- Vector search → FAISS index: searches index (evidence: `README.md`)
- Query rewriting → BM25 search: searches query (evidence: `README.md`)
- Vector search → Hybrid fusion: fuses results (evidence: `README.md`)
- BM25 search → Hybrid fusion: fuses results (evidence: `README.md`)
- Hybrid fusion → Semantic reranking: ranks candidates (evidence: `README.md`)
- Answer orchestration → Query rewriting: rewrites query (evidence: `README.md`)
- Answer orchestration → Vector search: retrieves context (evidence: `README.md`)
- Answer orchestration → BM25 search: retrieves context (evidence: `README.md`)
- Answer orchestration → Semantic reranking: selects context (evidence: `README.md`)
- Answer orchestration → Grounded LLM: generates answer (evidence: `README.md`)
- Grounded LLM → OpenAI API: requests completion (evidence: `README.md`)
- Answer orchestration → Sources and context view: returns citations (evidence: `README.md`)
- Streamlit application → Sources and context view: displays results (evidence: `app.py`)
