# mekalakarthik05/lexintel-ai architecture

> Architecture diagram of the GitHub repository mekalakarthik05/lexintel-ai, 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/mekalakarthik05/lexintel-ai
- Repository: https://github.com/mekalakarthik05/lexintel-ai

## Overview

LexIntel AI is a legal-document research assistant: users upload documents for chunking and indexing, then ask natural-language questions and receive answers grounded in retrieved document context. The Streamlit interface calls a FastAPI backend, which manages sessions and routes uploads and chat requests into the RAG components. The README documents the embedding, Pinecone retrieval, context-injection, and Llama/Groq stages; some internal wiring is not fully shown in the excerpts, so those documented links cite the README.

Main entry points: [`src/vector_store.py`](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/vector_store.py) (Vector Store), [`src/app.py`](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/app.py) (FastAPI Routes), [`src/chatbot.py`](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/chatbot.py) (Legal Assistant), [`app.py`](https://github.com/mekalakarthik05/lexintel-ai/blob/main/app.py) (Streamlit Interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_ui["Streamlit Interface<br/>[app.py]"]
end

subgraph group_backend["API and Sessions"]
  node_api["FastAPI Routes<br/>[app.py]"]
  node_sessions["Session Manager<br/>[session_manager.py]"]
end

subgraph group_ingestion["Document Ingestion"]
  node_processor["Document Processor"]
  node_chunking["Text Chunking"]
  node_uploader["Document Uploader"]
end

subgraph group_rag["Retrieval and Answering"]
  node_embeddings["Embedding Model<br/>[vector_store.py]"]
  node_vectorstore["Vector Store<br/>[vector_store.py]"]
  node_pinecone[("Pinecone Index")]
  node_assistant["Legal Assistant<br/>[chatbot.py]"]
  node_config["Runtime Config<br/>[config.py]"]
end

node_user(("Researcher"))
node_groq["Groq LLM"]

node_user -->|"asks or uploads"| node_ui
node_ui -->|"sends requests"| node_api
node_api -->|"processes uploads"| node_processor
node_processor -->|"splits documents"| node_chunking
node_api -->|"indexes documents"| node_vectorstore
node_uploader -.->|"uploads vectors"| node_vectorstore
node_api -->|"manages sessions"| node_sessions
node_api -->|"routes questions"| node_assistant
node_assistant -->|"retrieves context"| node_vectorstore
node_vectorstore -->|"embeds queries"| node_embeddings
node_vectorstore -->|"searches vectors"| node_pinecone
node_assistant -->|"generates answers"| node_groq
node_assistant -->|"reads credentials"| node_config
node_vectorstore -->|"reads index settings"| node_config

click node_ui "https://github.com/mekalakarthik05/lexintel-ai/blob/main/app.py"
click node_api "https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/app.py"
click node_sessions "https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/session_manager.py"
click node_processor "https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/document_processor.py"
click node_chunking "https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/document_processor.py"
click node_uploader "https://github.com/mekalakarthik05/lexintel-ai/blob/main/document_uploader.py"
click node_embeddings "https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/vector_store.py"
click node_vectorstore "https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/vector_store.py"
click node_assistant "https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/chatbot.py"
click node_config "https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/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_ui toneBlue
class node_api,node_sessions toneAmber
class node_processor,node_chunking,node_uploader toneMint
class node_embeddings,node_vectorstore,node_pinecone,node_assistant,node_config toneRose
class node_user,node_groq toneIndigo
```

## Components

### User Interface

- [Streamlit Interface](https://github.com/mekalakarthik05/lexintel-ai/blob/main/app.py): `app.py`

### API and Sessions

- [FastAPI Routes](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/app.py): `src/app.py`
- [Session Manager](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/session_manager.py): `src/session_manager.py`

### Document Ingestion

- [Document Processor](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/document_processor.py): `src/document_processor.py`
- [Text Chunking](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/document_processor.py): `src/document_processor.py`
- [Document Uploader](https://github.com/mekalakarthik05/lexintel-ai/blob/main/document_uploader.py): `document_uploader.py`

### Retrieval and Answering

- [Embedding Model](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/vector_store.py): `src/vector_store.py`
- [Vector Store](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/vector_store.py): `src/vector_store.py`
- **Pinecone Index**
- [Legal Assistant](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/chatbot.py): `src/chatbot.py`
- [Runtime Config](https://github.com/mekalakarthik05/lexintel-ai/blob/main/src/config.py): `src/config.py`

### Other components

- **Researcher**
- **Groq LLM**

## Connections

- Researcher → Streamlit Interface: asks or uploads (evidence: `README.md`)
- Streamlit Interface → FastAPI Routes: sends requests (evidence: `app.py`)
- FastAPI Routes → Document Processor: processes uploads (evidence: `src/app.py`)
- Document Processor → Text Chunking: splits documents (evidence: `src/document_processor.py`)
- FastAPI Routes → Vector Store: indexes documents (evidence: `README.md`)
- Document Uploader → Vector Store: uploads vectors
- FastAPI Routes → Session Manager: manages sessions (evidence: `src/app.py`)
- FastAPI Routes → Legal Assistant: routes questions (evidence: `src/app.py`)
- Legal Assistant → Vector Store: retrieves context (evidence: `README.md`)
- Vector Store → Embedding Model: embeds queries (evidence: `README.md`)
- Vector Store → Pinecone Index: searches vectors (evidence: `README.md`)
- Legal Assistant → Groq LLM: generates answers (evidence: `README.md`)
- Legal Assistant → Runtime Config: reads credentials (evidence: `src/chatbot.py`)
- Vector Store → Runtime Config: reads index settings (evidence: `src/vector_store.py`)
