File size: 4,227 Bytes
95f6d5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4ed309e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95f6d5d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
"""Default prompts"""

DESCRIPTION_INSTRUCTION = """Generate a short description for the topic {subtopic} in the area of {topic}. 

Your goal is to generate a short, concise, well-structured description to the topic.

It will be used to used as query in retrieval and / or web-search

Keep the description concise and limited to one or two sentences.
"""

QUESTION_INSTRUCTION = """As a teacher creating a quiz question on the topic of {subtopic} within the field of {topic}, your task is to analyze the context, review relevant questions, and craft a question that meets the following criteria:

Type: The question should be conceptual and/or technical question, not a factual question.
Relevance: The question must be related to the specified topic and subtopic.
Similarity: If relevant questions are provided, your question should be similar to them.
Difficulty: Ensure that the question aligns with the stated difficulty level and is of similar complexity to the provided questions.
Clarity: The question should be straightforward and concise.
Uniqueness: Your question should be distinctive and not a direct replica of the relevant questions, although you can modify parameters and numbers from them.

Examine any feedback provided and adjust your question accordingly.
{feedback}

List of relevant questions:
{relevant_questions}

Difficulty Level: {difficulty}

Format your question in markdown syntax (e.g., **bold**, `code`, or *italic* for emphasis). 
**Do NOT include:** 
- Backticks (```) or code blocks 
- Prefixes like "Question:" 
- Any extra text beyond the question itself.

Example of valid formatting:
What is value $x$ if $\sqrt{{3x-1}} + (1+x)^2 = 13$ 
"""


STEP_INSTRUCTION = """
You are a helpful math tutor. Given the following math question, break it down into clear, logical steps needed to solve it. 

Guidelines:
- Write each step as a **concise string** in a numbered list.
- If a step requires a **precise calculation** (e.g., solving an equation, evaluating an expression), end the step with: **(Calculation needed)**
- Do **not perform any calculations** or write code.

Example Output:
[
"Step 1: Step 1: Define variables",
"Step 2: Simplify the equation.",
"Step 3: Solve the simplified equation for x. (Calculation needed)",
"Step 4: Verify the solution."
]

Question: {question}

Respond with a Python list of strings.
"""


TOOL_INSTRUCTION = """
You are a math assistant. Given the problem and the step-by-step plan, review each step to determine if it needs an exact calculation.

For steps needing calculation:
- Generate Python code using **SymPy**.
- Always assign the final value to a variable named `result`.
- Always include **print(result)** at the end.
- Provide a clear description of what the code does.

Only generate code **aligned with the step** requiring it.

Problem: {question}
Steps: {steps}

Respond in JSON with key 'tool_requests' as a list of objects:
[
{{"code": "Python code here", "description": "What it calculates"}}
]

If no step needs calculation, return an empty list.
"""

VERIFICATION_INSTRUCTION = """
You are a math tutor. Review the following problem-solving steps and the results of calculations.

Question: {question}
Steps: {steps}
Tool Results: {tool_results}

Check if the steps and results are mathematically correct and consistent.
"""


FINALIZE_INSTRUCTION = """
You are a math tutor, and your task is to produce a clear and concise Markdown solution for math problems. Follow these instructions carefully:

1. Provide a detailed, step-by-step solution.
2. Present the final answer clearly, either boxed or highlighted.
3. **All mathematical expressions MUST be enclosed in dollar signs only:**
   - For inline math, use a single pair of dollar signs (e.g., `$x^2$`).
   - For display math, use double dollar signs on their own lines (e.g.,
     ```
     $$x^2$$
     ```).
   - **Do NOT use any other LaTeX environments (e.g., do not use `\\(`, `\\[`, or similar).**
4. Strictly follow these formatting rules for every mathematical expression.

Use the following placeholders in your solution:
- **Question:** {question}
- **Steps:** {steps}
- **Tool Results:** {tool_results}
- **Verified:** {verified}

Respond in Markdown format only.
"""