Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Xiong committed Jan 11, 2024
1 parent 03de68f commit 37fcb6b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ Uncomment the section that is right (remove the HTML comment wrapper).
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--

### Added

- - Added `max_debug_retry` parameter to `VizroAI.plot` to allow users to determine the maximum number of debugging attempts desired ([#261](https://github.com/mckinsey/vizro/pull/261))

-->
<!--
### Changed
Expand Down
12 changes: 4 additions & 8 deletions vizro-ai/docs/pages/user_guides/run_vizro_ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,12 @@ The returned `code_string` can be used to dynamically render charts within your
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. `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.
- 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.
- **Example**:
Adjust the number of retries by setting `max_debug_retry` in the `plot` function.
E.g. if you would like adjust to 5 debugging attempts, you can set `max_debug_retry = 5` in the plot function:
```py
vizro_ai.plot(df = df, user_input = "your user input", max_debug_retry= 5)
```
8 changes: 4 additions & 4 deletions vizro-ai/src/vizro_ai/_vizro_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def plot(
"""Plot visuals using vizro via english descriptions, english to chart translation.
Args:
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: Maximum number of retries to debug errors. Defaults to 3
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: 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 37fcb6b

Please sign in to comment.