Skip to content

.Net: Introduce Grounding with Google Search configuration #11804

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 9 commits into
base: main
Choose a base branch
from

Conversation

scherervictor
Copy link

@scherervictor scherervictor commented Apr 29, 2025

Motivation and Context

This PR is enables the configuration of Grouding with Google Search in the Gemini API.

Description

  • Added grounding_config that receives google_search object
  • Implemented a validation to add googleSearch under tools object if configured.
  • Adding proper deserialization of possible values returning after using Grouding.
  • Included unit tests to validate the functionality for GroudingConfig and GoogleSearch.

Contribution Checklist

@scherervictor scherervictor requested a review from a team as a code owner April 29, 2025 12:00
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel documentation labels Apr 29, 2025
@scherervictor
Copy link
Author

@microsoft-github-policy-service agree

@MarioGK
Copy link

MarioGK commented Jun 7, 2025

Are there any blockers to merge this?

@markwallace-microsoft markwallace-microsoft changed the title .Net: Introduce Grouding with Google Search configuration .Net: Introduce Grounding with Google Search configuration Jun 10, 2025
{
request.Tools.Add(new GeminiTool());
}
request.Tools[0].GoogleSearch = new GeminiTool.GoogleSearchProperties();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fully sure of this behavior here, in theory this adds the configuration to existing tools as well, and just the first of them?

Copy link
Author

@scherervictor scherervictor Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RogerBarreto Actually, according to their documentation combining search with function calling isn't yet supported. Ref: https://ai.google.dev/gemini-api/docs/grounding?lang=rest#configure-search

So from what I've tested, this configuration overrides the function call declaration. But I believe we could adjust to add this tool to the array instead of setting to the first one, wdyt?

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
None yet
Development

Successfully merging this pull request may close these issues.

.Net: New Feature: Gemini Grounding with Google Search
4 participants