Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] get vizro ai customized text output #488

Merged
merged 29 commits into from
Jun 6, 2024

Conversation

Anna-Xiong
Copy link
Contributor

@Anna-Xiong Anna-Xiong commented May 16, 2024

Description

we will have a dataclass for Plot components.

@dataclass
class Plot:
    """Data class about a vizro ai plot."""

    code_string: str
    fig: go.Figure = field(default=None)
    business_insights: str = field(default=None)
    code_explanation: str = field(default=None)

here is our updated plot() call.

    def plot(
        self,
        df: pd.DataFrame,
        user_input: str,
        explain: bool = False,
        max_debug_retry: int = 3,
        return_plot_components: bool = False,
    ) -> Union[go.Figure, Plot]:
  • explain controls whether to run extra LLM to get text insights of business and code explanation
  • return_plot_components controls whether to Plot dataclass or return only plotly fig object

Pending:

  • Integration test needs to be updated, another PR will address integration tests and
 # TODO Tentative for integration test, will be updated/removed for new tests
        if self._return_all_text:
            return output_dict

will be deleted afterwards.

  • I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":

    • I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.
    • I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorized to submit this contribution on behalf of the original creator(s) or their licensees.
    • I certify that the use of this contribution as authorized by the Apache 2.0 license does not violate the intellectual property rights of anyone else.
    • I have not referenced individuals, products or companies in any commits, directly or indirectly.
    • I have not added data or restricted code in any commits, directly or indirectly.

@Anna-Xiong Anna-Xiong changed the title [Feature] get vizro ai customized text output [Feat] get vizro ai customized text output May 16, 2024
@maxschulz-COL
Copy link
Contributor

I like it! I think this should have the exact same API as the plot function, and it does!

A couple of ideas for suggestions:

  • maybe tune the name so we know the return type: get_plot_dict?
  • Warning is nice, but I think not even necessary, could even skip it

Other than that, think this is great 💪 let's do it

Will do a final review once you finalised it, thanks!

@Anna-Xiong Anna-Xiong self-assigned this Jun 4, 2024
@Anna-Xiong Anna-Xiong added the Component: Vizro-AI 🤖 Issue/PR addresses Vizro-AI package label Jun 4, 2024
@antonymilne
Copy link
Contributor

Just a final suggestion on the names: return_elements is ok but I think I'd prefer return_full overall if that makes sense for you two also? @maxschulz-COL @Anna-Xiong

@Anna-Xiong
Copy link
Contributor Author

Just a final suggestion on the names: return_elements is ok but I think I'd prefer return_full overall if that makes sense for you two also? @maxschulz-COL @Anna-Xiong

I am ok either way, but slightly towards return_elements or return_full_elements? Let's see what @maxschulz-COL thinks?

@maxschulz-COL
Copy link
Contributor

Just a final suggestion on the names: return_elements is ok but I think I'd prefer return_full overall if that makes sense for you two also? @maxschulz-COL @Anna-Xiong

I am ok either way, but slightly towards return_elements or return_full_elements? Let's see what @maxschulz-COL thinks?

I prefer return_elements - I find that is really what it is.

@antonymilne
Copy link
Contributor

Fine by me, let's go for return_elements then 🙂

@Anna-Xiong Anna-Xiong merged commit 3ad4e1d into main Jun 6, 2024
39 checks passed
@Anna-Xiong Anna-Xiong deleted the feat/get_vizro_ai_customized_output branch June 6, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Vizro-AI 🤖 Issue/PR addresses Vizro-AI package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants