Skip to content

FR: add responseJsonSchema to GenerationConfig type #9625

@cairomassimo

Description

@cairomassimo

Operating System

Environment (if applicable)

Firebase SDK Version

12.10.0

Firebase SDK Product(s)

AI

Project Tooling

Detailed Problem Description

Exported type GenerationConfig does not include responseJsonSchema. If a value is passed anyway, it is correctly interpreted by the backend.

Using responseJsonSchema is crucial, as it allows using zod to specify the type (via .toJSONSchema()), allowing the user to inherit all the benefits of zod. Updating the types is a quick change that would save a lot of time to any user trying to use zod (as in this example https://ai.google.dev/gemini-api/docs/structured-output?example=recipe#javascript_2) with Firebase AI Logic.

Steps and code to reproduce issue

const schema = z.object({
  value: z.string(),
})

getGenerativeModel(ai, {
  model: "gemini-3-flash-preview",
  generationConfig: {
    responseMimeType: "application/json",
    responseJsonSchema: schema.toJSONSchema(), // TypeScript error here
  },
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions