Describe the problem/error/question\
Hi, I’m trying to enforce a structured json format for Gemini 2.0 Flash via specifying response schema.
I cannot find an option to pass responseSchema
to api call in Google Gemini Chat Model
node
When I try to connect structured output parser via AI Agent
node, the whole process fails.
According to google docs Generate structured output with the Gemini API | Google AI for Developers there is support on API to pass schema as an option via responseSchema
What is the error message (if any)?
Bad request - please check your parameters
GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:streamGenerateContent?alt=sse: [400 Bad Request]
Invalid JSON payload received.
Unknown name "type" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[0].value': Proto field is not repeating, cannot start list.
Invalid JSON payload received. Unknown name "type" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[0].value': Proto field is not repeating, cannot start list.
Invalid JSON payload received. Unknown name "type" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[1].value': Proto field is not repeating, cannot start list.
Invalid JSON payload received. Unknown name "type" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[2].value': Proto field is not repeating, cannot start list.
Invalid JSON payload received. Unknown name "type" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[3].value': Proto field is not repeating, cannot start list.
Invalid JSON payload received. Unknown name "type" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[4].value': Proto field is not repeating, cannot start list.
Invalid JSON payload received. Unknown name "type" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[5].value': Proto field is not repeating, cannot start list.
Invalid JSON payload received. Unknown name "type" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[6].value': Proto field is not repeating, cannot start list. [{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"tools[0].function_declarations[0].parameters.properties[0].value.properties[0].value","description":"
Invalid JSON payload received. Unknown name \"type\" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[0].value': Proto field is not repeating, cannot start list."},{"field":"tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[0].value","description":"
Invalid JSON payload received. Unknown name \"type\" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[0].value': Proto field is not repeating, cannot start list."},{"field":"tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[1].value","description":"
Invalid JSON payload received. Unknown name \"type\" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[1].value': Proto field is not repeating, cannot start list."},{"field":"tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[2].value","description":"
Invalid JSON payload received. Unknown name \"type\" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[2].value': Proto field is not repeating, cannot start list."},{"field":"tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[3].value","description":"
Invalid JSON payload received. Unknown name \"type\" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[3].value': Proto field is not repeating, cannot start list."},{"field":"tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[4].value","description":"
Invalid JSON payload received. Unknown name \"type\" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[4].value': Proto field is not repeating, cannot start list."},{"field":"tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[5].value","description":"
Invalid JSON payload received. Unknown name \"type\" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[5].value': Proto field is not repeating, cannot start list."},{"field":"tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[6].value","description":"
Invalid JSON payload received. Unknown name \"type\" at 'tools[0].function_declarations[0].parameters.properties[0].value.properties[1].value.items.properties[6].value': Proto field is not repeating, cannot start list."}]}]
Please share your workflow
I cannot share the code of the full workflow, I can create a sample one if needed
The schema:
{
"type": "object",
"properties": {
"bill_of_lading_number": {
"type": "string",
"nullable": true
},
"containers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"pickup_location": {
"type": "string",
"nullable": true
},
"container_number": {
"type": "string",
"nullable": true
},
"container_type": {
"type": "string",
"nullable": true
},
"pickup_reference": {
"type": "string",
"nullable": true
},
"drop_off_location": {
"type": "string",
"nullable": true
},
"drop_off_reference": {
"type": "string",
"nullable": true
},
"closing_date": {
"type": "string",
"nullable": true
}
},
"required": [
"pickup_location",
"container_number",
"container_type",
"pickup_reference",
"drop_off_location",
"drop_off_reference",
"closing_date"
]
}
}
},
"required": ["bill_of_lading_number", "containers"]
}
Share the output returned by the last node
The output is the error above
Information on your n8n setup
- n8n version: 1.78.1
- Database (default: SQLite): postgresql
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): k8s
- Operating system: Linux