diff --git a/vizro-ai/docs/pages/user_guides/run_vizro_ai.md b/vizro-ai/docs/pages/user_guides/run_vizro_ai.md index e4ca8d530..1e15f9c4c 100644 --- a/vizro-ai/docs/pages/user_guides/run_vizro_ai.md +++ b/vizro-ai/docs/pages/user_guides/run_vizro_ai.md @@ -81,18 +81,17 @@ Vizro-AI's `_get_chart_code` method returns the Python code string that can be u The returned `code_string` can be used to dynamically render charts within your application. You may have the option to encapsulate the chart within a `fig` object or convert the figure into a JSON string for further integration. In case you would like to use the insights or code explanation, you can use `vizro_ai._run_plot_tasks(df, ..., explain=True)`, which returns a dictionary containing the code explanation and chart insights alongside the code. -### 4. Increase the maximum number of attempts to debug -Sometimes there is error in code generated first round since the code is generated by Large Language Models (LLMs), - -The `max_debug_retry` parameter in the plot function specifies the maximum number of attempts the function will make to debug any errors that occur during its execution. -When an error is encountered, the function will automatically invoke a debugging process. This process involves running the code, capturing any errors that occur, and then using the LLM to analyze and attempt to resolve these errors. - -By default, the max_debug_retry is set to 3, the function will attempt to debug errors up to three times. +### 4. `max_debug_retry` Parameter in plot Function +Since the code is generated by Large Language Models (LLMs), it can contain bugs and thus fail on execution. +When an error is encountered, an LLM-based debugging process will be triggered. +The `max_debug_retry` parameter controls maximum number of retries the `plot` function attempts to debug errors. + +- **Default Value**: 3 +- **Type**: int +- **Brief**: By default, the `max_debug_retry` is set to 3, the function will attempt to debug errors up to three times. If the errors are not resolved after the maximum number of retries, the function will cease further debugging attempts. - -if users would like to increase or decrease the maximum number of retries, adding parameter `max_debug_retry` in plot call as below works: -!!! example "Change max_debug_retry" - === "Code for the cell" - ```py - vizro_ai.plot(df = df, user_input = "your user input", max_debug_retry= 5) - ``` +- **Example**: + Adjust the number of retries by setting `max_debug_retry` in the `plot` function. + ```py + vizro_ai.plot(df = df, user_input = "your user input", max_debug_retry= 5) + ``` diff --git a/vizro-ai/src/vizro_ai/_vizro_ai.py b/vizro-ai/src/vizro_ai/_vizro_ai.py index 8da7151b9..be71ab827 100644 --- a/vizro-ai/src/vizro_ai/_vizro_ai.py +++ b/vizro-ai/src/vizro_ai/_vizro_ai.py @@ -112,7 +112,7 @@ def plot( df: The dataframe to be analyzed user_input: User questions or descriptions of the desired visual explain: Flag to include explanation in response - max_debug_retry: Number of times LLM can retry for debug + max_debug_retry: Maximum number of retries to debug errors. Defaults to 3 """ output_dict = self._run_plot_tasks(df, user_input, explain=explain, max_debug_retry=max_debug_retry) code_string = output_dict.get("code_string")