Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type: "enum", values: [...] is not accepted #320

Open
LaKing opened this issue Jan 4, 2025 · 0 comments
Open

type: "enum", values: [...] is not accepted #320

LaKing opened this issue Jan 4, 2025 · 0 comments

Comments

@LaKing
Copy link

LaKing commented Jan 4, 2025

Description of the bug:

According to the documentation at https://ai.google.dev/gemini-api/docs/function-calling

Best practices for function declarations
...
properties > type: Use strongly typed parameters to reduce model hallucinations. For example, if the parameter values are from a finite set, use an enum field instead of listing the values in the description (e.g., "type": "enum", "values": ["now_playing", "upcoming"]). If the parameter value is always an integer, set the type to integer rather than number.
...

However, using the "enum" type with a values array sent, results in errors.
Error: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:streamGenerateContent?alt=sse: [400 Bad Request] Invalid value at 'tools.function_declarations[1].parameters.properties[1].value.type' (type.googleapis.com/google.ai.generativelanguage.v1beta.Type), "enum"

Invalid value at 'tools.function_declarations[2].parameters.properties[1].value.type' (type.googleapis.com/google.ai.generativelanguage.v1beta.Type), "enum"
Invalid JSON payload received. Unknown name "values" at 'tools.function_declarations[2].parameters.properties[1].value': Cannot find field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant