Skip to content

Commit

Permalink
[Tidy] Update model names and add PyCafe link (#853)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
lingyielia and pre-commit-ci[bot] authored Nov 7, 2024
1 parent 43fd1fa commit c7df0c5
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 11 deletions.
1 change: 1 addition & 0 deletions vizro-ai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ It serves as an extension to Vizro, leveraging natural language capabilities to

| Platform | Chart creation | Dashboard creation |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| PyCafe | https://py.cafe/app/vizro-official/vizro-ai-charts | |
| Google Colab | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mckinsey/vizro/blob/main/vizro-ai/examples/chart_by_vizro_ai.ipynb) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mckinsey/vizro/blob/main/vizro-ai/examples/dashboard_by_vizro_ai.ipynb) |

## Why Vizro-AI?
Expand Down
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/explanation/safety-in-vizro-ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ It is necessary to approach the generated content with caution, especially when
### 3. Data privacy
<!-- vale on -->
Your data is sent to model vendors if you connect to LLMs via their APIs.
For example, if you connect to the model "gpt-3.5-turbo-0613" from Open AI, your data will be sent to OpenAI via their API.
For example, if you connect to the model from OpenAI, your data will be sent to OpenAI via their API.
Users should be cautious about sharing or inputting any personal or sensitive information.

<!-- vale off -->
Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/docs/pages/user-guides/chart-examples.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gallery of examples

Take a look at some more advanced charts that can be created with Vizro-AI using data from [Plotly Express](https://plotly.com/python-api-reference/generated/plotly.express.data.html). The examples below use the OpenAI `"gpt-4o"` model as we are going to request specific updates to the layout of the charts, which are [more complex than the GPT 3.5 model can handle](./customize-vizro-ai.md).
Take a look at some more advanced charts that can be created with Vizro-AI using data from [Plotly Express](https://plotly.com/python-api-reference/generated/plotly.express.data.html). The examples below use the OpenAI `"gpt-4o"` model as we are going to request specific updates to the layout of the charts.

### Polar bar chart

Expand Down
4 changes: 2 additions & 2 deletions vizro-ai/docs/pages/user-guides/customize-vizro-ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ Passing an instantiated model to `VizroAI` lets you customize it, and additional

### Chart generation

At the time of writing, we found that for chart creation, the leading vendor's "cheaper" models, for example OpenAI's `gpt-4o-mini` and `gpt-3.5` model series, are suitable for basic charting despite their relatively low price points.
At the time of writing, we found that for chart creation, the leading vendor's "cheaper" models, for example OpenAI's `gpt-4o-mini`, are suitable for basic charting despite their relatively low price points.

Consider upgrading to, in the case of OpenAI the `gpt-4o` and `gpt-4` model series, or in the case of Anthropic the `claude-3-5-sonnet-20240620` model series, for more demanding tasks. The downside of using these models is that they come at a higher cost.
Consider upgrading to, in the case of OpenAI the `gpt-4o` and `gpt-4` model series, or in the case of Anthropic the `Claude 3.5` model series, for more demanding tasks. The downside of using these models is that they come at a higher cost.

### Dashboard generation

Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/examples/chart_by_vizro_ai.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
"\n",
"# @markdown #### 1. Choose the LLM model\n",
"\n",
"LLM = \"gpt-4o\" # @param [\"gpt-4o\", \"gpt-3.5-turbo\", \"gpt-4-turbo\", \"gpt-4o-mini\"]\n",
"LLM = \"gpt-4o\" # @param [\"gpt-4o\", \"gpt-4-turbo\", \"gpt-4o-mini\"]\n",
"\n",
"print(f\"Selected LLM: {LLM}\")\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/examples/dashboard_by_vizro_ai.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
"\n",
"# @markdown #### 1. Choose the LLM model\n",
"\n",
"LLM = \"gpt-4o\" # @param [\"gpt-4o\", \"gpt-3.5-turbo\", \"gpt-4-turbo\", \"gpt-4o-mini\"]\n",
"LLM = \"gpt-4o\" # @param [\"gpt-4o\", \"gpt-4-turbo\", \"gpt-4o-mini\"]\n",
"\n",
"\n",
"# @markdown ---\n",
Expand Down
4 changes: 2 additions & 2 deletions vizro-ai/examples/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"llm = None\n",
"# uncomment below to try out different models\n",
"# llm = \"gpt-4o\"\n",
"# llm = \"claude-3-5-sonnet-20240620\"\n",
"# llm = \"claude-3-5-sonnet-latest\"\n",
"# llm = \"mistral-large-latest\"\n",
"\n",
"# from langchain_openai import ChatOpenAI\n",
Expand All @@ -22,7 +22,7 @@
"# import os\n",
"# from langchain_anthropic import ChatAnthropic\n",
"# llm = ChatAnthropic(\n",
"# model=\"claude-3-5-sonnet-20240620\",\n",
"# model=\"claude-3-5-sonnet-latest\",\n",
"# # api_key = os.environ.get(\"ANTHROPIC_API_KEY\"),\n",
"# # base_url= os.environ.get(\"ANTHROPIC_API_BASE\")\n",
"# )\n",
Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/src/vizro_ai/_llm_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ def _get_model_name(model: BaseChatModel) -> str:


if __name__ == "__main__":
llm_chat_openai = _get_llm_model(model="gpt-3.5-turbo")
llm_chat_openai = _get_llm_model(model="gpt-4o-mini")
print(repr(llm_chat_openai)) # noqa: T201
print(llm_chat_openai.model_name) # noqa: T201
4 changes: 2 additions & 2 deletions vizro-ai/tests/integration/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def setup_test_environment():

@pytest.mark.parametrize(
"model_name",
["gpt-3.5-turbo"],
ids=["gpt-3.5"],
["gpt-4o-mini"],
ids=["gpt-4o-mini"],
)
@pytest.mark.filterwarnings("ignore::langchain_core._api.beta_decorator.LangChainBetaWarning")
@pytest.mark.filterwarnings("ignore::UserWarning")
Expand Down

0 comments on commit c7df0c5

Please sign in to comment.