mckinsey / vizro

Vizro is a toolkit for creating modular data visualization applications.
https://vizro.readthedocs.io/en/stable/
Apache License 2.0
2.61k stars 116 forks source link

Add keyword `explain` to private vizro-ai method #256

Closed maxschulz-COL closed 8 months ago

maxschulz-COL commented 8 months ago

Description

Currently the docs example:

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

vizro_ai = VizroAI()

df = px.data.gapminder()
code_string = vizro_ai._get_chart_code(df, "describe life expectancy per continent over time", explain=True)

fails due to the keyword explain not being present.

Given that users might want to extract the code, explanation and insights separately, it makes sense to allow this keyword AND to also allow the return of the entire dictionary containing the code string, explanation and insights (see updated docs example).

Screenshot

Notice