Skip to content

.Net: Introduce Gemini Thinking Budget Configuration. #11647

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

shethaadit
Copy link
Contributor

@shethaadit shethaadit commented Apr 18, 2025

Description

PR Title:

feat(connectors-google): Introduce Gemini Thinking Budget Configuration

Closes 11645

Description:

This pull request introduces the GeminiThinkingConfig class and the ThinkingConfig property within GeminiPromptExecutionSettings to support the thinking budget feature available in Gemini 2.5 and similar experimental models.

Key changes include:

  • Added the GeminiThinkingConfig class with a ThinkingBudget property for controlling the number of thinking tokens.
  • Implemented validation and clamping logic for the ThinkingBudget property within GeminiThinkingConfig, ensuring it adheres to the API requirements (range 0-24576, with 1-1023 clamped to 1024).
  • Added the ThinkingConfig property to GeminiPromptExecutionSettings, allowing users to configure the thinking budget for Gemini 2.5 models.
  • Implemented a check within the ThinkingConfig property setter to ensure it's only used with Gemini 2.5 model IDs, throwing an InvalidOperationException otherwise.
  • Included comprehensive unit tests to verify the functionality of both ThinkingConfig and ThinkingBudget, covering valid and invalid input scenarios, as well as the model ID restriction.

This enhancement enables developers to leverage the thinking budget feature for more complex tasks with supported Gemini models.

Contribution Checklist

Fixes #11645

@shethaadit shethaadit requested a review from a team as a code owner April 18, 2025 21:30
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels Apr 18, 2025
@github-actions github-actions bot changed the title Introduce Gemini Thinking Budget Configuration. .Net: Introduce Gemini Thinking Budget Configuration. Apr 18, 2025
@shethaadit
Copy link
Contributor Author

Hi @RogerBarreto / @markwallace-microsoft, appreciate your help in reviewing this PR.

shethaadit and others added 5 commits April 22, 2025 08:29
Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
…ettings.cs

Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
…ettings.cs

Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
@shethaadit shethaadit requested a review from RogerBarreto April 22, 2025 16:45
@RogerBarreto RogerBarreto moved this from Community PRs to Sprint: In Review in Semantic Kernel Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: In Review
Development

Successfully merging this pull request may close these issues.

.Net: New Feature: Support of thinking_config for Gemini connector
4 participants