From 07f285d8627c4b19a4397ea82c924845340d416b Mon Sep 17 00:00:00 2001 From: Ihor <31508183+nautics889@users.noreply.github.com> Date: Thu, 14 Dec 2023 01:06:25 +0200 Subject: [PATCH] docs: add description of `open_charts` option (#817) * (docs): update getting-started manual, add a description for `open_charts` parameter; * (docs): update docstring of `format_plot()` as well; --- docs/getting-started.md | 1 + pandasai/responses/response_parser.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 6c2934d0b..731b5f695 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -197,6 +197,7 @@ Settings: - `enforce_privacy`: whether to enforce privacy. Defaults to `False`. If set to `True`, PandasAI will not send any data to the LLM, but only the metadata. By default, PandasAI will send 5 samples that are anonymized to improve the accuracy of the results. - `save_charts`: whether to save the charts generated by PandasAI. Defaults to `False`. You will find the charts in the root of your project or in the path specified by `save_charts_path`. - `save_charts_path`: the path where to save the charts. Defaults to `exports/charts/`. You can use this setting to override the default path. +- `open_charts`: whether to open the chart during parsing of the response from the LLM. Defaults to `True`. You can completely disable displaying of charts by setting this option to `False`. - `enable_cache`: whether to enable caching. Defaults to `True`. If set to `True`, PandasAI will cache the results of the LLM to improve the response time. If set to `False`, PandasAI will always call the LLM. - `use_error_correction_framework`: whether to use the error correction framework. Defaults to `True`. If set to `True`, PandasAI will try to correct the errors in the code generated by the LLM with further calls to the LLM. If set to `False`, PandasAI will not try to correct the errors in the code generated by the LLM. - `max_retries`: the maximum number of retries to use when using the error correction framework. Defaults to `3`. You can use this setting to override the default number of retries. diff --git a/pandasai/responses/response_parser.py b/pandasai/responses/response_parser.py index 5a545a079..a60ec3436 100644 --- a/pandasai/responses/response_parser.py +++ b/pandasai/responses/response_parser.py @@ -80,7 +80,10 @@ def format_dataframe(self, result: dict) -> Any: def format_plot(self, result: dict) -> Any: """ - Display matplotlib plot against a user query + Display matplotlib plot against a user query. + + If `open_charts` option set to `False`, the chart won't be displayed. + Args: result (dict): result contains type and value Returns: