Skip to content

.Net: Bug: Gemini Responses Don't Deserialize (calling functions) #12347

@DevEnable

Description

@DevEnable

Describe the bug
This seems to be an issue which has only started to occur in the last 12-24 hours. Previously the connector was working fine. No changes have been made to the code since. (Apart from updating to the latest version of SK to try and resolve this issue)

I'm guessing the issue is because Google has changed their API contract in some way

To Reproduce

  • Create an application that uses the Google connector and either Flash or Gemini 2.5 Pro that calls a function (auto)
  • When SK / the LLM tries to call the function it will fail to deserialise. Running a debugger across it I can see the issue is when it is deserialising the GeminiPart and after deserialising the object it calls IsValid. This fails as ALL of the parts are null. Here is an obfusciated response I can see from Google using the exception's Data dictionary "ResponseData":

{
"candidates": [
{
"content": {
"parts": [
{
"thought": true,
"thoughtSignature": "xyz=="
},
{
"functionCall": {
"name": "MyPlugin_my_function",
"args": {
"requests": [
{
"MyArg": "MyValue"
}
]
}
}
}
],
"role": "model"
},
"finishReason": "STOP",
"index": 0
}
],
...
}

As you can se the "functionCall" is present. I'm not sure what has changed as I've not retrieved a prior working version.

Expected behavior
The response from Google should deserialise.

Platform

  • Language: C#
  • Source: Microsoft.SemanticKernel.Connectors.Google 1.54.0-alpha (connector, other SK libraries are 1.54.0)
  • AI model: gemini-2.5-flash-preview-05-20, gemini-2.5-pro-preview-05-06.

I just tried gemini-2.5-pro-preview-03-25 and it also has the same problem.

  • IDE: Jetbrains Rider
  • OS: Mac

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't working

Type

Projects

Status

Backlog: Planned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions