# shitan198u/anychat architecture

> Architecture diagram of the GitHub repository shitan198u/anychat, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shitan198u/anychat
- Repository: https://github.com/shitan198u/anychat

## Overview

##### Main Components

a) Frontend Layer:
- Streamlit Web Interface (primary user interaction point)
- File Upload Component
- Chat Interface Component
- Model Selection Interface

b) Core Processing Layer:
- Document Processing Engine
- LLM Integration Hub
- Embedding Service
- Conversation Manager

c) External Services:
- Ollama Integration
- Groq Integration
- Google Gemini Integration
- Document Storage

##### Component Relationships

**User Interface Layer**

- ▼
**Document Processing Layer ←→ Document Storage**

- ▼
**Embedding Service Layer**

- ▼
**LLM Integration Hub ←→ External LLM Services**

- ▼
**Conversation Manager**

##### Specific Implementation Details

a) Core Files (from src/anychat):
- chatbot.py (Main application entry)
- ingest.py (Document processing)
- langchain_local.py (LLM integration)
- uploadFile.py (File handling)

b) Configuration:
- .streamlit/config.toml
- .streamlit/secrets.toml

##### Technical Stack Callouts

Technology badges or labels for:
- Streamlit (Frontend Framework)
- LangChain (LLM Framework)
- Ollama (Local LLM)
- Groq (Cloud LLM)
- Google Gemini (Cloud LLM)

##### Additional Elements

- Version information
- Scaling indicators where applicable
- Security boundaries
- Configuration dependencies

Remember to indicate the optional nature of different LLM providers and embedding models, as the system supports multiple options that can be configured at runtime.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI["User Interface Layer"]
        WEB["Streamlit Web Interface"]
        UPLOAD["File Upload Component"]
        CHAT["Chat Interface"]
    end

    subgraph CORE["Core Processing Layer"]
        DOC["Document Processing Engine"]
        LLM["LLM Integration Hub"]
        EMB["Embedding Service"]
        CONV["Conversation Manager"]
    end

    subgraph EXT["External Services"]
        OLLAMA["Ollama"]
        GROQ["Groq"]
        GEMINI["Google Gemini"]
    end

    subgraph STORE["Storage Layer"]
        DOCS[("Document Storage")]
    end

    %% Connections
    WEB --> UPLOAD
    WEB --> CHAT
    UPLOAD --> DOC
    DOC <--> DOCS
    DOC --> EMB
    EMB --> LLM
    LLM <--> OLLAMA
    LLM <--> GROQ
    LLM <--> GEMINI
    LLM --> CONV
    CONV --> CHAT

    %% Click Events
    click WEB "https://github.com/shitan198u/AnyChat/blob/main/src/anychat/.streamlit/config.toml"
    click UPLOAD "https://github.com/shitan198u/AnyChat/blob/main/src/anychat/uploadFile.py"
    click CHAT "https://github.com/shitan198u/AnyChat/blob/main/src/anychat/chatbot.py"
    click DOC "https://github.com/shitan198u/AnyChat/blob/main/src/anychat/ingest.py"
    click LLM "https://github.com/shitan198u/AnyChat/blob/main/src/anychat/langchain_local.py"
    click CONV "https://github.com/shitan198u/AnyChat/blob/main/src/anychat/chatbot.py"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef external fill:#90EE90,stroke:#333,stroke-width:2px
    classDef storage fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef processing fill:#FFD700,stroke:#333,stroke-width:2px
    classDef ui fill:#87CEEB,stroke:#333,stroke-width:2px

    class OLLAMA,GROQ,GEMINI external
    class DOCS storage
    class DOC,EMB,LLM processing
    class WEB,UPLOAD,CHAT,CONV ui

    %% Legend
    subgraph Legend
        L1["UI Component"]:::ui
        L2["Processing Component"]:::processing
        L3["External Service"]:::external
        L4[("Storage")]:::storage
    end
```
