# tilotech/identity-rag-customer-insights-chatbot architecture

> Architecture diagram of the GitHub repository tilotech/identity-rag-customer-insights-chatbot, 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/tilotech/identity-rag-customer-insights-chatbot
- Repository: https://github.com/tilotech/identity-rag-customer-insights-chatbot

## Overview

Key Components to Include:

##### Client Layer
- Chat interface where users input queries
- PDF upload functionality

##### Application Layer
a. Identity Resolution Service
b. RAG (Retrieval Augmented Generation) Pipeline
c. LLM Integration Module (supporting both OpenAI and AWS Bedrock)

##### Data & Integration Layer
- Tilores API Integration
- Customer Data Sources
- Authentication/Token Management
- PDF Processing Service (using poppler-utils)

Design Guidelines:

##### Main Flow Representation
- User Query → Chat Interface → IdentityRAG Engine → LLM → Response

##### Component Relationships
- [Web Interface] → [IdentityRAG Engine]
- ↓
- [Tilores API] ← [Identity Resolution] → [Customer Data]
- ↓
- [LLM Provider] ← [RAG Pipeline] → [Context Processing]

##### Authentication Flow
A separate section showing:
- [Tilores Token URL] → [OAuth Flow] → [API Access]
- [AWS Credentials/OpenAI Key] → [LLM Authentication]

Special Considerations:

##### Environment Configuration
- A configuration management component showing environment variables
- Flexibility between OpenAI and AWS Bedrock

##### Data Processing Pipeline
- Unification process
- Search and retrieval flow
- Demonstrate deduplication and disambiguation steps

##### Integration Points
- LangChain integration
- PDF processing pipeline
- Multiple data source connections

- LLM providers
- Data sources
- Interface options

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef interface fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef data fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef auth fill:#e74c3c,stroke:#c0392b,color:white

    %% Client Layer
    subgraph ClientLayer["Client Layer"]
        UI[Chat Interface]:::interface
        PDF[PDF Upload]:::interface
    end

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        Engine["IdentityRAG Engine"]:::core
        
        subgraph CoreServices["Core Services"]
            Identity["Identity Resolution Service"]:::core
            RAG["RAG Pipeline"]:::core
            LLMInt["LLM Integration"]:::core
        end
    end

    %% Data & Integration Layer
    subgraph DataLayer["Data & Integration Layer"]
        TiloresAPI["Tilores API"]:::external
        CustomerData["Customer Data Sources"]:::data
        PDFProcess["PDF Processing Service"]:::core
        
        subgraph Auth["Authentication"]
            TokenMgmt["Token Management"]:::auth
            OAuthFlow["OAuth Flow"]:::auth
            LLMAuth["LLM Authentication"]:::auth
        end
    end

    %% External Services
    subgraph External["External Services"]
        OpenAI["OpenAI"]:::external
        Bedrock["AWS Bedrock"]:::external
    end

    %% Connections
    UI --> Engine
    PDF --> PDFProcess
    PDFProcess --> Engine
    Engine --> Identity
    Engine --> RAG
    Engine --> LLMInt
    Identity --> TiloresAPI
    Identity --> CustomerData
    RAG --> LLMInt
    LLMInt --> OpenAI
    LLMInt --> Bedrock
    TiloresAPI --> TokenMgmt
    TokenMgmt --> OAuthFlow
    LLMInt --> LLMAuth

    %% Legend
    subgraph Legend["Legend"]
        L1["User Interface"]:::interface
        L2["Core Components"]:::core
        L3["External Services"]:::external
        L4["Data Stores"]:::data
        L5["Authentication"]:::auth
    end

    %% Click Events
    click UI "https://github.com/tilotech/identity-rag-customer-insights-chatbot/blob/main/chat.py"
    click Engine "https://github.com/tilotech/identity-rag-customer-insights-chatbot/tree/main/docs/"
    click TokenMgmt "https://github.com/tilotech/identity-rag-customer-insights-chatbot/blob/main/requirements.txt"
    click PDFProcess "https://github.com/tilotech/identity-rag-customer-insights-chatbot/tree/main/Makefile"
```
