# pik1989/text-to-sql-chatbot architecture

> Architecture diagram of the GitHub repository pik1989/text-to-sql-chatbot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pik1989/text-to-sql-chatbot
- Repository: https://github.com/pik1989/text-to-sql-chatbot

## Overview

This repository is a notebook-based natural-language-to-SQL chatbot. Its documented workflow takes a user question, uses an LLM chain to produce SQL, queries MySQL, and formats results in natural language. The README also describes loading source data into MySQL and evaluating chatbot quality; notebook filenames suggest related implementations, but their contents were not available to verify. The graph therefore shows only documented relationships, not inferred notebook internals.

Main entry points: [`Gemini Chatbot.ipynb`](https://github.com/pik1989/text-to-sql-chatbot/blob/main/Gemini%20Chatbot.ipynb) (Text-to-SQL chatbot), [`Data_CSV`](https://github.com/pik1989/text-to-sql-chatbot/tree/main/Data_CSV) (Sales CSV data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_query["Query workflow"]
  node_chatbot["Text-to-SQL chatbot"]
  node_llm["LLM chain"]
  node_parser["Output parser"]
end

subgraph group_data["Data and storage"]
  node_source_data["Sales CSV data"]
  node_mysql[("MySQL database")]
end

subgraph group_evaluation["Evaluation"]
  node_evaluation["Chatbot evaluation"]
end

node_user(("Chat user"))

node_user -->|"asks question"| node_chatbot
node_chatbot -->|"converts question"| node_llm
node_llm -->|"queries database"| node_mysql
node_mysql -->|"returns results"| node_parser
node_parser -->|"formats response"| node_user
node_source_data -->|"loads data"| node_mysql

click node_chatbot "https://github.com/pik1989/text-to-sql-chatbot/blob/main/Gemini%20Chatbot.ipynb"
click node_llm "https://github.com/pik1989/text-to-sql-chatbot/blob/main/Gemini%20Chatbot.ipynb"
click node_parser "https://github.com/pik1989/text-to-sql-chatbot/blob/main/Gemini%20Chatbot.ipynb"
click node_source_data "https://github.com/pik1989/text-to-sql-chatbot/tree/main/Data_CSV"
click node_evaluation "https://github.com/pik1989/text-to-sql-chatbot/blob/main/Gemini%20Chatbot%20(including%20RAGAS).ipynb"

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_chatbot,node_llm,node_parser,node_user toneBlue
class node_source_data,node_mysql toneAmber
class node_evaluation toneMint
```

## Components

### Query workflow

- [Text-to-SQL chatbot](https://github.com/pik1989/text-to-sql-chatbot/blob/main/Gemini%20Chatbot.ipynb): `Gemini Chatbot.ipynb`
- [LLM chain](https://github.com/pik1989/text-to-sql-chatbot/blob/main/Gemini%20Chatbot.ipynb): `Gemini Chatbot.ipynb`
- [Output parser](https://github.com/pik1989/text-to-sql-chatbot/blob/main/Gemini%20Chatbot.ipynb): `Gemini Chatbot.ipynb`

### Data and storage

- [Sales CSV data](https://github.com/pik1989/text-to-sql-chatbot/tree/main/Data_CSV): `Data_CSV`
- **MySQL database**

### Evaluation

- [Chatbot evaluation](https://github.com/pik1989/text-to-sql-chatbot/blob/main/Gemini%20Chatbot%20(including%20RAGAS).ipynb): `Gemini Chatbot (including RAGAS).ipynb`

### Other components

- **Chat user**

## Connections

- Chat user → Text-to-SQL chatbot: asks question (evidence: `README.md`)
- Text-to-SQL chatbot → LLM chain: converts question (evidence: `README.md`)
- LLM chain → MySQL database: queries database (evidence: `README.md`)
- MySQL database → Output parser: returns results (evidence: `README.md`)
- Output parser → Chat user: formats response (evidence: `README.md`)
- Sales CSV data → MySQL database: loads data (evidence: `README.md`)
