Skip to content

Commit

Permalink
[Docs]fix vizro ai chart example (#472)
Browse files Browse the repository at this point in the history
Co-authored-by: Lingyi Zhang <lingyi_zhang@mckinsey.com>
  • Loading branch information
Anna-Xiong and lingyielia committed May 14, 2024
1 parent 2c3e94c commit 64d8602
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 12 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))
-->
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This guide explains the different ways in which you can add a chart generated by
```py
import vizro_ai
from vizro_ai import VizroAI
import plotly.express as px
import vizro.plotly.express as px
from dotenv import load_dotenv

load_dotenv()
Expand Down Expand Up @@ -64,7 +64,7 @@ This object must then be passed to the `figure` argument of the Vizro [Graph](ht
import vizro.models as vm
from vizro.models.types import capture
import pandas as pd
import plotly.express as px
import vizro.plotly.express as px


@capture('graph')
Expand Down Expand Up @@ -120,7 +120,7 @@ Executing the code below yields the identical dashboard as the example above.
from vizro import Vizro
import vizro.models as vm
import pandas as pd
import plotly.express as px
import vizro.plotly.express as px
import vizro_ai
from vizro_ai import VizroAI

Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/docs/pages/user-guides/customize-vizro-ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ To ensure a deterministic answer to our queries, we've set the temperature to 0.
from vizro_ai import VizroAI
from langchain_openai import ChatOpenAI

import plotly.express as px
import vizro.plotly.express as px
df = px.data.gapminder()

llm = ChatOpenAI(
Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/examples/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"metadata": {},
"outputs": [],
"source": [
"import plotly.express as px\n",
"import vizro.plotly.express as px\n",
"df = px.data.gapminder()\n",
"df"
]
Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/examples/example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""AI plot example."""

import plotly.express as px
import vizro.plotly.express as px
from vizro_ai import VizroAI

vizro_ai = VizroAI()
Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/src/vizro_ai/components/chart_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _chart_to_use(load_args) -> str:


if __name__ == "__main__":
import plotly.express as px
import vizro.plotly.express as px

from vizro_ai.chains._llm_models import _get_llm_model

Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/src/vizro_ai/components/code_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def run(self, code_snippet: str, chain_input: str = "") -> str:


if __name__ == "__main__":
import plotly.express as px
import vizro.plotly.express as px

from vizro_ai.chains._llm_models import _get_llm_model

Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/src/vizro_ai/components/custom_chart_wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _add_capture_code(code_string: str) -> str:


if __name__ == "__main__":
import plotly.express as px
import vizro.plotly.express as px

from vizro_ai.chains._llm_models import _get_llm_model

Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/src/vizro_ai/components/dataframe_craft.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _format_dataframe_string(s: str) -> str:


if __name__ == "__main__":
import plotly.express as px
import vizro.plotly.express as px

from vizro_ai.chains._llm_models import _get_llm_model

Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/src/vizro_ai/components/visual_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _clean_visual_code(raw_code: str) -> str:


if __name__ == "__main__":
import plotly.express as px
import vizro.plotly.express as px

from vizro_ai.chains._llm_models import _get_llm_model

Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/tests/integration/test_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import plotly.express as px
import vizro.plotly.express as px
from hamcrest import all_of, any_of, assert_that, contains_string, equal_to
from vizro_ai import VizroAI

Expand Down

0 comments on commit 64d8602

Please sign in to comment.