# shashi108/datascience architecture

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

- Interactive diagram: https://gitdiagram.com/shashi108/datascience
- Repository: https://github.com/shashi108/datascience

## Overview

This repository is a portfolio of AI and data-learning examples, not one unified product. Two implemented application workflows are visible in the sampled source: a FastAPI Gemini app that screens prompts and responses, and several LangGraph chatbot variants with memory, SQLite persistence, or tools. The README also advertises PDF/RAG and agentic-AI projects; the tree shows notebooks and examples for these, but their runtime connections were not sampled, so those capabilities are represented as separate documented branches. Edges reflect shown calls or README statements only.

Main entry points: [`GenAI/LLM_Guardrials/app.py`](https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/app.py) (Prompt API), [`GenAI/Lang Graph/chatbot_LLM/backend_sqlite.py`](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend_sqlite.py) (SQLite Chat Graph), [`GenAI/Lang Graph/chatbot_LLM/backend_tools.py`](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend_tools.py) (Search, Finance, Calculator Tools), [`GenAI/Lang Graph/chatbot_LLM/backend.py`](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend.py) (Basic Chat Graph)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guardrails["Guardrails App"]
  node_guard_app["Prompt API<br/>[app.py]"]
  node_input_check["Input Screening<br/>[guardrails.py]"]
  node_gemini["Gemini Service<br/>[gemini_service.py]"]
  node_gemini_config["Gemini Config<br/>[config.py]"]
  node_output_check["Output Screening"]
end

subgraph group_chatbots["LangGraph Chatbots"]
  node_chat_ui["Streamlit Chat UI<br/>[ai_app.py]"]
  node_thread_ui["Threaded Chat UI<br/>[4app_resume.py]"]
  node_sqlite_ui["SQLite Chat UI<br/>[5app_sqlite.py]"]
  node_basic_backend["Basic Chat Graph<br/>[backend.py]"]
  node_sqlite_backend["SQLite Chat Graph<br/>[backend_sqlite.py]"]
  node_tools_backend["Tool Chat Graph<br/>[backend_tools.py]"]
  node_checkpoint_store[("SQLite Checkpoints<br/>[backend_sqlite.py]")]
  node_tools["Search, Finance, Calculator Tools<br/>[backend_tools.py]"]
end

subgraph group_portfolio["AI Portfolio Capabilities"]
  node_rag["PDF RAG Chatbot<br/>[PDF Q&amp;A.ipynb]"]
  node_rag_store[("FAISS Index<br/>[pdf_faiss_index]")]
  node_agent_examples["Agentic AI Examples"]
end

node_user(("User"))
node_local_model["Local Ollama Model"]
node_search_service["DuckDuckGo Search"]
node_stock_service["Alpha Vantage"]

node_user -->|"submits prompt"| node_guard_app
node_guard_app -->|"checks input"| node_input_check
node_guard_app -->|"generates response"| node_gemini
node_gemini -->|"loads settings"| node_gemini_config
node_guard_app -->|"checks output"| node_output_check
node_user -->|"sends message"| node_chat_ui
node_chat_ui -->|"invokes graph"| node_basic_backend
node_thread_ui -->|"streams chat"| node_basic_backend
node_sqlite_ui -->|"streams chat"| node_sqlite_backend
node_basic_backend -->|"invokes model"| node_local_model
node_sqlite_backend -->|"invokes model"| node_local_model
node_sqlite_backend -->|"persists checkpoints"| node_checkpoint_store
node_tools_backend -->|"invokes model"| node_local_model
node_tools_backend -->|"routes tool calls"| node_tools
node_tools -->|"searches web"| node_search_service
node_tools -->|"fetches quotes"| node_stock_service
node_rag -->|"uses vector search"| node_rag_store
node_user -->|"asks PDF questions"| node_rag
node_user -->|"explores workflows"| node_agent_examples

