mirascope icon indicating copy to clipboard operation
mirascope copied to clipboard

Add support for Gemini Structured Outputs

Open willbakst opened this issue 5 months ago • 0 comments

Description

Recently Google released Structured Outputs for Gemini (much like OpenAI).

Should be fairly simple to enable this by updating setup_call for gemini and updating the warning to include gemini as a module that supports strict in the response model schema (although it seems like structured outputs for tools is not quite supported).

See: https://ai.google.dev/gemini-api/docs/json-mode?lang=python#supply-schema-in-config

Only difficulty I can see right now is that the only two supported inputs are either raw type annotations (so no BaseModel) or their genai.protos.Schema type (which will require conversion from BaseModel). Should have most of this implemented already I believe, so still shouldn't be terribly difficult.

willbakst avatar Sep 05 '24 19:09 willbakst