googleapis / googleapis/java-genai
Function calls with 'id' fails with 400 using Gemini
- Dominant language
- Java
- Stars
- 397
- Forks
- 125
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 41
Description
Thanks for stopping by to let us know something could be better!
**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
Is this a client library issue or a product issue? We will only be able to assist with issues that pertain to the behaviors of this library. If the issue you're experiencing is due to the behavior of the product itself, please visit the [Support page](https://cloud.google.com/support) to reach the most relevant engineers.
If the support paths suggested above still do not result in a resolution, please provide the following details.
#### Environment details
- Programming language: Java
- OS: Linux
- Language runtime version: 17
- Package version: 1.8.0
#### Steps to reproduce
1. Use a multi agent setup using Java Google ADK (v 0.3.0) with a function call.
2. When LLM returns response to invoke a function call, agent invokes and sending the response back to Gemini causes `com.google.genai.errors.ClientException: 400 . Invalid JSON payload received. Unknown name "id" at 'contents[5].parts[0].function_call': Cannot find field.
Invalid JSON payload received. Unknown name "id" at 'contents[6].parts[0].function_response': Cannot find field.`
3. I patched the java-genai package to add @JsonIgnore in FunctionCall and FunctionResponse.
``
@JsonProperty("id")
@JsonIgnore
public abstract Optional id();
``
4. Ran the agent again, and it succeeded.
It looks like Google Gemini does not expect 'id' in Functions but java-genai sends it.
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.