Skip to content

[FEATURE] Google Gemini - Add support for structure JSON output, additional generation configuration options #14886

@malexanderlim

Description

@malexanderlim

Structured JSON

Gemini supports responding consistently in JSON using generation_config={"response_mime_type": "application/json"}

This can be used standalone, without providing a schema and also with providing a schema.

We should create two new props: JSON Output, and an async optional additionalProp for Response Schema to optionally accept a response schema. Please also link out to the documentation here.

https://ai.google.dev/gemini-api/docs/structured-output?lang=rest#supply-schema-in-config

Something like:

    responseFormat: {
      type: "boolean", 
      label: "JSON Output",
      description: "Enable to receive responses in structured JSON format instead of plain text. Useful for automated processing, data extraction, or when you need to parse the response programmatically. You can optionally define a specific schema for the response structure.",
      optional: true,
      default: false,
    },
  },
  async additionalProps() {
    const props = {};
    if (this.responseFormat) {
      props.responseSchema = {
        type: "object",
        label: "Response Schema",
        description: "Define the structure of the JSON response. Must be a valid JSON schema object. Leave empty to let Gemini determine the structure.",
        optional: true,
      };
    }

Additional generation configuration

https://ai.google.dev/api/generate-content#generationconfig
Please include:

  • Max Output Tokens (dependent on the model selected),
  • Temperature
  • Top P
  • Top K
  • Stop Sequences

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions