# sampath7670/intelligence-system architecture

> Architecture diagram of the GitHub repository sampath7670/intelligence-system, 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/sampath7670/intelligence-system
- Repository: https://github.com/sampath7670/intelligence-system

## Overview

The Intelligent Networking Assistant’s main workflow starts in the Streamlit interface, passes requests to FastAPI routes, and returns personalized professional communication grounded in retrieved knowledge and factual checks. The backend also manages personas and documents, recommends topics and follow-ups, and evaluates generated text against benchmarks. Its internal layers separate API orchestration, domain services, and persistent models. The README documents product capabilities beyond the sampled excerpts; edges reflect shown calls, indexed references, or documented interactions, and unsampled details are not inferred.

Main entry points: [`backend/routes/routes.py`](https://github.com/sampath7670/intelligence-system/blob/master/backend/routes/routes.py) (API routes), [`backend/models/models.py`](https://github.com/sampath7670/intelligence-system/blob/master/backend/models/models.py) (Domain models), [`backend/main.py`](https://github.com/sampath7670/intelligence-system/blob/master/backend/main.py) (FastAPI application), [`backend/services/vector_service.py`](https://github.com/sampath7670/intelligence-system/blob/master/backend/services/vector_service.py) (Hybrid retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_frontend["Streamlit interface<br/>[app.py]"]
end

subgraph group_api["API orchestration"]
  node_fastapi["FastAPI application<br/>[main.py]"]
  node_routes["API routes<br/>[routes.py]"]
end

subgraph group_knowledge["Knowledge and verification"]
  node_documents["Document ingestion"]
  node_retrieval["Hybrid retrieval<br/>[vector_service.py]"]
  node_verification["Claim verification"]
  node_wikipedia["Wikipedia lookup<br/>[wiki_service.py]"]
end

subgraph group_conversation["Communication features"]
  node_generation["Communication generation<br/>[nlp_service.py]"]
  node_recommendations["Smart recommendations"]
  node_evaluation["Benchmark evaluation"]
end

subgraph group_state["Persistence and configuration"]
  node_database[("SQLite database<br/>[database.py]")]
  node_models["Domain models<br/>[models.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

node_user(("Professional user"))
node_wiki_service["Wikipedia service"]

node_user -->|"uses"| node_frontend
node_frontend -->|"sends requests"| node_fastapi
node_fastapi -->|"mounts routes"| node_routes
node_fastapi -->|"seeds knowledge"| node_documents
node_fastapi -->|"rebuilds index"| node_retrieval
node_routes -->|"manages documents"| node_documents
node_routes -->|"retrieves evidence"| node_retrieval
node_routes -->|"generates messages"| node_generation
node_routes -->|"checks claims"| node_verification
node_routes -->|"requests suggestions"| node_recommendations
node_routes -->|"runs benchmarks"| node_evaluation
node_verification -->|"searches evidence"| node_retrieval
node_verification -->|"checks articles"| node_wikipedia
node_wikipedia -->|"queries"| node_wiki_service
node_routes -->|"opens sessions"| node_database
node_routes -->|"reads and writes"| node_models
node_documents -->|"stores chunks"| node_models
node_retrieval -->|"loads chunks"| node_models
node_recommendations -->|"reads feedback"| node_models
node_models -->|"maps entities"| node_database
node_database -->|"uses database URL"| node_config
node_wikipedia -->|"uses user agent"| node_config

click node_frontend "https://github.com/sampath7670/intelligence-system/blob/master/frontend/app.py"
click node_fastapi "https://github.com/sampath7670/intelligence-system/blob/master/backend/main.py"
click node_routes "https://github.com/sampath7670/intelligence-system/blob/master/backend/routes/routes.py"
click node_documents "https://github.com/sampath7670/intelligence-system/blob/master/backend/services/document_service.py"
click node_retrieval "https://github.com/sampath7670/intelligence-system/blob/master/backend/services/vector_service.py"
click node_verification "https://github.com/sampath7670/intelligence-system/blob/master/backend/services/verification_service.py"
click node_wikipedia "https://github.com/sampath7670/intelligence-system/blob/master/backend/services/wiki_service.py"
click node_generation "https://github.com/sampath7670/intelligence-system/blob/master/backend/services/nlp_service.py"
click node_recommendations "https://github.com/sampath7670/intelligence-system/blob/master/backend/services/recommendation_service.py"
click node_evaluation "https://github.com/sampath7670/intelligence-system/blob/master/backend/services/evaluation_service.py"
click node_database "https://github.com/sampath7670/intelligence-system/blob/master/backend/database.py"
click node_models "https://github.com/sampath7670/intelligence-system/blob/master/backend/models/models.py"
click node_config "https://github.com/sampath7670/intelligence-system/blob/master/config/config.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_frontend,node_user toneBlue
class node_fastapi,node_routes toneAmber
class node_documents,node_retrieval,node_verification,node_wikipedia toneMint
class node_generation,node_recommendations,node_evaluation toneRose
class node_database,node_models,node_config,node_wiki_service toneIndigo
```

## Components

### User interface

- [Streamlit interface](https://github.com/sampath7670/intelligence-system/blob/master/frontend/app.py): `frontend/app.py`

### API orchestration

- [FastAPI application](https://github.com/sampath7670/intelligence-system/blob/master/backend/main.py): `backend/main.py`
- [API routes](https://github.com/sampath7670/intelligence-system/blob/master/backend/routes/routes.py): `backend/routes/routes.py`

### Knowledge and verification

- [Document ingestion](https://github.com/sampath7670/intelligence-system/blob/master/backend/services/document_service.py): `backend/services/document_service.py`
- [Hybrid retrieval](https://github.com/sampath7670/intelligence-system/blob/master/backend/services/vector_service.py): `backend/services/vector_service.py`
- [Claim verification](https://github.com/sampath7670/intelligence-system/blob/master/backend/services/verification_service.py): `backend/services/verification_service.py`
- [Wikipedia lookup](https://github.com/sampath7670/intelligence-system/blob/master/backend/services/wiki_service.py): `backend/services/wiki_service.py`

### Communication features

- [Communication generation](https://github.com/sampath7670/intelligence-system/blob/master/backend/services/nlp_service.py): `backend/services/nlp_service.py`
- [Smart recommendations](https://github.com/sampath7670/intelligence-system/blob/master/backend/services/recommendation_service.py): `backend/services/recommendation_service.py`
- [Benchmark evaluation](https://github.com/sampath7670/intelligence-system/blob/master/backend/services/evaluation_service.py): `backend/services/evaluation_service.py`

### Persistence and configuration

- [SQLite database](https://github.com/sampath7670/intelligence-system/blob/master/backend/database.py): `backend/database.py`
- [Domain models](https://github.com/sampath7670/intelligence-system/blob/master/backend/models/models.py): `backend/models/models.py`
- [Runtime configuration](https://github.com/sampath7670/intelligence-system/blob/master/config/config.py): `config/config.py`

### Other components

- **Professional user**
- **Wikipedia service**

## Connections

- Professional user → Streamlit interface: uses (evidence: `README.md`)
- Streamlit interface → FastAPI application: sends requests (evidence: `README.md`)
- FastAPI application → API routes: mounts routes (evidence: `backend/main.py`)
- FastAPI application → Document ingestion: seeds knowledge (evidence: `backend/main.py`)
- FastAPI application → Hybrid retrieval: rebuilds index (evidence: `backend/main.py`)
- API routes → Document ingestion: manages documents (evidence: `backend/routes/routes.py`)
- API routes → Hybrid retrieval: retrieves evidence (evidence: `backend/routes/routes.py`)
- API routes → Communication generation: generates messages (evidence: `backend/routes/routes.py`)
- API routes → Claim verification: checks claims (evidence: `backend/routes/routes.py`)
- API routes → Smart recommendations: requests suggestions (evidence: `backend/routes/routes.py`)
- API routes → Benchmark evaluation: runs benchmarks (evidence: `backend/routes/routes.py`)
- Claim verification → Hybrid retrieval: searches evidence (evidence: `backend/services/verification_service.py`)
- Claim verification → Wikipedia lookup: checks articles (evidence: `backend/services/verification_service.py`)
- Wikipedia lookup → Wikipedia service: queries (evidence: `backend/services/wiki_service.py`)
- API routes → SQLite database: opens sessions (evidence: `backend/routes/routes.py`)
- API routes → Domain models: reads and writes (evidence: `backend/routes/routes.py`)
- Document ingestion → Domain models: stores chunks (evidence: `backend/services/document_service.py`)
- Hybrid retrieval → Domain models: loads chunks (evidence: `backend/services/vector_service.py`)
- Smart recommendations → Domain models: reads feedback (evidence: `backend/services/recommendation_service.py`)
- Domain models → SQLite database: maps entities (evidence: `backend/models/models.py`)
- SQLite database → Runtime configuration: uses database URL (evidence: `backend/database.py`)
- Wikipedia lookup → Runtime configuration: uses user agent (evidence: `backend/services/wiki_service.py`)
