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

Improve schema support #309

Merged
merged 17 commits into from May 8, 2024
Merged

Conversation

MarkDaoust
Copy link
Collaborator

@MarkDaoust MarkDaoust commented May 1, 2024

class Person(typing.TypedDict):
    name: str
    birthday: str
    favorite_food: str

m = genai.GenerativeModel(model_name="gemini-1.5-pro-latest")
result = m.generate_content(
     "describe a person",
    generation_config={
        "response_mime_type": "application/json",
        "response_schema": Person},
)

Change-Id: I22476536eb12027eb6b3a6dfcfa95cf61d2f4c0c
Change-Id: I51f761d87ab62465c50881301714aa5c38e7056d
Change-Id: I4739d8c46b0815134d55fbff4413544cb71a39fe
Change-Id: If97e7265954db092cfba54b0f61c1606d4b9b1d2
@MarkDaoust MarkDaoust marked this pull request as draft May 1, 2024 18:50
@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:python sdk Issue/PR related to Python SDK labels May 1, 2024
Change-Id: I426db26133356eed885f7702ff2c465631adc418
Change-Id: Id722f2a02b0115dfbdaafe5b9a9f56ad4c6737b1
Change-Id: I3595531b4c974a3bee0291abec470e625722dfb2
Change-Id: Ia05084dd6e59009f6fca590c5a7e42b537964a51
Change-Id: I98cb8da98b0bb9aae7adcf073cd648b152410552
Change-Id: Ic669469d4a08e5d881b20dd9495669adeb4e7014
Change-Id: I357015d36c95b673501445d7595d34f5ea88087d
Change-Id: Iade8b6f91b2d26a29c90890a4b67678927f73a44
Change-Id: Id6f123168f12657eb2c01f36aff848d717244554
@MarkDaoust MarkDaoust marked this pull request as ready for review May 6, 2024 23:14
Change-Id: Id7a17d5fba055020bc9bd94d98bd585ed19171df
Change-Id: Iacbcb1acbd468347ffb2b873258a1d0737c947d7
Change-Id: I106cdf98a950ae6bf92dcf58c98064c09f5da5f4
Change-Id: I1de22340f48ed2d6ae54423419a33965a7bc3a67
@MarkDaoust MarkDaoust changed the title Nested schema support Improve schema support May 7, 2024
Copy link
Member

@markmcd markmcd left a comment

Choose a reason for hiding this comment

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

Nice!

@MarkDaoust MarkDaoust merged commit e09e7f2 into google-gemini:main May 8, 2024
7 checks passed
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:python sdk Issue/PR related to Python SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants