Skip to content

.Net Bug: Google Connector with Nullable Enum in Plugin Call - Bad Request #11395

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

Closed
DevEnable opened this issue Apr 7, 2025 · 1 comment · Fixed by #11617
Closed

.Net Bug: Google Connector with Nullable Enum in Plugin Call - Bad Request #11395

DevEnable opened this issue Apr 7, 2025 · 1 comment · Fixed by #11617
Assignees
Labels
ai connector Anything related to AI connectors bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@DevEnable
Copy link

Describe the bug
I was troubleshooting a scenario where I was getting bad request responses from my custom Semantic Kernel plugin when using the Google connector. The plugin works fine with Open AI. One of the arguments on the method is a nullable enum type. If I changed this to no longer be nullable. E.g. instead of a RemoteWork? enum I just use RemoteWork the function call goes through fine.

To Reproduce
Steps to reproduce the behavior:

  1. Create a simple plugin with an enum type as a method argument, and allow it to be null (with the default value of null)
  2. Have the Google LLM call the plugin in a chat connector session (using auto function choice, and auto invoke kernel functions)
  3. When the function is called the call to await chatCompletionService.GetChatMessageContentAsync from the IChatCompletionService implementation will fail with a 400 bad request. Looking at the response content from Google you get the below error.

{
"error": {
"code": 400,
"message": "* GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[remoteWork].enum: only allowed for STRING type\n* GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[remoteWork].type: must be specified when not using one_of, any_of or all_of fields\n",
"status": "INVALID_ARGUMENT"
}
}

Expected behavior
You should be able to pass in nullable enum parameters and have them parsed correctly by the plugin.

Platform

  • Language: C#
  • Source: Microsoft.SemanticKernel.Connectors.Google 1.45.0-alpha
  • AI model: gemini-2.5-pro-preview-03-25 and gemini-2.0-flash
  • IDE: Jetbrains Rider
  • OS: Mac

Additional context
Was initially discussed in the Azure AI Community Discord - conversation starts here.

@DevEnable DevEnable added the bug Something isn't working label Apr 7, 2025
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Apr 7, 2025
@github-actions github-actions bot changed the title .NET Bug: Google Connector with Nullable Enum in Plugin Call - Bad Request .Net Bug: Google Connector with Nullable Enum in Plugin Call - Bad Request Apr 7, 2025
@DevEnable
Copy link
Author

Also, the initial fix for this was made here. It probably just needs to be further accommodated for nullable types.

@markwallace-microsoft markwallace-microsoft added ai connector Anything related to AI connectors and removed triage labels Apr 7, 2025
@RogerBarreto RogerBarreto moved this from Bug to Sprint: In Progress in Semantic Kernel Apr 17, 2025
@RogerBarreto RogerBarreto moved this from Sprint: In Progress to Community PRs in Semantic Kernel Apr 17, 2025
@RogerBarreto RogerBarreto moved this from Community PRs to Sprint: In Progress in Semantic Kernel Apr 17, 2025
@RogerBarreto RogerBarreto moved this from Sprint: In Progress to Community PRs in Semantic Kernel Apr 17, 2025
@RogerBarreto RogerBarreto moved this from Community PRs to Sprint: In Review in Semantic Kernel Apr 17, 2025
github-merge-queue bot pushed a commit that referenced this issue Apr 17, 2025
### Motivation and Context

- Fix #11395 

AIJsonUtilities Schema generation does not generate the `type` for
`enum` properties, this workaround became necessary to allow enums to be
used with VertexAI/GoogleAI API's.

FYI @eiriktsarpalis
github-merge-queue bot pushed a commit that referenced this issue Apr 17, 2025
### Motivation and Context

- Fix #11395 

AIJsonUtilities Schema generation does not generate the `type` for
`enum` properties, this workaround became necessary to allow enums to be
used with VertexAI/GoogleAI API's.

FYI @eiriktsarpalis
@RogerBarreto RogerBarreto moved this from Sprint: In Review to Sprint: Done in Semantic Kernel Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai connector Anything related to AI connectors bug Something isn't working .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: Done
Development

Successfully merging a pull request may close this issue.

3 participants