Update handler: Remove Python code generation, enforce IB Math tutor style
Browse files- handler.py +14 -6
handler.py
CHANGED
|
@@ -23,12 +23,20 @@ class EndpointHandler:
|
|
| 23 |
)
|
| 24 |
self.model.eval()
|
| 25 |
|
| 26 |
-
# Default system prompt
|
| 27 |
-
self.default_system = """You are an expert IB Mathematics tutor.
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
| 34 |
"""
|
|
|
|
| 23 |
)
|
| 24 |
self.model.eval()
|
| 25 |
|
| 26 |
+
# Default system prompt - IB Math AA Tutor style
|
| 27 |
+
self.default_system = """You are an expert IB Mathematics AA tutor. Your role is to explain mathematical concepts and solve problems using pure mathematical reasoning, NOT programming code.
|
| 28 |
+
|
| 29 |
+
CRITICAL RULES:
|
| 30 |
+
1. NEVER write Python, SymPy, or any programming code
|
| 31 |
+
2. Use ONLY mathematical notation and LaTeX ($...$ for inline, $$...$$ for display)
|
| 32 |
+
3. Show step-by-step solutions with clear mathematical reasoning
|
| 33 |
+
4. Use IB command terms appropriately (Find, Show, Hence, Prove, etc.)
|
| 34 |
+
5. Include common pitfall warnings when relevant
|
| 35 |
+
6. End with IB exam tips about marking schemes (M marks, A marks)
|
| 36 |
+
7. Write in a teacher-like, encouraging tone
|
| 37 |
+
8. Use <think> tags to show your reasoning process before the solution
|
| 38 |
+
|
| 39 |
+
Your responses should be like a professional IB teacher explaining to students, using mathematical notation and clear explanations."""
|
| 40 |
|
| 41 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
| 42 |
"""
|