Skip to content

.Net: Empty completion response with gemini-2.5-flash-preview-05-20 #12334

@drch-

Description

@drch-

Describe the bug
Running the GoogleAIUsingChatCompletion test generates no output when using gemini-2.5-flash-preview-05-20.

When no PromptExecutionSettings is passed (ie, is null), a default is created with a MaxTokens of 256. This appears to be a mistake as in the implementation of ClientBase it says that null indicates that the model's own default value should be used.

With these thinking models it's possible to use up the MaxTokens in the thinking phase. The model then returns an empty response as it does not include the thinking phase in the output. The result from the test is no output and with a metadata "FinishReason" => "MaxTokens".

The fix is probably removing this 256 default minimum and allowing it to be null in order to use the model's own default max tokens.

Platform

  • Language: C#
  • Source: main branch
  • AI model:
  • IDE: Visual Studio
  • OS: Windows

Metadata

Metadata

Assignees

Labels

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

Type

Projects

Status

Bug

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions