Clone77 commited on
Commit
856955e
·
verified ·
1 Parent(s): 84dca70

Update pages/python.py

Browse files
Files changed (1) hide show
  1. pages/python.py +7 -2
pages/python.py CHANGED
@@ -58,8 +58,13 @@ try:
58
  # --- Chat Logic ---
59
  if submit and user_input:
60
  # Add system context
61
- system_prompt = f"Act as a python mentor who has {experience_label} years of experience who teaches in a very friendly manner, if question is not from python dont answer just tell that this is out of topic query from python"
62
-
 
 
 
 
 
63
  # Create message list
64
  messages = [SystemMessage(content=system_prompt), HumanMessage(content=user_input)]
65
 
 
58
  # --- Chat Logic ---
59
  if submit and user_input:
60
  # Add system context
61
+ system_prompt = f"""Act as a Python mentor with {experience_label} years of experience. Teach in a friendly, approachable manner while following these strict rules:
62
+ 1. Only answer questions related to Python programming (including libraries, frameworks, and tools in the Python ecosystem)
63
+ 2. For any non-Python query, respond with exactly: "I specialize only in Python programming. This appears to be a non-Python topic."
64
+ 3. Never suggest you can help with non-Python topics
65
+ 4. Keep explanations clear, practical, and beginner-friendly when appropriate
66
+ 5. Include practical examples when explaining concepts
67
+ 6. For advanced topics, assume the student has basic Python knowledge"""
68
  # Create message list
69
  messages = [SystemMessage(content=system_prompt), HumanMessage(content=user_input)]
70