click node_guard_app "https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/app.py"
click node_input_check "https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/guardrails.py"
click node_gemini "https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/gemini_service.py"
click node_gemini_config "https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/config.py"
click node_output_check "https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/output_guardrails.py"
click node_chat_ui "https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/ai_app.py"
click node_thread_ui "https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/4app_resume.py"
click node_sqlite_ui "https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/5app_sqlite.py"
click node_basic_backend "https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend.py"
click node_sqlite_backend "https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend_sqlite.py"
click node_tools_backend "https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend_tools.py"
click node_checkpoint_store "https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend_sqlite.py"
click node_tools "https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend_tools.py"
click node_rag "https://github.com/shashi108/datascience/blob/master/GenAI/casestudy/2.Q%26A%20from%20PDF%20document/PDF%20Q%26A.ipynb"
click node_rag_store "https://github.com/shashi108/datascience/tree/master/GenAI/casestudy/2.Q%26A%20from%20PDF%20document/pdf_faiss_index"
click node_agent_examples "https://github.com/shashi108/datascience/tree/master/GenAI/Lang%20Graph/chatbot_LLM"

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_guard_app,node_input_check,node_gemini,node_gemini_config,node_output_check,node_user toneBlue
class node_chat_ui,node_thread_ui,node_sqlite_ui,node_basic_backend,node_sqlite_backend,node_tools_backend,node_checkpoint_store,node_tools toneAmber
class node_rag,node_rag_store,node_agent_examples toneMint
class node_local_model,node_search_service,node_stock_service toneIndigo
```

## Components

### Guardrails App

- [Prompt API](https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/app.py): `GenAI/LLM_Guardrials/app.py`
- [Input Screening](https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/guardrails.py): `GenAI/LLM_Guardrials/guardrails.py`
- [Gemini Service](https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/gemini_service.py): `GenAI/LLM_Guardrials/gemini_service.py`
- [Gemini Config](https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/config.py): `GenAI/LLM_Guardrials/config.py`
- [Output Screening](https://github.com/shashi108/datascience/blob/master/GenAI/LLM_Guardrials/output_guardrails.py): `GenAI/LLM_Guardrials/output_guardrails.py`

### LangGraph Chatbots

- [Streamlit Chat UI](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/ai_app.py): `GenAI/Lang Graph/chatbot_LLM/ai_app.py`
- [Threaded Chat UI](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/4app_resume.py): `GenAI/Lang Graph/chatbot_LLM/4app_resume.py`
- [SQLite Chat UI](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/5app_sqlite.py): `GenAI/Lang Graph/chatbot_LLM/5app_sqlite.py`
- [Basic Chat Graph](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend.py): `GenAI/Lang Graph/chatbot_LLM/backend.py`
- [SQLite Chat Graph](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend_sqlite.py): `GenAI/Lang Graph/chatbot_LLM/backend_sqlite.py`
- [Tool Chat Graph](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend_tools.py): `GenAI/Lang Graph/chatbot_LLM/backend_tools.py`
- [SQLite Checkpoints](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend_sqlite.py): `GenAI/Lang Graph/chatbot_LLM/backend_sqlite.py`
- [Search, Finance, Calculator Tools](https://github.com/shashi108/datascience/blob/master/GenAI/Lang%20Graph/chatbot_LLM/backend_tools.py): `GenAI/Lang Graph/chatbot_LLM/backend_tools.py`

### AI Portfolio Capabilities

- [PDF RAG Chatbot](https://github.com/shashi108/datascience/blob/master/GenAI/casestudy/2.Q%26A%20from%20PDF%20document/PDF%20Q%26A.ipynb): `GenAI/casestudy/2.Q&A from PDF document/PDF Q&A.ipynb`
- [FAISS Index](https://github.com/shashi108/datascience/tree/master/GenAI/casestudy/2.Q%26A%20from%20PDF%20document/pdf_faiss_index): `GenAI/casestudy/2.Q&A from PDF document/pdf_faiss_index`
- [Agentic AI Examples](https://github.com/shashi108/datascience/tree/master/GenAI/Lang%20Graph/chatbot_LLM): `GenAI/Lang Graph/chatbot_LLM`

### Other components

- **User**
- **Local Ollama Model**
- **DuckDuckGo Search**
- **Alpha Vantage**

## Connections

- User → Prompt API: submits prompt (evidence: `GenAI/LLM_Guardrials/app.py`)
- Prompt API → Input Screening: checks input (evidence: `GenAI/LLM_Guardrials/app.py`)
- Prompt API → Gemini Service: generates response (evidence: `GenAI/LLM_Guardrials/app.py`)
- Gemini Service → Gemini Config: loads settings (evidence: `GenAI/LLM_Guardrials/gemini_service.py`)
- Prompt API → Output Screening: checks output (evidence: `GenAI/LLM_Guardrials/app.py`)
- User → Streamlit Chat UI: sends message (evidence: `GenAI/Lang Graph/chatbot_LLM/ai_app.py`)
- Streamlit Chat UI → Basic Chat Graph: invokes graph (evidence: `GenAI/Lang Graph/chatbot_LLM/ai_app.py`)
- Threaded Chat UI → Basic Chat Graph: streams chat (evidence: `GenAI/Lang Graph/chatbot_LLM/4app_resume.py`)
- SQLite Chat UI → SQLite Chat Graph: streams chat (evidence: `GenAI/Lang Graph/chatbot_LLM/5app_sqlite.py`)
- Basic Chat Graph → Local Ollama Model: invokes model (evidence: `GenAI/Lang Graph/chatbot_LLM/backend.py`)
- SQLite Chat Graph → Local Ollama Model: invokes model (evidence: `GenAI/Lang Graph/chatbot_LLM/backend_sqlite.py`)
- SQLite Chat Graph → SQLite Checkpoints: persists checkpoints (evidence: `GenAI/Lang Graph/chatbot_LLM/backend_sqlite.py`)
- Tool Chat Graph → Local Ollama Model: invokes model (evidence: `GenAI/Lang Graph/chatbot_LLM/backend_tools.py`)
- Tool Chat Graph → Search, Finance, Calculator Tools: routes tool calls (evidence: `GenAI/Lang Graph/chatbot_LLM/backend_tools.py`)
- Search, Finance, Calculator Tools → DuckDuckGo Search: searches web (evidence: `GenAI/Lang Graph/chatbot_LLM/backend_tools.py`)
- Search, Finance, Calculator Tools → Alpha Vantage: fetches quotes (evidence: `GenAI/Lang Graph/chatbot_LLM/backend_tools.py`)
- PDF RAG Chatbot → FAISS Index: uses vector search (evidence: `README.md`)
- User → PDF RAG Chatbot: asks PDF questions (evidence: `README.md`)
- User → Agentic AI Examples: explores workflows (evidence: `README.md`)
