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

[Feature] Bump VizroAI to pydantic V2 #1018

Merged
merged 37 commits into from
Feb 25, 2025
Merged

Conversation

maxschulz-COL
Copy link
Contributor

@maxschulz-COL maxschulz-COL commented Feb 13, 2025

Description

[Update]

  • We agreed on finishing pydantic v2 migration by still using langchain with_structured_output.
  • Keep the door open for eventually switching to PydanticAI when the timing is right. (Also excited to see the support for structured output is on PydanticAI's roadmap: PydanticAI Roadmap pydantic/pydantic-ai#913)
  • The good news is that now apart from OpenAI models, claude and gemini (possibly other vendors too but I didn't try) can work with the dashboard/plot tasks fairly well too.

This is a draft of a first working version, will hand off to you @lingyielia now, because you are probably better positioned to do the fine-tuning. I also left one todo for you @nadijagraca , maybe you already have some time this week?

Overall considerations

--> Ergo overall I am still confident in us changing to pydanticAI - but I left the core code in in case you disagree @lingyielia .

ToDos

  • Finish all TODOs in the code marked as TODO[LZ] or TODO[NG] respectively
  • Delete remainders of langchain if we decide against it
  • Change examples, documentation and code for new way of configuring models
  • Fix the remaining unit tests

Screenshot

Notice

  • 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.

@github-actions github-actions bot added the Vizro-AI 🤖 Issue/PR that addresses Vizro-AI package label Feb 13, 2025
Copy link
Contributor

github-actions bot commented Feb 14, 2025

View the example dashboards of the current commit live on PyCafe ☕ 🚀

Updated on: 2025-02-24 17:44:26 UTC
Commit: 686477b

Compare the examples using the commit's wheel file vs the latest released version:

vizro-core/examples/scratch_dev

View with commit's wheel vs View with latest release

vizro-core/examples/dev/

View with commit's wheel vs View with latest release

vizro-core/examples/visual-vocabulary/

View with commit's wheel vs View with latest release

vizro-ai/examples/dashboard_ui/

View with commit's wheel vs View with latest release

@huong-li-nguyen huong-li-nguyen marked this pull request as draft February 17, 2025 15:45
@lingyielia
Copy link
Contributor

langchain_openai with_structured_output supports "function_calling" and "json_schema".

This means if we now use

llm_model.with_structured_output(
                response_model,
                method="function_calling",
            )

it's equivalent to what we did before pydantic v2 migration.

If this conclusion is true, I'd prefer to first ship pydantic v2 migration code along with .with_structured_output(method="function_calling") in this PR. And we open another PR to do the pydanticAI migration (this task is time consuming, with a lot of docs change and unit tests change if I'm correct)

Let know wdyt @maxschulz-COL :)

@lingyielia lingyielia marked this pull request as ready for review February 20, 2025 05:40
Copy link
Contributor Author

@maxschulz-COL maxschulz-COL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐ Looks good to me! ⭐

Thanks for partially reverting stuff, and great inquisition as to the default behaviour before 0.3.0!

Copy link
Contributor

@lingyielia lingyielia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good on my side now. @maxschulz-COL may I have another review from you?

Copy link
Contributor Author

@maxschulz-COL maxschulz-COL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Contributor

@nadijagraca nadijagraca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Great job. 🚀

I noticed just small visual issue in the chart UI (not caused by this PR) that I will fix in a separate small PR this week.

@lingyielia lingyielia merged commit 96d1336 into main Feb 25, 2025
46 checks passed
@lingyielia lingyielia deleted the feature/bump_vizroai_v2 branch February 25, 2025 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Vizro-AI 🤖 Issue/PR that addresses Vizro-AI package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants