Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 29, 2024
1 parent 231bb57 commit 06ee31d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions vizro-ai/docs/pages/user-guides/customize-vizro-ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ vizro_ai = VizroAI(model="<chosen model>")
For the string settings to work, you must supply your API key via environment variables. The relevant variable names to be set are noted in each vendor tab.

=== "OpenAI"

| Environment variable | Name(s) |
| -------------------- | ----------------- |
| API key | `OPENAI_API_KEY` |
Expand Down
13 changes: 9 additions & 4 deletions vizro-ai/docs/pages/user-guides/vizro-ai-langchain-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Now you can use the chain to generate charts or dashboards based on natural lang

!!! example "Generate chart code"
=== "Code"

```python
# Load sample data
df = px.data.gapminder()
Expand All @@ -126,16 +127,16 @@ Now you can use the chain to generate charts or dashboards based on natural lang
```

=== "Vizro-AI Generated Code"

```python
import plotly.graph_objects as go
from vizro.models.types import capture


@capture("graph")
def custom_chart(data_frame):
continent_gdp = data_frame.groupby("continent")["gdpPercap"].mean().reset_index()
fig = go.Figure(
data=[go.Bar(x=continent_gdp["continent"], y=continent_gdp["gdpPercap"])]
)
fig = go.Figure(data=[go.Bar(x=continent_gdp["continent"], y=continent_gdp["gdpPercap"])])
fig.update_layout(
title="GDP per Capita by Continent",
xaxis_title="Continent",
Expand All @@ -146,14 +147,18 @@ Now you can use the chain to generate charts or dashboards based on natural lang

!!! example "Generate dashboard code"
=== "Code"

```python
dfs = [px.data.gapminder()]

dashboard_response = chain.invoke("Create a dashboard. This dashboard has a chart showing the correlation between gdpPercap and lifeExp.")
dashboard_response = chain.invoke(
"Create a dashboard. This dashboard has a chart showing the correlation between gdpPercap and lifeExp."
)
print(dashboard_response[0].content)
```

=== "Vizro-AI Generated Code"

```py
############ Imports ##############
import vizro.models as vm
Expand Down
3 changes: 2 additions & 1 deletion vizro-core/docs/pages/user-guides/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ The below sections are guides on how to use pre-defined action functions.

To enable downloading data, you can add the [`export_data`][vizro.actions.export_data] action function to the [`Button`][vizro.models.Button] component. Hence, as a result, when a dashboard user now clicks the button, all data on the page will be downloaded.


!!! example "`export_data`"
=== "app.py"

```{.python pycafe-link}
import vizro.models as vm
import vizro.plotly.express as px
Expand Down Expand Up @@ -59,6 +59,7 @@ To enable downloading data, you can add the [`export_data`][vizro.actions.export
```

=== "app.yaml"

```yaml
# Still requires a .py to add data to the data manager and parse YAML configuration
# See yaml_version example
Expand Down
2 changes: 2 additions & 0 deletions vizro-core/docs/pages/user-guides/card-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ The example below demonstrates how to configure a button to export the filtered

!!! example "Button with action"
=== "app.py"

```{.python pycafe-link}
import vizro.models as vm
import vizro.plotly.express as px
Expand Down Expand Up @@ -662,6 +663,7 @@ The example below demonstrates how to configure a button to export the filtered
```

=== "app.yaml"

```yaml
# Still requires a .py to add data to the data manager and parse YAML configuration
# See from_yaml example
Expand Down
3 changes: 3 additions & 0 deletions vizro-core/docs/pages/user-guides/figure.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ To add a `Figure` to your page:

!!! example "Use existing figure functions"
=== "app.py"

```{.python pycafe-link}
import vizro.models as vm
import vizro.plotly.express as px
Expand Down Expand Up @@ -71,6 +72,7 @@ To add a `Figure` to your page:
```

=== "app.yaml"

```yaml
# Still requires a .py to add data to the data manager and parse YAML configuration
# See from_yaml example
Expand Down Expand Up @@ -110,6 +112,7 @@ As described in the [API reference](../API-reference/figure-callables.md) and il

!!! example "KPI card variations"
=== "app.py"

```{.python pycafe-link}
import pandas as pd
import vizro.models as vm
Expand Down
1 change: 0 additions & 1 deletion vizro-core/docs/pages/user-guides/kedro-data-catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ The `catalog` variable may have been created in a number of different ways:
The full code for these different cases is given below.

!!! example "Import a Kedro Data Catalog into the Vizro data manager"

=== "app.py (Kedro project path)"
```python
from vizro.integrations import kedro as kedro_integration
Expand Down

0 comments on commit 06ee31d

Please sign in to comment.