-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
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
justinr1234
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Done