ammoncoder123 commited on
Commit
523e8fd
·
verified ·
1 Parent(s): 1dd0272

Update chatbot.py

Browse files
Files changed (1) hide show
  1. chatbot.py +8 -7
chatbot.py CHANGED
@@ -41,7 +41,7 @@ pipe = load_model()
41
  # ==================== CHAT INTERFACE ====================
42
  st.title("IPTCHATBOT ASSISTANCE")
43
 
44
- st.info("Small fine-tuned model (1.7B). Answers may vary verify facts.")
45
 
46
  if "messages" not in st.session_state:
47
  st.session_state.messages = []
@@ -52,7 +52,7 @@ for message in st.session_state.messages:
52
 
53
  # ... (model loading code above remains unchanged)
54
 
55
- if prompt := st.chat_input("Ask about IPT, ICT, or anything..."):
56
  st.session_state.messages.append({"role": "user", "content": prompt})
57
  with st.chat_message("user"):
58
  st.markdown(prompt)
@@ -60,11 +60,12 @@ if prompt := st.chat_input("Ask about IPT, ICT, or anything..."):
60
  with st.chat_message("assistant"):
61
  with st.spinner("Thinking..."):
62
  # Define the system prompt here
63
- system_prompt = """
64
- You are a knowledgeable assistant for ICT and engineering students in Tanzania.
65
- IPT means Industrial Practical Training (Industrial Attachment) a mandatory work placement for students to gain real-world experience.
66
- Always use this correct meaning unless the context clearly means something else.
67
- If unsure, say: "In most educational contexts in Tanzania, IPT stands for Industrial Practical Training."
 
68
  """
69
 
70
  # Build messages with system prompt first
 
41
  # ==================== CHAT INTERFACE ====================
42
  st.title("IPTCHATBOT ASSISTANCE")
43
 
44
+ st.info(" Answers may vary verify facts.")
45
 
46
  if "messages" not in st.session_state:
47
  st.session_state.messages = []
 
52
 
53
  # ... (model loading code above remains unchanged)
54
 
55
+ if prompt := st.chat_input("Ask about Industrial Practical Training..."):
56
  st.session_state.messages.append({"role": "user", "content": prompt})
57
  with st.chat_message("user"):
58
  st.markdown(prompt)
 
60
  with st.chat_message("assistant"):
61
  with st.spinner("Thinking..."):
62
  # Define the system prompt here
63
+ system_prompt = system_prompt = """
64
+ You are a helpful assistant ONLY for questions about Industrial Practical Training (IPT) in Tanzania.
65
+ IPT means Industrial Practical Training (Industrial Attachment) a mandatory work placement for students to gain real-world experience.
66
+ Always use this correct meaning.
67
+ If the question is not about IPT, logbooks, reports, placement, or related topics, reply exactly:
68
+ "Sorry, I can only answer questions about Industrial Practical Training (IPT). Please ask something related."
69
  """
70
 
71
  # Build messages with system prompt first