Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mckinsey/vizro into feat/dy…
Browse files Browse the repository at this point in the history
…namic-filter
  • Loading branch information
petar-qb committed Nov 15, 2024
2 parents 9e5a239 + c80b359 commit 5f161aa
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 256 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@ 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))
- 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))
- 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))
- 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))
- 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))
- 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))
- 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))
- 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))
-->
10 changes: 7 additions & 3 deletions vizro-ai/docs/pages/user-guides/customize-vizro-ai.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Model usage

This guide shows how to set up a large language model (LLM) for use with Vizro-AI. Setting up a LLM is required for the package to generate charts and dashboards based on natural language queries.
This guide shows how to set up a large language model (LLM) for use with Vizro-AI. Setting up a LLM is required for the package to generate charts and dashboards based on natural language queries. To ensure responsible use, review the vendor’s guidelines on risk mitigation before using the model to understand potential model limitations and best practices.

## Supported models
Vizro-AI supports **any** model that is available via [Langchain's `BaseChatModel` class](https://api.python.langchain.com/en/latest/language_models/langchain_core.language_models.chat_models.BaseChatModel.html#langchain_core.language_models.chat_models.BaseChatModel), and that has the [`with_structured_output` method](https://python.langchain.com/v0.2/docs/how_to/structured_output/#the-with_structured_output-method) implemented. An overview of the [most common vendor models supporting this functionality](https://python.langchain.com/v0.2/docs/integrations/chat/) can be found in Langchain's documentation. For ease of use one can also choose some models via a string parameter.
Expand All @@ -24,7 +24,8 @@ vizro_ai = VizroAI(model="<chosen model>")
| API key | `OPENAI_API_KEY` |
| Base API URL | `OPENAI_API_BASE` |

To use OpenAI with Vizro-AI, you must have an account with paid-for credits available. None of the free accounts will suffice. You can check [all available OpenAI models including pricing on their website](https://platform.openai.com/docs/models). This will also explain which version the below string acronyms currently point to.
To use OpenAI with Vizro-AI, you must have an account with paid-for credits available. None of the free accounts will suffice. [Check the OpenAI models and pricing on their website](https://platform.openai.com/docs/models). Before using a model, please review OpenAI's guidelines on risk mitigation to understand potential model limitations and best practices.
[See the OpenAI site for more details on responsible usage](https://platform.openai.com/docs/guides/safety-best-practices).

- `gpt-4o-mini` **default**
- `gpt-4-turbo`
Expand All @@ -39,7 +40,8 @@ vizro_ai = VizroAI(model="<chosen model>")
| API key | `ANTHROPIC_API_KEY` |
| Base API URL | `ANTHROPIC_API_URL`,`ANTHROPIC_BASE_URL` |

To use Anthropic with Vizro-AI, you must have an account with paid-for credits available. None of the free accounts will suffice. You can check [all available Anthropic models including pricing on their website](https://docs.anthropic.com/en/docs/about-claude/models).
To use Anthropic with Vizro-AI, you must have an account with paid-for credits available. None of the free accounts will suffice. [Check the Anthropic models and pricing on their website](https://docs.anthropic.com/en/docs/about-claude/models). Before using a model, please review Anthropic guidelines on risk mitigation to understand potential model limitations and best practices.
[See the Anthropic site for more details on responsible usage](https://support.anthropic.com/en/collections/4078535-trust-safety/).

- `claude-3-5-sonnet-latest`
- `claude-3-opus-latest`
Expand All @@ -62,6 +64,8 @@ vizro_ai = VizroAI(model="<chosen model>")
| Base API URL | `MISTRAL_BASE_URL` |

To use Mistral with Vizro-AI, you can either use their API, which comes with [an associated cost](https://mistral.ai/technology/#pricing), or you could use their models for free under the Apache 2.0 license. In that case you need to setup the model API yourself. You can check [all available Mistral models including pricing on their website](https://docs.mistral.ai/getting-started/models/models_overview). This will also explain which version the below string acronyms currently point to.
Before usage, please review Mistral guidelines on risk mitigation to understand potential model limitations and best practices.
[See the Mistral site for more details on responsible usage](https://help.mistral.ai/en/collections/272960-le-chat/).

- `mistral-large-latest`
- `open-mistral-nemo`
Expand Down
14 changes: 14 additions & 0 deletions vizro-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ See the fragment files in the [changelog.d directory](https://github.com/mckinse

<!-- scriv-insert-here -->

<a id='changelog-0.1.27'></a>

# 0.1.27 — 2024-11-14

## Changed

- Improve performance of data loading. ([#850](https://github.com/mckinsey/vizro/pull/850), [#857](https://github.com/mckinsey/vizro/pull/857))

- Upper bound dependency `dash<3`. ([#877](https://github.com/mckinsey/vizro/pull/877))

## Fixed

- Fix 404 error page and page flickering on refresh. ([#865](https://github.com/mckinsey/vizro/pull/865))

<a id='changelog-0.1.26'></a>

# 0.1.26 — 2024-10-30
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 8 additions & 2 deletions vizro-core/examples/visual-vocabulary/custom_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,18 @@ def diverging_stacked_bar(data_frame: pd.DataFrame, **kwargs) -> go.Figure:
orientation = fig.data[0].orientation
x_or_y = "x" if orientation == "h" else "y"

for trace_idx in range(len(fig.data) // 2):
for trace_idx in range(len(fig.data) // 2, len(fig.data)):
fig.update_traces({f"{x_or_y}axis": f"{x_or_y}2"}, selector=trace_idx)

# Add ticksuffix and range limitations on both sids for correct interpretation of diverging stacked bar
# with percentage data
fig.update_layout({f"{x_or_y}axis": {"ticksuffix": "%"}})
fig.update_layout({f"{x_or_y}axis2": fig.layout[f"{x_or_y}axis"]})
fig.update_layout(
{f"{x_or_y}axis": {"autorange": "reversed", "domain": [0, 0.5]}, f"{x_or_y}axis2": {"domain": [0.5, 1]}}
{
f"{x_or_y}axis": {"domain": [0, 0.5], "range": [100, 0]},
f"{x_or_y}axis2": {"domain": [0.5, 1], "range": [0, 100]},
}
)

if orientation == "h":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ def diverging_stacked_bar(data_frame: pd.DataFrame, **kwargs) -> go.Figure:
orientation = fig.data[0].orientation
x_or_y = "x" if orientation == "h" else "y"

for trace_idx in range(len(fig.data) // 2):
for trace_idx in range(len(fig.data) // 2, len(fig.data)):
fig.update_traces({f"{x_or_y}axis": f"{x_or_y}2"}, selector=trace_idx)

fig.update_layout({f"{x_or_y}axis": {"ticksuffix": "%"}})
fig.update_layout({f"{x_or_y}axis2": fig.layout[f"{x_or_y}axis"]})
fig.update_layout(
{f"{x_or_y}axis": {"autorange": "reversed", "domain": [0, 0.5]}, f"{x_or_y}axis2": {"domain": [0.5, 1]}}
{
f"{x_or_y}axis": {"domain": [0, 0.5], "range": [100, 0]},
f"{x_or_y}axis2": {"domain": [0.5, 1], "range": [0, 100]},
}
)

if orientation == "h":
Expand Down Expand Up @@ -63,6 +67,6 @@ def diverging_stacked_bar(data_frame: pd.DataFrame, **kwargs) -> go.Figure:
data_frame=pastries,
x=["Strongly Disagree", "Disagree", "Agree", "Strongly Agree"],
y="pastry",
labels={"value": "Response count", "variable": "Opinion"},
labels={"value": "", "variable": "", "pastry": ""},
title="I would recommend this pastry to my friends",
)
Loading

0 comments on commit 5f161aa

Please sign in to comment.