Lumina AI is composed of three Python files and a set of data files that work together to deliver an AI-powered study assistant. Understanding how these pieces connect helps you customize, extend, or retrain the chatbot.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/diazdavilajesus16-stack/IA-LUMINA/llms.txt
Use this file to discover all available pages before exploring further.
Project structure
| File | Role |
|---|---|
Main.py | Streamlit UI, session state, page routing, audio/PDF helpers |
chatbot.py | Neural network inference engine — predict_class, get_response, bag_of_words |
training_chatbot.py | One-time training script that produces the model and vocabulary files |
respuestas.json | Intent knowledge base — tag, patterns, responses arrays |
chatbot_model.h5 | Trained Keras model weights (HDF5 format) |
words.pkl | Serialized vocabulary list |
classes.pkl | Serialized list of intent tag names |
Data flow
When a student sends a message, the following sequence runs:Main.py:send_message()receives the raw text- If a PDF is loaded,
query_pdf()checks for a relevant paragraph first - Otherwise,
Main.py:get_response()callsmatch_intent()— a simple word-overlap scorer used directly in the UI layer match_intent()returns the best-matching intent fromrespuestas.json- A random response from that intent’s
responsesarray is returned - XP and streak are updated via
update_streak_and_xp()
chatbot.py (neural network + keyword fallback) is the more powerful engine designed for production use. Main.py includes its own lightweight match_intent() for simplicity.
Page routing
The sidebar navigation setsst.session_state.current_page to one of these values:
| Page key | Description |
|---|---|
Chat | Main AI chat interface |
Resumen | Topic summary generator |
Materias | Subject browser (redirects to chat panel) |
Quiz | Multiple-choice quiz |
Memorizar | Memory technique tips |
Motivación | Rotating motivational phrases |
Ajustes | Settings (theme, notifications) |
Neural network model
Architecture, training config, and inference pipeline details.
Intent matching
The three-stage cascade: neural net, keyword fallback, and context fallback.
Training the model
How to retrain the Keras model after updating respuestas.json.
Extending intents
Add new topics and responses to the intent knowledge base.