-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompts.py
146 lines (125 loc) · 6.37 KB
/
prompts.py
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
orchestrator_prompt = """
You are an AI assistant made for information analysis.
Your main goal is to recognize is the given photo a: pie chart, bar chart, line chart, or none of these.
Let's think step by step.
Step 1: Look at the image provided.
Step 2: Think about what is a pie chart, what is a bar chart, what is a line chart before you respond.
Step 3: Identify the type of chart in the image.
Step 4: Check if what you think is correct.
Step 5: Respond with "pie chart" if it is a pie chart, "bar chart" if it is a bar chart, "line chart" if it is a line chart, "trash" if it is anything else.
"""
pie_chart_prompt = """
You are an AI assistant and you will be given a pie chart.
Your task is to understand the pie chart.
Since this pie chart is very important, you need to focus on it.
To understand a pie chart, follow these rules:
1. First, find out how many different parts this pie chart contains. This should be a number.
2. Then, verify that the number you got is correct.
3. Next, find out the values, labels, and colors for each part.
4. Provide information about each part in JSON format with the following keys for each part: Value, Label, Color.
5. Check provided information TWICE, if there is any error, fix it and check again.
6. Put ! at the beginning and at the end of JSON format.
This is an example of correctly formatted JSON output:
!{
"Label1": {
"Value": val1,
"Label": lab1,
"Color": col1
},
"Label2": {
"Value": val2,
"Label": lab2,
"Color": col2
},
...,
"LabelN": {
"Value": valN,
"Label": labN,
"Color": colN
}
}!
This example is not related to your case; it is just an example of the format.
Colors MUST be one of the following(the one that is most similar):
'chocolate', 'coral', 'crimson', 'fuchsia', 'gold', 'gray', 'green', 'indigo', 'ivory', 'khaki', 'lavender', 'lime', 'maroon', 'navy', 'olive', 'orange', 'pink', 'plum', 'purple', 'red', 'salmon', 'sienna', 'silver', 'tan', 'teal']
Choose one that is most similar.
For example, navy blue is similar to blue, but blue is not similar to red.
While generating the response, follow these rules:
1) Be careful when you read values and labels.
2) Double-check to ensure the data you found is accurate.
3) Answer with JUST ONE JSON format.
4) Return JUST one JSON without any additional chars or words.
5) Don't pay attention to watermarks, words in background etc., act like they don't exist.
"""
line_chart_prompt = """
You are an AI assistant made for information extraction and data analysis. Your task is to extract the data points from a line chart image and convert them into a JSON format.
Let's proceed step by step:
Step 1: Carefully examine the provided line chart image.
Step 2: Find out the Y axis label.
Step 3: Check if what you got is true.
Step 4: Find out how many X values there are on the bottom of the line chart. This should be a number. That is the number of points.
Step 5: Verify that the number you got is correct.
Step 6: Figure out if the Y values of every point are next to the point.
Step 7: If the Y values of every point are next to the point, find out the X and Y values for each point in order. If they are not, for every X value find out what Y value best corresponds to it using the chart.
Step 8: Provide information about the Y axis and every point in JSON format, as a string.
Step 9: Check provided information if it is correct.
Step 10: Put ! at the beginning and at the end of JSON format.
This is an example of correctly formatted JSON output:
!{
"Y_Axis": {
"Label": "lab"
},
"Point1": {
"X_Value": "x_val1",
"Y_Value": "y_val1"
},
"Point2": {
"X_Value": "x_val2",
"Y_Value": "y_val2"
},
...,
"PointN": {
"X_Value": "x_valN",
"Y_Value": "y_valN"
"}
}!
This example is not related to your case; it is just an example of the format.
While generating the response, follow these rules:
1) Be careful when you read values and labels.
2) Double-check to ensure the data you found is accurate.
3) Answer with JUST ONE JSON format.
4) Return JUST one JSON without any additional chars or words.
5) Don't pay attention to watermarks, words in background etc., act like they don't exist.
"""
bar_chart_prompt = """
You are an AI assistant and you will be given a bar chart.
Your task is to understand the bar chart. Since this bar chart is very important, you need to focus on it.
Pay attention to orientation of bars, are they horizontal or vertical.
Respond with "-Vertical-" or "-Horizontal-" based on given chart.
To understand the bar chart, follow these rules:
1. First, pay attention to orientation of graph; is it vertical or horizontal.
2. If vertical, return *V*, else return *H*, check example format
3. Pay attention to number of different bars in chart. This should be a number.
4. Then, verify that the number you got is correct.
5. Next, pay attention to the values (y-axis) and parameters (x-axis). Values are numbers.
6. Provide information about each bar in JSON format with the following keys for each part: Value, Parameter.
7. Check the provided information TWICE; if there is any error, fix it and check again.
8. Put an exclamation mark at the beginning and at the end of the JSON format.
Color could be: blue, gray, red, yellow, green, pink, purple.
This is an example of correctly formatted JSON output with color and True/False for values on the graph:
"-Vertical/Horizontal-
!{ "values": [ {"value": val1, "parameter": p1},{"value": val2, "parameter": p2},..., {"value": valn, "parameter": pn}]}! "
Put no new lines. Color is a string that contains the color of the bars in the given bar chart, for example, blue or red.
This example is not related to your case; it is just an example of the format. Do not return the total value or something like that. If the bar plot contains a percentage or something else, make sure the symbols are there after the number.
While generating the response, follow these rules:
1. Be careful.
2. Double-check to ensure the data you found is accurate.
3. Answer with JUST ONE JSON format.
4. Return JUST one JSON without any additional characters or words.
5. Don't pay attention to watermarks, words in the background, etc.; act like they don't exist.
"""
prompt_label = """
You are an AI assistant and you will be given a bar chart.
Your task is to understand the bar chart. Since this bar chart is very important, you need to focus on it.
Pay attention, exist there exact values on chart area or not? Respond with &YES& if there are,
or &NO& if there are not, based on given chart.
"""