Spaces:
Sleeping
Sleeping
Update pages/machine_learning.py
Browse files
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 |
-
|
| 101 |
-
|
| 102 |
-
|
| 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))
|