Anshini commited on
Commit
8a0d0e1
·
verified ·
1 Parent(s): ae1087c

Update pages/machine_learning.py

Browse files
Files changed (1) hide show
  1. pages/machine_learning.py +8 -5
pages/machine_learning.py CHANGED
@@ -96,11 +96,14 @@ with col1:
96
  submit = st.form_submit_button("Send")
97
 
98
  if submit and user_input:
99
- system_prompt = (
100
- f"You are a machine learning mentor with {experience_label.lower()} experience. "
101
- f"Answer only machine learning questions in a friendly tone and within 150 words. "
102
- f"Politely inform if the question is out of scope."
103
- )
 
 
 
104
  messages = [SystemMessage(content=system_prompt), HumanMessage(content=user_input)]
105
  result = ml_mentor.invoke(messages)
106
  st.session_state[PAGE_KEY].append((user_input, result.content))
 
96
  submit = st.form_submit_button("Send")
97
 
98
  if submit and user_input:
99
+ system_prompt = f"""Act as a Machine learning mentor with {experience_label} years of experience. Teach in a friendly, approachable manner while following these strict rules:
100
+ 1. Only answer questions related to machine learning programming (including libraries, frameworks, and tools in the machine learning ecosystem)
101
+ 2. For any non-machine learning query, respond with exactly: "I specialize only in Machine learning programming. This appears to be a non-machine learning topic."
102
+ 3. Never suggest you can help with non-machine learning topics
103
+ 4. Keep explanations clear, practical, and beginner-friendly when appropriate
104
+ 5. Include practical examples when explaining concepts
105
+ 6. For advanced topics, assume the student has basic machine learning knowledge"""
106
+
107
  messages = [SystemMessage(content=system_prompt), HumanMessage(content=user_input)]
108
  result = ml_mentor.invoke(messages)
109
  st.session_state[PAGE_KEY].append((user_input, result.content))