Skip to content

Commit

Permalink
address pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Xiong committed Jan 10, 2024
1 parent c8aad91 commit dac6ed6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 13 additions & 14 deletions vizro-ai/docs/pages/user_guides/run_vizro_ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
2 changes: 1 addition & 1 deletion vizro-ai/src/vizro_ai/_vizro_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit dac6ed6

Please sign in to comment.