Gemini ToolPayloadMapper generates invalid tools schema (functionDeclarations must be array, not object)
The class `\NeuronAI\Providers\Gemini\ToolPayloadMapper` generates an invalid Gemini tools schema.
`"tools": {
"functionDeclarations": {
"items": { ... }
}
}`
However, Gemini requires `functionDeclarations` to be an `array of function declaration objects`, not an object keyed by function name.
Because of this mismatch, Gemini rejects the payload with: `Invalid JSON payload received. Unknown name "items" at 'tools.funct...`
### Expected behavior
`ToolPayloadMapper` should generate: `"tools": {
"functionDeclarations": [
{
"name": "items",
"description": "Description",
"parameters": { ... }
}
]
}
`
### Steps to reproduce
1. Implement any toolkit using `ToolkitInterface`
2. Allow NeuronAI to generate the Gemini schema
3. Send the schema to the Gemini `generateContent` endpoint
4. Receive 400 error: `Invalid JSON payload received. Unknown name "items"`
4 条评论