-
Notifications
You must be signed in to change notification settings - Fork 3.8k
.Net: New Feature: Support of thinking_config for Gemini connector #11645
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
Labels
Comments
Hi @markwallace-microsoft @RogerBarreto / @westey-m, I have raised PR to add new feature. Could you please review this? |
github-merge-queue bot
pushed a commit
that referenced
this issue
Apr 25, 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 - [Y] The code builds clean without any errors or warnings - [Y] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [Y] All unit tests pass, and I have added new tests where possible - [Y] I didn't break anyone 😄 Fixes #11645 --------- Co-authored-by: Adit Sheth <adsheth@microsoft.com> Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
name: Support of thinking_config for Gemini connector
about: Recently Google has updated Gemini 2.5 Flash model and added
thinking_config
withthinking_budget
: https://ai.google.dev/gemini-api/docs/thinking#set-budgetRecently Google has updated Gemini 2.5 Flash model and added
thinking_config
withthinking_budget
: https://ai.google.dev/gemini-api/docs/thinking#set-budgetIt would be great to support this feature in Gemini connector for .NET.
The text was updated successfully, but these errors were encountered: