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
Copy file name to clipboardExpand all lines: pandasai/__init__.py
+54-5
Original file line number
Diff line number
Diff line change
@@ -15,23 +15,41 @@ class PandasAI:
15
15
This is the result of `print(df.head({rows_to_display}))`:
16
16
{df_head}.
17
17
18
-
Return the python code (do not import anything) to get the answer to the following question:
18
+
Return the python code (do not import anything) and make sure to prefix the python code with <startCode> exactly and suffix the code with <endCode> exactly
19
+
to get the answer to the following question :
19
20
"""
20
21
_response_instruction: str="""
21
22
Question: {question}
22
23
Answer: {answer}
23
24
24
25
Rewrite the answer to the question in a conversational way.
25
26
"""
27
+
28
+
_error_correct_instruction: str="""
29
+
For the task defined below:
30
+
{orig_task}
31
+
you generated this python code:
32
+
{code}
33
+
and this fails with the following error:
34
+
{error_returned}
35
+
Correct the python code and return a new python code (do not import anything) that fixes the above mentioned error.
36
+
Make sure to prefix the python code with <startCode> exactly and suffix the code with <endCode> exactly.
Return the python code (do not import anything) to get the answer to the following question:
142
+
Return the python code (do not import anything) and make sure to prefix the python code with <startCode> exactly and suffix the code with <endCode> exactly
143
+
to get the answer to the following question :
143
144
How many countries are in the dataframe?"""
144
145
self.pandasai.run(df, "How many countries are in the dataframe?")
Return the python code (do not import anything) to get the answer to the following question:
163
+
Return the python code (do not import anything) and make sure to prefix the python code with <startCode> exactly and suffix the code with <endCode> exactly
164
+
to get the answer to the following question :
163
165
How many countries are in the dataframe?"""
164
166
self.pandasai.run(df, "How many countries are in the dataframe?")
0 commit comments