How sarth28/jlpt-grammar-chatbot works
Sensei-AI lets a student ask a JLPT grammar question in a Streamlit chat, retrieves a matching grammar point from MySQL-backed data using sentence embeddings, and asks a language model to explain it. The main.py module also loads the dataset into MySQL at startup and precomputes embeddings for retrieval. The README documents the frontend/backend split, database, semantic search, and environment configuration. The dataset and external services are not included in the tree; relationships shown here are limited to the supplied source and README.
Main entry points: main.py Ask endpoint · app.py Streamlit chat
Components 10
Chat interface
- Streamlit chat
app.py
Tutoring backend
- Ask endpoint
main.py - Response generation
main.py - Environment config
Grammar data and retrieval
- Grammar retrieval
main.py - Sentence encoder
main.py - JLPT dataset
- MySQL grammar table
main.py
Other components
- Student
- Groq language model
Connections 10
- Student → Streamlit chat: asks
app.py - Streamlit chat → Ask endpoint: requests
app.py - Ask endpoint → Grammar retrieval: retrieves
main.py - Grammar retrieval → Sentence encoder: encodes and ranks
main.py - Grammar retrieval → MySQL grammar table: reads grammar
main.py - JLPT dataset → MySQL grammar table: loads into
main.py - Ask endpoint → Response generation: generates answer
main.py - Response generation → Groq language model: requests completion
main.py - Environment config → Response generation: configures key
main.py - Ask endpoint → Streamlit chat: returns answer
app.py