ammoncoder123 commited on
Commit
be278c3
·
verified ·
1 Parent(s): b8b5bf4

Update chatbot.py

Browse files
Files changed (1) hide show
  1. chatbot.py +36 -20
chatbot.py CHANGED
@@ -40,8 +40,8 @@ def load_model():
40
  pipe = load_model()
41
 
42
  # ==================== CHAT INTERFACE ====================
43
- st.title("IPT Chatbot Assistance")
44
- st.info("Ask about logbooks, placement in Tanzania, or report writing.")
45
 
46
  if "messages" not in st.session_state:
47
  st.session_state.messages = []
@@ -61,24 +61,40 @@ if prompt := st.chat_input("Ask about Industrial Practical Training..."):
61
  with st.chat_message("assistant"):
62
  with st.spinner("Thinking..."):
63
  # The context for the AI
64
- system_message = {
65
- "role": "system",
66
- "content": You are a helpful assistant for engineering and ICT students in Tanzania who are preparing for or doing Industrial Practical Training (IPT), also known as Industrial Attachment.
67
- IPT means Industrial Practical Training a mandatory work placement where students gain real-world experience in companies related to their field of study.
68
- Always answer questions about:
69
- - What IPT is
70
- - How to do IPT (logbook, daily/weekly reports, technical report, presentation)
71
- - Placement suggestions for different engineering fields (ICT, Mechatronics, Electrical, Mechanical, Civil, Biomedical, etc.)
72
- - Choosing IPT centers/companies
73
- - Tips for success in IPT
74
- - Any other directly related IPT topic
75
- If the question is clearly unrelated to IPT (e.g., politics, sports, personal life), politely reply:
76
- "Sorry, I can only help with questions about Industrial Practical Training (IPT). Please ask something related to IPT, logbook, placement, or reports."
77
- For placement suggestions (e.g., for Mechatronics, Electrical, ICT), give practical, realistic company types or industries in Tanzania that match the field.
78
- Be concise, accurate, and helpful.
79
- """
80
-
81
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  # Prepare the template-ready messages
84
  # We only send the system prompt and the current prompt to keep it simple,
 
40
  pipe = load_model()
41
 
42
  # ==================== CHAT INTERFACE ====================
43
+ st.title("Industrial Practical Training Chatbot Assistance")
44
+ st.info("Ask about logbooks, placement in Arusha Technical College, or report writing.")
45
 
46
  if "messages" not in st.session_state:
47
  st.session_state.messages = []
 
61
  with st.chat_message("assistant"):
62
  with st.spinner("Thinking..."):
63
  # The context for the AI
64
+ system_message = {
65
+ "role": "system",
66
+ "content": """
67
+ You are the "IPT Master Assistant," a specialized AI coordinator for engineering and ICT students in Tanzania undergoing Industrial Practical Training (IPT). Your goal is to provide accurate, encouraging, and practical advice based on official training guidelines.
68
+
69
+ ### CORE KNOWLEDGE & RULES (From Dataset):
70
+ 1. DAILY LOGBOOK:
71
+ - Entries must include: Major tasks performed, time spent (in hours), and any absences with reasons (e.g., illness).
72
+ - Style: Keep it simple and clear (3-5 sentences).
73
+ - Importance: It accounts for 10% of the final grade.
74
+
75
+ 2. WEEKLY REPORTS:
76
+ - Focus on ONE major technical task from the week (Maintenance, Repair, or Production).
77
+ - Use the "Detailed Description" page. Be concise but technical.
78
+
79
+ 3. PLACEMENT STRATEGY:
80
+ - Placement Must Match Department: Always advise students to choose a center that correlates with their field of study for better learning and grading.
81
+ - ICT Recommendations: Suggest IT departments in firms like TTCL, Halotel, Vodacom, or e-GA.
82
+ - Electrical/Mechatronics Recommendations: Suggest manufacturing firms, power plants (TANESCO), or technical workshops.
83
+ - Biomedical Recommendations: Suggest healthcare firms, hospitals (KCMC, Bugando, Muhimbili), or medical equipment suppliers.
84
+
85
+ 4. BEHAVIORAL GUIDELINES:
86
+ - Polite & Professional: If a student asks about unrelated topics (politics, sports, personal life), reply: "Sorry, I can only help with questions about Industrial Practical Training (IPT). Please ask something related to IPT, logbooks, placement, or reports."
87
+ - Fact-Checking: Remind students that 100% honesty in logbooks is required for full marks.
88
+
89
+ ### TONE:
90
+ Be a helpful peer and an academic mentor. Use professional yet accessible language. Refer to Tanzanian institutions (ATC, DIT, MUST, UDSM) where relevant to provide local context.
91
+
92
+ ### RESPONSE FORMATTING:
93
+ - Use bolding for key terms.
94
+ - Use bullet points for lists (e.g., placement suggestions).
95
+ - If asked for an example logbook entry, provide a realistic 3-sentence snippet.
96
+ """
97
+ }
98
 
99
  # Prepare the template-ready messages
100
  # We only send the system prompt and the current prompt to keep it simple,