You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Write Python code, in a triple backtick Markdown code block, that answers the user prompts.
55
48
56
-
defget_string(self):
57
-
result=''.join(self.data)
58
-
returnresult[-self.maxlen:]
49
+
Notes:
50
+
Do not use your own knowledge to answer the user prompt. Instead, focus on generating Python code for doing so.
51
+
First, think step by step what you want to do and write it down in English.
52
+
Then generate valid Python code in a single code block.
53
+
Do not add commands to install packages.
54
+
Make sure all code is valid - it will e run in a Jupyter Python 3 kernel environment.
55
+
Define every variable before you use it.
56
+
For data processing, you can use
57
+
'numpy', # numpy==1.24.3
58
+
'dateparser' #dateparser==1.1.8
59
+
'pandas', # matplotlib==1.5.3
60
+
'geopandas' # geopandas==0.13.2
61
+
'tabulate' # tabulate==0.9.0
62
+
For pdf extraction, you can use
63
+
'PyPDF2', # PyPDF2==3.0.1
64
+
'pdfminer', # pdfminer==20191125
65
+
'pdfplumber', # pdfplumber==0.9.0
66
+
For data visualization, you can use
67
+
'matplotlib', # matplotlib==3.7.1
68
+
Be sure to generate charts with matplotlib. If you need geographical charts, use geopandas with the geopandas.datasets module.
69
+
If the user requests to generate a table, produce code that prints a markdown table.
70
+
If the user has just uploaded a file, focus on the file that was most recently uploaded (and optionally all previously uploaded files)
71
+
72
+
If the code modifies or produces a file, at the end of the code block insert a print statement that prints a link to it as HTML string: <a href='/download?file=INSERT_FILENAME_HERE'>Download file</a>. Replace INSERT_FILENAME_HERE with the actual filename.""")
prompt=f"""First, here is a history of what I asked you to do earlier.
98
-
The actual prompt follows after ENDOFHISTORY.
99
-
History:
100
-
{message_buffer.get_string()}
101
-
ENDOFHISTORY.
102
-
Write Python code, in a triple backtick Markdown code block, that does the following:
103
-
{user_prompt}
104
-
105
-
Notes:
106
-
First, think step by step what you want to do and write it down in English.
107
-
Then generate valid Python code in a code block
108
-
Make sure all code is valid - it be run in a Jupyter Python 3 kernel environment.
109
-
Define every variable before you use it.
110
-
For data munging, you can use
111
-
'numpy', # numpy==1.24.3
112
-
'dateparser' #dateparser==1.1.8
113
-
'pandas', # matplotlib==1.5.3
114
-
'geopandas' # geopandas==0.13.2
115
-
For pdf extraction, you can use
116
-
'PyPDF2', # PyPDF2==3.0.1
117
-
'pdfminer', # pdfminer==20191125
118
-
'pdfplumber', # pdfplumber==0.9.0
119
-
For data visualization, you can use
120
-
'matplotlib', # matplotlib==3.7.1
121
-
Be sure to generate charts with matplotlib. If you need geographical charts, use geopandas with the geopandas.datasets module.
122
-
If the user has just uploaded a file, focus on the file that was most recently uploaded (and optionally all previously uploaded files)
123
-
124
-
Teacher mode: if the code modifies or produces a file, at the end of the code block insert a print statement that prints a link to it as HTML string: <a href='/download?file=INSERT_FILENAME_HERE'>Download file</a>. Replace INSERT_FILENAME_HERE with the actual filename."""
0 commit comments