google / google/generative-ai-docs

Function schemas don't allow maxItems/minItems

Open
#210 1 comment 3 reactions 0 assignees View on GitHub
type:feature request
Dominant language
Jupyter Notebook
Stars
2.3k
Forks
735
PR merge metrics
No merged PRs in 30d

Description

### Description of the bug:

Using the Gemini Pro API, If you have a function definition like this:

```
{
name: "myFunction",
parameters: {
type: "object",
properties: {
choices: {
type: "array",
minItems: 5,
maxItems: 5,
items: {type: "string"}
}
}
}
}
```

the API will return an error about minItems and maxItems like:

```
Invalid JSON payload received. Unknown name "maxItems" at 'tools[0].function_declarations[0].parameters.properties[0].value': Cannot find field.
Invalid JSON payload received. Unknown name "minItems" at 'tools[0].function_declarations[0].parameters.properties[0].value': Cannot find field.
```

### Actual vs expected behavior:

It should accept the maxItems/minItems properties, which are part of JSON/OpenAPI schemas.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.