Skip to content

Commit

Permalink
[Docs] Minor updates to Vizro-AI docs to remove unnecessary tutorial-…
Browse files Browse the repository at this point in the history
…style text in a how-to guide (#619)

Co-authored-by: Lingyi Zhang <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Schulz <[email protected]>
  • Loading branch information
4 people authored Aug 6, 2024
1 parent f94cda6 commit 50f2eb9
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨
- A bullet item for the Highlights ✨ 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))
-->
<!--
### Removed
- 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
- A bullet item for the Added 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))
-->
<!--
### Changed
- A bullet item for the Changed 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))
-->
<!--
### Deprecated
- A bullet item for the Deprecated 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))
-->
<!--
### Fixed
- A bullet item for the Fixed 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))
-->
<!--
### Security
- A bullet item for the Security 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))
-->
2 changes: 1 addition & 1 deletion vizro-ai/docs/pages/user-guides/create-advanced-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ We'll create an animated bar chart illustrating the GDP per capita of each conti

[AnimatedChart1]: ../../assets/tutorials/chart/advanced_chart_1.png

Having unveiled our animated map chart showcasing GDP per capita development per country, it's clear that the map area is small, and it is very difficult to differentiate countries.
Having unveiled our animated map chart showcasing GDP per capita development per country, it's clear that the map area is small, and it is difficult to differentiate countries.
Next, we will try to tweak our prompt to improve the overall layout.

!!! example "Vizro-AI animated chart"
Expand Down
50 changes: 9 additions & 41 deletions vizro-ai/docs/pages/user-guides/create-complex-dashboard.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,14 @@
# Generate a complex dashboard

This guide shows you how to instruct Vizro-AI generating a complex dashboard.
This guide shows you how to instruct Vizro-AI to create a complex dashboard.

Vizro-AI can in general follow user requirements well and generate high-quality dashboards, but the nature of LLMs means that generated dashboards are not always an exact match for user expectations. When the text length of user requirements increases, the LLMs could start to miss part of the user requirements or make mistakes. Apart from choosing more advanced models for harder tasks, improving the user prompt could help too.
In general, Vizro-AI can follow user requirements well and generate high-quality dashboards, but the nature of LLMs means that the output generated at first is not always an exact match for your expectations. When the text length of user requirements increases, the LLMs can start to miss part of the user requirements or make mistakes. Apart from choosing more advanced models for harder tasks, improving the user prompt can help too.

The following example shows how to use Vizro-AI to generate a complex Vizro dashboard.

## 1. Install Vizro-AI and its dependencies

If you haven't already installed Vizro-AI and set up the API key for OpenAI, follow the [installation guide](../user-guides/install.md).


## 2. Open a Notebook
A good way to initially explore Vizro-AI is from inside a Jupyter Notebook.

??? "If you haven't used Jupyter before..."

You may need to install the Jupyter package if you . From the terminal window:

```bash
pip install jupyter
```

Start a new Notebook as follows:

```bash
jupyter notebook
```

The command opens Jupyter in a browser tab. Use the UI to navigate to a preferred folder in which to create this new dashboard.

Create a new `Python 3 (ipykernel)` Notebook from the "New" dropdown. Confirm your Vizro installation by typing the following into a cell in the Notebook and running it.

```py
import vizro_ai

print(vizro_ai.__version__)
```

You should see a return output of the form `x.y.z`.


## 3. Prepare the data
## 1. Prepare the data
Next, prepare the data to pass to Vizro-AI. In this example, we use the [election data](https://plotly.com/python-api-reference/generated/plotly.express.data.html#plotly.express.data.election) and the [stocks data](https://plotly.com/python-api-reference/generated/plotly.express.data.html#plotly.express.data.stocks).

```py
Expand All @@ -51,9 +18,10 @@ df1 = px.data.election()
df2 = px.data.stocks(datetimes=True)
```

## 4. Prepare the user prompt

Put together a string of text which is the prompt to request Vizro-AI to generate the dashboard.
## 2. Prepare the user prompt

Devise a string of text to form the prompt that requests Vizro-AI to generate the Vizro dashboard.

Vizro-AI can generate a multi-page dashboard that includes the following features:

Expand Down Expand Up @@ -117,12 +85,12 @@ column 6 - card 1 takes row 1; card 2 takes row 2; card 3 takes row 3; ... card
"""
```

It's worth noting that, a more structured user request is also more machine readable.
It's worth noting that a more structured user request is also more machine readable.

- Top down instruction can help Vizro-AI to make better plans on what to build.
- Top down instructions can help Vizro-AI to make better plans on what to build.
- Using line breaks and special characters can help in making instructions clearer for a language model. It helps in parsing and understanding the structure and emphasis in your request.

## 5. Call Vizro-AI
## 3. Call Vizro-AI

Next, submit the data and prompt string:

Expand Down

0 comments on commit 50f2eb9

Please sign in to comment.