# satishk01/llmsample architecture

> Architecture diagram of the GitHub repository satishk01/llmsample, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/satishk01/llmsample
- Repository: https://github.com/satishk01/llmsample

## Overview

##### Project type and purpose
- At the top level this repo (“LLMsample”) is an open-source collection of small demo apps and notebooks illustrating LLM integration patterns (AWS Bedrock & Kendra RAG, Huggingface image-to-HTML, SQLite-backed chat agents, local Llama2 workflows, PDF ingestion, etc.).
- Each subfolder (e.g. Claude3KendraRAGBot, bedrockagents, imagetoHtmlCode-Huggingface, llama2kendrarag, etc.) is a self-contained demo that shows how to wire up data sources (PDFs, images, SQLite, JSON APIs) to an LLM endpoint.

##### File structure
- Top-level directories = individual sample modules.
- Common file types:
- Python scripts (app.py, genIndex.py, kendra_bedrock_query.py)
- Jupyter notebooks (.ipynb)
- Lambda code (Bedrock-agents DB lambda in JS)
- Config files (.env, requirements.txt, .readme.txt)
- Dependencies: AWS SDK calls (Bedrock, Kendra), SQLite, Huggingface transformers, local Llama2 container.

##### Readme insights
- README.md simply states “Sample code for LLM,” so we rely on folder names and file names to infer data flows and external integrations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Title
    subgraph "LLMsample – Modular Demo Architecture"
    end

    %% User Entry
    User["User"]:::entry

    %% Entry Points
    subgraph "Entry Points" 
        CLI["app.py / CLI"]:::entry
        Notebook["Jupyter Notebooks"]:::entry
    end

    User -->|1. launch demo| CLI
    User -->|1. launch demo| Notebook

    %% Modules
    subgraph "Demo Modules"
        direction TB

        subgraph "Claude3 Kendra RAG Demo"
            direction TB
            C1_app["app.py"]:::module
            C1_query["kendra_bedrock_query.py"]:::module
            C1_env[".env"]:::config
            C1_app -->|reads| C1_env
            C1_app -->|calls| C1_query
        end

        subgraph "Bedrock Agents (Lambda + SQLite Chat Agent)"
            direction TB
            B1_lambda["Bedrock-agents-db-lambda.js"]:::module
            B1_db["customer_service_agent_sqlite_db"]:::datastore
            B1_api["customerservice-api.json"]:::config
            B1_lambda -->|reads| B1_api
            B1_lambda -->|queries| B1_db
        end

        subgraph "Huggingface Image-to-HTML Demo"
            direction TB
            H1_nb["imgtohtml.ipynb"]:::module
        end

        subgraph "Local Llama2 PDF Ingestion Demo"
            direction TB
            L2_app["app.py"]:::module
            L2_idx["genIndex.py"]:::module
            L2_pdf["Heart_Disease.pdf"]:::datastore
            L2_app -->|uses| L2_idx
            L2_app -->|loads| L2_pdf
        end

        subgraph "Llama2 + Kendra RAG Demo"
            direction TB
            LKR_app["app.py"]:::module
            LKR_kendra["kendra_chat_llama_2.py"]:::module
            LKR_pdf["h3_understanding_heart_disease_web-pdf.pdf"]:::datastore
            LKR_app -->|calls| LKR_kendra
            LKR_app -->|loads| LKR_pdf
        end

        subgraph "Invoice Generation with Llama2 Notebook"
            direction TB
            INV_nb["llama2_llm_invoice.ipynb"]:::module
        end

        subgraph "DeepSeeker Code Demo"
            direction TB
            DS_nb["deepseeker_coder.ipynb"]:::module
        end

        subgraph "Starling LLM Notebook Demo"
            direction TB
            ST_nb["starling_llm.ipynb"]:::module
        end

        subgraph "LLaVA Image-Conditioned LLM Demo"
            direction TB
            LV_nb["llava.ipynb"]:::module
        end

        subgraph "LLaVA GGUF Local Model Demo"
            direction TB
            LG_app["app.py"]:::module
            LG_readme["Readme.txt"]:::config
            LG_app -->|reads| LG_readme
        end

    end

    %% External Services
    subgraph "External Services"
        direction TB
        Kendra["AWS Kendra"]:::service
        Bedrock["AWS Bedrock"]:::service
        Huggingface["Huggingface API / Local Transformer"]:::service
        Llama2Container["Local Llama2 Container"]:::service
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        SQLite["SQLite DB"]:::datastore
    end

    %% Flows for each demo
    CLI -->|"runs"| C1_app
    Notebook -->|runs| H1_nb
    Notebook -->|runs| INV_nb
    Notebook -->|runs| DS_nb
    Notebook -->|runs| ST_nb
    Notebook -->|runs| LV_nb

    CLI -->|runs| L2_app
    CLI -->|runs| LKR_app
    CLI -->|invokes| B1_lambda

    C1_query -->|queries| Kendra
    C1_query -->|forwards to| Bedrock

    B1_lambda -->|calls| Bedrock
    B1_lambda -->|persists to| SQLite

    H1_nb -->|calls| Huggingface
    L2_app -->|calls| Llama2Container
    LKR_kendra -->|queries| Kendra
    LKR_kendra -->|forwards to| Llama2Container

    %% Return flow
    Kendra -->|returns context| C1_query
    Bedrock -->|returns answer| C1_app
    Bedrock -->|returns response| B1_lambda
    Huggingface -->|returns HTML| H1_nb
    Llama2Container -->|returns index| L2_app
    Llama2Container -->|returns answer| LKR_app

    %% Click Events
    click C1_app "https://github.com/satishk01/llmsample/blob/main/Claude3KendraRAGBot/app.py"
    click C1_query "https://github.com/satishk01/llmsample/blob/main/Claude3KendraRAGBot/kendra_bedrock_query.py"
    click C1_env "https://github.com/satishk01/llmsample/blob/main/Claude3KendraRAGBot/.env"
    click B1_lambda "https://github.com/satishk01/llmsample/blob/main/bedrockagents/part1/Bedrock-agents-db-lambda.js"
    click B1_db "https://github.com/satishk01/llmsample/tree/main/bedrockagents/part1/customer_service_agent_sqlite_db"
    click B1_api "https://github.com/satishk01/llmsample/blob/main/bedrockagents/part1/customerservice-api.json"
    click H1_nb "https://github.com/satishk01/llmsample/blob/main/imagetoHtmlCode-Huggingface/imgtohtml.ipynb"
    click L2_app "https://github.com/satishk01/llmsample/blob/main/llama2/app.py"
    click L2_idx "https://github.com/satishk01/llmsample/blob/main/llama2/genIndex.py"
    click L2_pdf "https://github.com/satishk01/llmsample/blob/main/llama2/Heart_Disease.pdf"
    click LKR_app "https://github.com/satishk01/llmsample/blob/main/llama2kendrarag/app.py"
    click LKR_kendra "https://github.com/satishk01/llmsample/blob/main/llama2kendrarag/kendra_chat_llama_2.py"
    click LKR_pdf "https://github.com/satishk01/llmsample/blob/main/llama2kendrarag/h3_understanding_heart_disease_web-pdf.pdf"
    click INV_nb "https://github.com/satishk01/llmsample/blob/main/llama2-invoice/llama2_llm_invoice.ipynb"
    click DS_nb "https://github.com/satishk01/llmsample/blob/main/Deepseek-coder/deepseeker_coder.ipynb"
    click ST_nb "https://github.com/satishk01/llmsample/blob/main/Starling/starling_llm.ipynb"
    click LV_nb "https://github.com/satishk01/llmsample/blob/main/llava/llava.ipynb"
    click LG_app "https://github.com/satishk01/llmsample/blob/main/llavagguf/app.py"
    click LG_readme "https://github.com/satishk01/llmsample/blob/main/llavagguf/Readme.txt"

    classDef entry fill:#D0E8FF,stroke:#0288D1,color:#000
    classDef module fill:#E8F6FF,stroke:#81D4FA,color:#000
    classDef service fill:#E8F5E9,stroke:#66BB6A,color:#000
    classDef datastore fill:#FFF3E0,stroke:#FFA726,color:#000
    classDef config fill:#F3E5F5,stroke:#AB47BC,color:#000
```
