# and3m/genai-for-analysts architecture

> Architecture diagram of the GitHub repository and3m/genai-for-analysts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/and3m/genai-for-analysts
- Repository: https://github.com/and3m/genai-for-analysts

## Overview

This repository is a portfolio of ten independent GenAI applications, rather than one shared runtime. The main user-to-result paths range from uploading or asking a question in a Streamlit app, through project-specific analysis, retrieval, agent tools, classification, evaluation, or guardrails, to a narrative, answer, brief, or stored/exported records. The graph groups projects by the README’s six learning phases and preserves their distinct domain stages. Unsampled subsystems are included where the README documents their capabilities; edges for those relationships cite the README rather than implying source inspection.

Main entry points: [`09-guardrailed-chatbot/app.py`](https://github.com/and3m/genai-for-analysts/blob/main/09-guardrailed-chatbot/app.py) (Guardrailed Chatbot UI), [`10-document-intelligence/storage.py`](https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/storage.py) (Invoice Storage), [`01-report-narrator/app.py`](https://github.com/and3m/genai-for-analysts/blob/main/01-report-narrator/app.py) (Narrator UI), [`03-policy-qa-rag/app.py`](https://github.com/and3m/genai-for-analysts/blob/main/03-policy-qa-rag/app.py) (Policy Q&A UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundations["LLM Foundations"]
  node_narrator_ui["Narrator UI<br/>[app.py]"]
  node_report_data["Dataset Analysis<br/>[data_loader.py]"]
  node_narrative["Narrative Generation<br/>[narrator.py]"]
  node_prompt_ui["Prompt Playground<br/>[app.py]"]
  node_prompt_runner["Prompt Techniques<br/>[prompt_runner.py]"]
end

subgraph group_rag["Retrieval QA"]
  node_policy_ui["Policy Q&amp;A UI<br/>[app.py]"]
  node_policy_ingest["Policy Ingestion<br/>[ingest.py]"]
  node_policy_retriever["Policy Retrieval<br/>[retriever.py]"]
  node_financial_ui["Financial Analyst UI<br/>[app.py]"]
  node_financial_ingest["Financial PDF Ingestion<br/>[ingest.py]"]
  node_financial_retriever["Financial Retrieval<br/>[retriever.py]"]
end

subgraph group_agents["Agents"]
  node_analyst_ui["Data Analyst UI<br/>[app.py]"]
  node_analyst_agent["Analysis Agent<br/>[agent.py]"]
  node_sample_database[("Sample Sales Database<br/>[setup_db.py]")]
  node_research_ui["Research Agent UI<br/>[app.py]"]
  node_research_agent["Research Orchestrator<br/>[agent.py]"]
end

subgraph group_finetuning["Fine-Tuning"]
  node_classifier_prep["Dataset Preparation<br/>[prepare_data.py]"]
  node_classifier_train["Model Training<br/>[train.py]"]
  node_classifier_infer["Text Classification<br/>[inference.py]"]
end

subgraph group_eval_safety["Evaluation &amp; Safety"]
  node_eval_runner["RAG Evaluation Runner<br/>[eval_runner.py]"]
  node_eval_ui["Evaluation Dashboard<br/>[app.py]"]
  node_chatbot_ui["Guardrailed Chatbot UI<br/>[app.py]"]
  node_chat_guardrails["Input &amp; Output Guardrails<br/>[guardrails.py]"]
  node_audit_logger[("Audit Logging<br/>[audit_logger.py]")]
end

subgraph group_documents["Document Intelligence"]
  node_document_ui["Invoice Intelligence UI<br/>[app.py]"]
  node_invoice_extractor["Vision Extraction<br/>[extractor.py]"]
  node_invoice_models["Invoice Validation Models<br/>[models.py]"]
  node_invoice_storage["Invoice Storage<br/>[storage.py]"]
  node_invoice_db[("Invoice Records DB<br/>[storage.py]")]
  node_excel_export["Excel Export<br/>[storage.py]"]
end

node_user(("Business User"))
node_anthropic{{"Anthropic Claude"}}
node_tavily{{"Tavily Search"}}
node_openai{{"OpenAI Metrics"}}

node_user -->|"uploads data"| node_narrator_ui
node_narrator_ui -->|"loads and summarizes"| node_report_data
node_narrator_ui -->|"requests narrative"| node_narrative
node_narrative -.->|"generates text"| node_anthropic
node_user -->|"selects task"| node_prompt_ui
node_prompt_ui -->|"runs comparisons"| node_prompt_runner
node_prompt_runner -.->|"runs prompts"| node_anthropic
node_user -->|"asks policy question"| node_policy_ui
node_policy_ui -->|"retrieves context"| node_policy_retriever
node_policy_ui -->|"generates cited answer"| node_anthropic
node_policy_ingest -.->|"builds vector store"| node_policy_retriever
node_user -->|"asks report question"| node_financial_ui
node_financial_ui -->|"retrieves excerpts"| node_financial_retriever
node_financial_ui -->|"answers with citations"| node_anthropic
node_financial_ingest -.->|"indexes reports"| node_financial_retriever
node_user -->|"asks data question"| node_analyst_ui
node_analyst_ui -->|"runs analysis"| node_analyst_agent
node_analyst_agent -.->|"queries data"| node_sample_database
node_user -->|"submits question"| node_research_ui
node_research_ui -->|"runs research"| node_research_agent
node_research_agent -->|"searches web"| node_tavily
node_research_agent -->|"plans and compiles"| node_anthropic
node_user -.->|"provides dataset"| node_classifier_prep
node_classifier_prep -->|"prepares training data"| node_classifier_train
node_classifier_train -->|"produces model"| node_classifier_infer
node_user -->|"submits text"| node_classifier_infer
node_user -->|"provides questions"| node_eval_runner
node_eval_runner -->|"scores metrics"| node_openai
node_eval_runner -.->|"supplies results"| node_eval_ui
node_user -->|"asks HR question"| node_chatbot_ui
node_chatbot_ui -->|"checks and validates"| node_chat_guardrails
node_chatbot_ui -->|"requests response"| node_anthropic
node_chatbot_ui -->|"records interaction"| node_audit_logger
node_user -->|"uploads invoice"| node_document_ui
node_document_ui -->|"extracts fields"| node_invoice_extractor
node_invoice_extractor -.->|"uses vision model"| node_anthropic
node_invoice_extractor -->|"validates extraction"| node_invoice_models
node_document_ui -->|"saves and exports"| node_invoice_storage
node_invoice_storage -->|"stores validated invoice"| node_invoice_models
node_invoice_storage -->|"reads and writes"| node_invoice_db
node_invoice_storage -->|"exports records"| node_excel_export

click node_narrator_ui "https://github.com/and3m/genai-for-analysts/blob/main/01-report-narrator/app.py"
click node_report_data "https://github.com/and3m/genai-for-analysts/blob/main/01-report-narrator/data_loader.py"
click node_narrative "https://github.com/and3m/genai-for-analysts/blob/main/01-report-narrator/narrator.py"
click node_prompt_ui "https://github.com/and3m/genai-for-analysts/blob/main/02-prompt-playground/app.py"
click node_prompt_runner "https://github.com/and3m/genai-for-analysts/blob/main/02-prompt-playground/prompt_runner.py"
click node_policy_ui "https://github.com/and3m/genai-for-analysts/blob/main/03-policy-qa-rag/app.py"
click node_policy_ingest "https://github.com/and3m/genai-for-analysts/blob/main/03-policy-qa-rag/ingest.py"
click node_policy_retriever "https://github.com/and3m/genai-for-analysts/blob/main/03-policy-qa-rag/retriever.py"
click node_financial_ui "https://github.com/and3m/genai-for-analysts/blob/main/04-financial-report-rag/app.py"
click node_financial_ingest "https://github.com/and3m/genai-for-analysts/blob/main/04-financial-report-rag/ingest.py"
click node_financial_retriever "https://github.com/and3m/genai-for-analysts/blob/main/04-financial-report-rag/retriever.py"
click node_analyst_ui "https://github.com/and3m/genai-for-analysts/blob/main/05-data-analyst-agent/app.py"
click node_analyst_agent "https://github.com/and3m/genai-for-analysts/blob/main/05-data-analyst-agent/agent.py"
click node_sample_database "https://github.com/and3m/genai-for-analysts/blob/main/05-data-analyst-agent/setup_db.py"
click node_research_ui "https://github.com/and3m/genai-for-analysts/blob/main/06-research-agent/app.py"
click node_research_agent "https://github.com/and3m/genai-for-analysts/blob/main/06-research-agent/agent.py"
click node_classifier_prep "https://github.com/and3m/genai-for-analysts/blob/main/07-fine-tuned-classifier/prepare_data.py"
click node_classifier_train "https://github.com/and3m/genai-for-analysts/blob/main/07-fine-tuned-classifier/train.py"
click node_classifier_infer "https://github.com/and3m/genai-for-analysts/blob/main/07-fine-tuned-classifier/inference.py"
click node_eval_runner "https://github.com/and3m/genai-for-analysts/blob/main/08-rag-eval-dashboard/eval_runner.py"
click node_eval_ui "https://github.com/and3m/genai-for-analysts/blob/main/08-rag-eval-dashboard/app.py"
click node_chatbot_ui "https://github.com/and3m/genai-for-analysts/blob/main/09-guardrailed-chatbot/app.py"
click node_chat_guardrails "https://github.com/and3m/genai-for-analysts/blob/main/09-guardrailed-chatbot/guardrails.py"
click node_audit_logger "https://github.com/and3m/genai-for-analysts/blob/main/09-guardrailed-chatbot/audit_logger.py"
click node_document_ui "https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/app.py"
click node_invoice_extractor "https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/extractor.py"
click node_invoice_models "https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/models.py"
click node_invoice_storage "https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/storage.py"
click node_invoice_db "https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/storage.py"
click node_excel_export "https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/storage.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_narrator_ui,node_report_data,node_narrative,node_prompt_ui,node_prompt_runner,node_user toneBlue
class node_policy_ui,node_policy_ingest,node_policy_retriever,node_financial_ui,node_financial_ingest,node_financial_retriever toneAmber
class node_analyst_ui,node_analyst_agent,node_sample_database,node_research_ui,node_research_agent toneMint
class node_classifier_prep,node_classifier_train,node_classifier_infer toneRose
class node_eval_runner,node_eval_ui,node_chatbot_ui,node_chat_guardrails,node_audit_logger,node_anthropic,node_tavily,node_openai toneIndigo
class node_document_ui,node_invoice_extractor,node_invoice_models,node_invoice_storage,node_invoice_db,node_excel_export toneTeal
```

## Components

### LLM Foundations

- [Narrator UI](https://github.com/and3m/genai-for-analysts/blob/main/01-report-narrator/app.py): `01-report-narrator/app.py`
- [Dataset Analysis](https://github.com/and3m/genai-for-analysts/blob/main/01-report-narrator/data_loader.py): `01-report-narrator/data_loader.py`
- [Narrative Generation](https://github.com/and3m/genai-for-analysts/blob/main/01-report-narrator/narrator.py): `01-report-narrator/narrator.py`
- [Prompt Playground](https://github.com/and3m/genai-for-analysts/blob/main/02-prompt-playground/app.py): `02-prompt-playground/app.py`
- [Prompt Techniques](https://github.com/and3m/genai-for-analysts/blob/main/02-prompt-playground/prompt_runner.py): `02-prompt-playground/prompt_runner.py`

### Retrieval QA

- [Policy Q&A UI](https://github.com/and3m/genai-for-analysts/blob/main/03-policy-qa-rag/app.py): `03-policy-qa-rag/app.py`
- [Policy Ingestion](https://github.com/and3m/genai-for-analysts/blob/main/03-policy-qa-rag/ingest.py): `03-policy-qa-rag/ingest.py`
- [Policy Retrieval](https://github.com/and3m/genai-for-analysts/blob/main/03-policy-qa-rag/retriever.py): `03-policy-qa-rag/retriever.py`
- [Financial Analyst UI](https://github.com/and3m/genai-for-analysts/blob/main/04-financial-report-rag/app.py): `04-financial-report-rag/app.py`
- [Financial PDF Ingestion](https://github.com/and3m/genai-for-analysts/blob/main/04-financial-report-rag/ingest.py): `04-financial-report-rag/ingest.py`
- [Financial Retrieval](https://github.com/and3m/genai-for-analysts/blob/main/04-financial-report-rag/retriever.py): `04-financial-report-rag/retriever.py`

### Agents

- [Data Analyst UI](https://github.com/and3m/genai-for-analysts/blob/main/05-data-analyst-agent/app.py): `05-data-analyst-agent/app.py`
- [Analysis Agent](https://github.com/and3m/genai-for-analysts/blob/main/05-data-analyst-agent/agent.py): `05-data-analyst-agent/agent.py`
- [Sample Sales Database](https://github.com/and3m/genai-for-analysts/blob/main/05-data-analyst-agent/setup_db.py): `05-data-analyst-agent/setup_db.py`
- [Research Agent UI](https://github.com/and3m/genai-for-analysts/blob/main/06-research-agent/app.py): `06-research-agent/app.py`
- [Research Orchestrator](https://github.com/and3m/genai-for-analysts/blob/main/06-research-agent/agent.py): `06-research-agent/agent.py`

### Fine-Tuning

- [Dataset Preparation](https://github.com/and3m/genai-for-analysts/blob/main/07-fine-tuned-classifier/prepare_data.py): `07-fine-tuned-classifier/prepare_data.py`
- [Model Training](https://github.com/and3m/genai-for-analysts/blob/main/07-fine-tuned-classifier/train.py): `07-fine-tuned-classifier/train.py`
- [Text Classification](https://github.com/and3m/genai-for-analysts/blob/main/07-fine-tuned-classifier/inference.py): `07-fine-tuned-classifier/inference.py`

### Evaluation & Safety

- [RAG Evaluation Runner](https://github.com/and3m/genai-for-analysts/blob/main/08-rag-eval-dashboard/eval_runner.py): `08-rag-eval-dashboard/eval_runner.py`
- [Evaluation Dashboard](https://github.com/and3m/genai-for-analysts/blob/main/08-rag-eval-dashboard/app.py): `08-rag-eval-dashboard/app.py`
- [Guardrailed Chatbot UI](https://github.com/and3m/genai-for-analysts/blob/main/09-guardrailed-chatbot/app.py): `09-guardrailed-chatbot/app.py`
- [Input & Output Guardrails](https://github.com/and3m/genai-for-analysts/blob/main/09-guardrailed-chatbot/guardrails.py): `09-guardrailed-chatbot/guardrails.py`
- [Audit Logging](https://github.com/and3m/genai-for-analysts/blob/main/09-guardrailed-chatbot/audit_logger.py): `09-guardrailed-chatbot/audit_logger.py`

### Document Intelligence

- [Invoice Intelligence UI](https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/app.py): `10-document-intelligence/app.py`
- [Vision Extraction](https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/extractor.py): `10-document-intelligence/extractor.py`
- [Invoice Validation Models](https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/models.py): `10-document-intelligence/models.py`
- [Invoice Storage](https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/storage.py): `10-document-intelligence/storage.py`
- [Invoice Records DB](https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/storage.py): `10-document-intelligence/storage.py`
- [Excel Export](https://github.com/and3m/genai-for-analysts/blob/main/10-document-intelligence/storage.py): `10-document-intelligence/storage.py`

### Other components

- **Business User**
- **Anthropic Claude**
- **Tavily Search**
- **OpenAI Metrics**

## Connections

- Business User → Narrator UI: uploads data
- Narrator UI → Dataset Analysis: loads and summarizes (evidence: `01-report-narrator/app.py`)
- Narrator UI → Narrative Generation: requests narrative (evidence: `01-report-narrator/app.py`)
- Narrative Generation → Anthropic Claude: generates text
- Business User → Prompt Playground: selects task (evidence: `02-prompt-playground/app.py`)
- Prompt Playground → Prompt Techniques: runs comparisons (evidence: `02-prompt-playground/app.py`)
- Prompt Techniques → Anthropic Claude: runs prompts
- Business User → Policy Q&A UI: asks policy question
- Policy Q&A UI → Policy Retrieval: retrieves context (evidence: `03-policy-qa-rag/app.py`)
- Policy Q&A UI → Anthropic Claude: generates cited answer (evidence: `03-policy-qa-rag/app.py`)
- Policy Ingestion → Policy Retrieval: builds vector store
- Business User → Financial Analyst UI: asks report question
- Financial Analyst UI → Financial Retrieval: retrieves excerpts (evidence: `04-financial-report-rag/app.py`)
- Financial Analyst UI → Anthropic Claude: answers with citations (evidence: `04-financial-report-rag/app.py`)
- Financial PDF Ingestion → Financial Retrieval: indexes reports
- Business User → Data Analyst UI: asks data question
- Data Analyst UI → Analysis Agent: runs analysis (evidence: `05-data-analyst-agent/app.py`)
- Analysis Agent → Sample Sales Database: queries data
- Business User → Research Agent UI: submits question (evidence: `06-research-agent/app.py`)
- Research Agent UI → Research Orchestrator: runs research (evidence: `06-research-agent/app.py`)
- Research Orchestrator → Tavily Search: searches web (evidence: `06-research-agent/agent.py`)
- Research Orchestrator → Anthropic Claude: plans and compiles (evidence: `06-research-agent/agent.py`)
- Business User → Dataset Preparation: provides dataset
- Dataset Preparation → Model Training: prepares training data
- Model Training → Text Classification: produces model
- Business User → Text Classification: submits text
- Business User → RAG Evaluation Runner: provides questions
- RAG Evaluation Runner → OpenAI Metrics: scores metrics
- RAG Evaluation Runner → Evaluation Dashboard: supplies results
- Business User → Guardrailed Chatbot UI: asks HR question (evidence: `09-guardrailed-chatbot/app.py`)
- Guardrailed Chatbot UI → Input & Output Guardrails: checks and validates (evidence: `09-guardrailed-chatbot/app.py`)
- Guardrailed Chatbot UI → Anthropic Claude: requests response (evidence: `09-guardrailed-chatbot/app.py`)
- Guardrailed Chatbot UI → Audit Logging: records interaction (evidence: `09-guardrailed-chatbot/app.py`)
- Business User → Invoice Intelligence UI: uploads invoice
- Invoice Intelligence UI → Vision Extraction: extracts fields (evidence: `10-document-intelligence/app.py`)
- Vision Extraction → Anthropic Claude: uses vision model
- Vision Extraction → Invoice Validation Models: validates extraction (evidence: `10-document-intelligence/extractor.py`)
- Invoice Intelligence UI → Invoice Storage: saves and exports (evidence: `10-document-intelligence/app.py`)
- Invoice Storage → Invoice Validation Models: stores validated invoice (evidence: `10-document-intelligence/storage.py`)
- Invoice Storage → Invoice Records DB: reads and writes (evidence: `10-document-intelligence/storage.py`)
- Invoice Storage → Excel Export: exports records (evidence: `10-document-intelligence/storage.py`)
