ECE-BOT provides three dedicated hardware assistants — MELFA, PLC, and CNC — each trained on a curated set of question-and-answer patterns specific to that machine type. When a question closely matches known patterns, the chatbot replies instantly from its trained data. When it does not, Google Gemini generates a contextual response using the hardware’s description as a system prompt.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Kr-Yogsa/ECE-BOT/llms.txt
Use this file to discover all available pages before exploring further.
Hardware assistants
Each assistant is defined indata/hardware_config.json and backed by its own JSON data file in the data/ directory.
| Assistant | Hardware type | Data file |
|---|---|---|
| MELFA | Mitsubishi MELFA industrial robots | data/melfa.json |
| PLC | Programmable logic controllers | data/plc.json |
| CNC | CNC machining centres | data/cnc.json |
How the intent model works
ECE-BOT trains one model per hardware assistant at startup. Each model is a scikit-learn pipeline composed of a TF-IDF vectorizer followed by a Random Forest classifier with 100 estimators.Load training data
ECE-BOT reads the JSON data file for each hardware assistant (for example,
data/melfa.json). Each file contains a list of intents. Every intent has a tag, a list of patterns (example questions), and a list of responses.melfa.json (excerpt)
Train TF-IDF + Random Forest pipeline
All patterns for a hardware assistant are fed into a
TfidfVectorizer and a RandomForestClassifier inside a single scikit-learn Pipeline. The classifier maps each pattern to its intent tag. A minimum of two distinct intent classes is required; hardware data files with fewer classes are skipped.Classify incoming messages
When a user sends a message, the trained model returns a probability distribution across all known intent tags. The tag with the highest probability is selected as the predicted intent, along with its confidence score.Before the classifier runs, the message is checked against an exact-pattern lookup. If the normalized message matches a stored pattern exactly, the corresponding response is returned immediately with a confidence of
1.0, bypassing the classifier.Apply the confidence threshold
The predicted confidence is compared against the threshold of
0.75.- Confidence ≥ 0.75 — the predefined response for that intent is returned directly.
- Confidence < 0.75 — the message is forwarded to Gemini for a generated response.
response_source (intent_model or LLM) and the raw confidence score, so you can audit the model’s performance over time.Gemini fallback
When the intent model’s confidence falls below 0.75, ECE-BOT calls Google Gemini with the hardware’s name and context description as a system prompt. For CNC questions, a dedicated CNC-specific handler is tried first; if it returns a transient error, the generic handler is used as a backup. The Gemini response is generated with the full conversation history so multi-turn follow-up questions work correctly.The Gemini fallback requires a valid
GEMINI_API_KEY in your environment. If the key is missing or the API is temporarily unavailable, ECE-BOT returns a user-facing error message rather than an empty reply.Chat sessions
Every conversation is saved to PostgreSQL and tied to both a user and a hardware assistant.- Session title — automatically generated from the first user message by stripping stop words and picking up to three meaningful words. For example, “How do I reset a MELFA alarm?” becomes “MELFA Reset Alarm”.
- Session history — the sidebar lists all previous sessions for the current user. Clicking a session restores the full conversation.
- Hardware ID — each session stores the
hardware_id(melfa,plc, orcnc) so the correct model is loaded when the session is resumed. - Messages — each message row stores the role (
userorassistant), the content, theresponse_source, and the confidence score.