generative-ai-python icon indicating copy to clipboard operation
generative-ai-python copied to clipboard

Update pydantic import to fix b/343572011 in g3

Open YuncongZhou opened this issue 1 year ago • 5 comments

The commit is a mirror of cl/638491582 by ayzhou@

As indicated in b/343572011, the issue affect all Python SDK FC usage in g3 including the official function calling colab.

The issue is very similar to b/325114802, b/331534434, which are then fixed with cl/619453719.

Description of the change

Update pydantic import to fix b/343572011. It is a mirror of cl/638491582 by ayzhou@

Motivation

b/343572011

Type of change

Bug fix

Checklist

  • [ X] I have performed a self-review of my code.
  • [ X] I have added detailed comments to my code where applicable.
  • [ X] I have verified that my change does not break existing code.
  • [ X] My PR is based on the latest changes of the main branch (if unsure, please run git pull --rebase upstream main).
  • [X ] I am familiar with the Google Style Guide for the language I have coded in.
  • [ X] I have read through the Contributing Guide and signed the Contributor License Agreement.

YuncongZhou avatar May 31 '24 16:05 YuncongZhou

Thanks, I'll take a look.

MarkDaoust avatar Jun 03 '24 22:06 MarkDaoust

Interesting.

  1. it looks like v1 isn't just a google thing. It's in the OSS installation too:
import pydantic

pydantic.version.VERSION
# 2.7.3
pydantic.v1.version.VERSION
# 1.10.15

So even if you have v2 you get v2 (that's why the tests here are failing)

I think we need a way to get the basics all running in v1 and ... the output is different?

MarkDaoust avatar Jun 03 '24 22:06 MarkDaoust

Added a test workflow to test with pydantic-1.

If we want this to successfully close that bug, we need to get those tests working, or expolicitly choose some acceptable subset of them and tag the others with a skipif .

MarkDaoust avatar Jun 03 '24 23:06 MarkDaoust

  1. It looks like pydantic1 handles the nested TypedDicts differently from pydantic2
  2. It looks like nullable is handled differently

MarkDaoust avatar Jun 03 '24 23:06 MarkDaoust

b/342443131

MarkDaoust avatar Sep 17 '24 16:09 MarkDaoust

Sorry about the delay. Fixing this internally.

cl/691199002

MarkDaoust avatar Oct 29 '24 23:10 MarkDaoust

Fixing internally.

MarkDaoust avatar Jan 08 '25 21:01 MarkDaoust

cl/691199002

MarkDaoust avatar Jan 08 '25 21:01 MarkDaoust