-
Notifications
You must be signed in to change notification settings - Fork 0
/
prompt.txt
99 lines (76 loc) · 6.36 KB
/
prompt.txt
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
You have been given an image with some mathematical expressions, equations, or graphical problems, and you need to solve them.
Note: Use the PEMDAS rule for solving mathematical expressions. PEMDAS stands for the Priority Order: Parentheses, Exponents, Multiplication and Division (from left to right), Addition and Subtraction (from left to right). Parentheses have the highest priority, followed by Exponents, then Multiplication and Division, and lastly Addition and Subtraction.
For example:
Q. 2 + 3 * 4 (3 * 4) => 12, 2 + 12 = 14.
Q. 2 + 3 + 5 * 4 - 8 / 2 5 * 4 => 20, 8 / 2 => 4, 2 + 3 => 5, 5 + 20 => 25, 25 - 4 => 21.
You can have five types of equations/expressions in this image, and only one case shall apply every time:
Following are the cases:
1. Simple mathematical expressions like 2 + 2, 3 * 4, 5 / 6, 7 - 8, etc.: In this case, solve and return the answer as JSON:
{
"type": "simple_expression",
"expression": "given expression",
"result": "calculated answer"
}
2. Set of equations like x^2 + 2x + 1 = 0, 3y + 4x = 0, 5x^2 + 6y + 7 = 12, etc.: In this case, solve for the given variables, and return them as JSON:
{
"type": "set_of_equations",
"variables": [
{"variable": "x", "result": "calculated value"},
{"variable": "y", "result": "calculated value"}
]
}
3. Assigning values to variables like x = 4, y = 5, z = 6, etc.: In this case, assign values to variables and return them as JSON:
{
"type": "variable_assignment",
"assignments": [
{"variable": "x", "value": "assigned value"},
{"variable": "y", "value": "assigned value"}
]
}
4. Analyzing graphical math problems, such as cars colliding, trigonometric problems, problems on the Pythagorean theorem, adding runs from a cricket wagon wheel, etc.: In this case, analyze the drawing and accompanying information, and return the solution as JSON:
{
"type": "graphical_math_problem",
"problem": "description of the problem",
"result": "calculated answer"
}
5. Detecting abstract concepts represented in a drawing, such as love, hate, jealousy, patriotism, or a historic reference to war, invention, discovery, quote, etc.: In this case, return the abstract concept as JSON:
{
"type": "abstract_concept",
"description": "explanation of the drawing",
"concept": "detected abstract concept"
}
Analyze the equation or expression in this image and return the answer according to the given rules.
Make sure to use extra backslashes for escape characters like \f -> \f, \n -> \n, etc.
Here is a JSON object containing user-assigned variables. If the given expression has any of these variables, use their actual values from this JSON object:
{a:10,b:10}
Return the answer strictly in the specified JSON format. Ensure proper key-value quoting for easier parsing with JSON parsers. Avoid any markdown or text formatting.
Note : at the place of calculated answer and calculated value only answer to the expression should be present
for example(if x and y is 3 and 4 respectively then) :
{{
"type": "simple_expression",
"expression": "2x+y",
"result": 10
}}
Here is a JSON object containing user-assigned variables. If the given expression has any of these variables, use their actual values from this JSON object:
{dict_of_vars}
(
f"You have been given an image with some mathematical expressions, equations, or graphical problems, and you need to solve them. "
f"Note: Use the PEMDAS rule for solving mathematical expressions. PEMDAS stands for the Priority Order: Parentheses, Exponents, Multiplication and Division (from left to right), Addition and Subtraction (from left to right). Parentheses have the highest priority, followed by Exponents, then Multiplication and Division, and lastly Addition and Subtraction. "
f"For example: "
f"Q. 2 + 3 * 4 "
f"(3 * 4) => 12, 2 + 12 = 14. "
f"Q. 2 + 3 + 5 * 4 - 8 / 2 "
f"5 * 4 => 20, 8 / 2 => 4, 2 + 3 => 5, 5 + 20 => 25, 25 - 4 => 21. "
f"YOU CAN HAVE FIVE TYPES OF EQUATIONS/EXPRESSIONS IN THIS IMAGE, AND ONLY ONE CASE SHALL APPLY EVERY TIME: "
f"Following are the cases: "
f"1. Simple mathematical expressions like 2 + 2, 3 * 4, 5 / 6, 7 - 8, etc.: In this case, solve and return the answer in the format of a LIST OF ONE JSON object [{{'expr': given expression, 'result': calculated answer}}]. "
f"2. Set of Equations like x^2 + 2x + 1 = 0, 3y + 4x = 0, 5x^2 + 6y + 7 = 12, etc.: In this case, solve for the given variable, and the format should be a COMMA SEPARATED LIST OF JSON Object, with obj 1 as {{'expr': 'x', 'result': 2, 'assign': True}} and obj 2 as {{'expr': 'y', 'result': 5, 'assign': True}}. This example assumes x was calculated as 2, and y as 5. Include as many dicts as there are variables. "
f"3. Assigning values to variables like x = 4, y = 5, z = 6, etc.: In this case, assign values to variables and return another key in the json called {{'assign': True}}, keeping the variable as 'expr' and the value as 'result' in the original json object. RETURN AS A LIST OF json objects. "
f"4. Analyzing Graphical Math problems, which are word problems represented in drawing form, such as cars colliding, trigonometric problems, problems on the Pythagorean theorem, adding runs from a cricket wagon wheel, etc. These will have a drawing representing some scenario and accompanying information with the image. PAY CLOSE ATTENTION TO DIFFERENT COLORS FOR THESE PROBLEMS. You need to return the answer in the format of a LIST OF ONE JSON object [{{'expr': given expression, 'result': calculated answer}}]. "
f"5. Detecting Abstract Concepts that a drawing might show, such as love, hate, jealousy, patriotism, or a historic reference to war, invention, discovery, quote, etc. USE THE SAME FORMAT AS OTHERS TO RETURN THE ANSWER, where 'expr' will be the explanation of the drawing, and 'result' will be the abstract concept. "
f"Analyze the equation or expression in this image and return the answer according to the given rules: "
f"Make sure to use extra backslashes for escape characters like \\f -> \\\\f, \\n -> \\\\n, etc. "
f"Here is a dictionary of user-assigned variables. If the given expression has any of these variables, use its actual value from this dictionary accordingly: {dict_of_vars_str}. "
f"DO NOT USE BACKTICKS OR MARKDOWN FORMATTING. "
f"PROPERLY QUOTE THE KEYS AND VALUES IN THE JSON object FOR EASIER PARSING WITH Python's ast.literal_eval."
)