Skip to content

Support JSON schema for Gemini 2.5 #6494

Description

@namuorg

Description

One of the limitations of using structured outputs with Gemini is that it uses a subset of the OpenAPI 3.0 spec rather than JSON Schema:

This prevents enabling structured outputs when using Zod unions and records.

However, Gemini 2.5 models now support JSON Schema as a preview: https://ai.google.dev/gemini-api/docs/structured-output#json-schema

I would love for the AI SDK to support submitting JSON Schema to Gemini 2.5 models as it would allow enabling structured outputs for higher quality output that follows the schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelfeatureNew feature or requestprovider/googleIssues related to the @ai-sdk/google providertask-identify-issue-type-done

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions