Skip to content

Commit 95149a9

Browse files
improving the code generation template in case of plotly
1 parent 21e5e9d commit 95149a9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pandasai/core/prompts/templates/generate_python_code_with_sql.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def execute_sql_query(sql_query: str) -> pd.Dataframe
1111
</function>
1212

1313
For the charts, you can either use `matplotlib.pyplot` or `plotly.express` to generate the charts.
14-
If you use `plotly.express`, you have to save each chart as a dictionary into a JSON file.
14+
If you use `plotly.express`, you have to save each chart by using `fig.write_json` (e.g., `fig.write_json("path/to/file.json", pretty=True)`).
1515

1616
{% if last_code_generated != "" and context.memory.count() > 0 %}
1717
{{ last_code_generated }}

tests/unit_tests/prompts/test_sql_prompt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def execute_sql_query(sql_query: str) -> pd.Dataframe
8282
</function>
8383
8484
For the charts, you can either use `matplotlib.pyplot` or `plotly.express` to generate the charts.
85-
If you use `plotly.express`, you have to save each chart as a dictionary into a JSON file.
85+
If you use `plotly.express`, you have to save each chart by using `fig.write_json` (e.g., `fig.write_json("path/to/file.json", pretty=True)`).
8686
8787
8888
Update this initial code:

0 commit comments

Comments
 (0)