Skip to content

.Net: New Feature: Gemini Grounding with Google Search #11735

@scherervictor

Description

@scherervictor

name: Gemini - Grouding with Google Search
about: Gemini supports grouding with Google Search if configured properly on the request, would be nice to have the option to configure this param (Doc reference)


Activity

markwallace-microsoft

markwallace-microsoft commented on Apr 25, 2025

@markwallace-microsoft
Member

@scherervictor Would you be interested in contributing this functionality to the Semantic Kernel?

scherervictor

scherervictor commented on Apr 25, 2025

@scherervictor
Author

@markwallace-microsoft sure! I could try to do that.

dmm-l-mediehus

dmm-l-mediehus commented on Apr 29, 2025

@dmm-l-mediehus

@markwallace-microsoft If the docs is:

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=$GOOGLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "contents": [
          {
              "parts": [
                  {"text": "What is the current Google stock price?"}
              ]
          }
      ],
      "tools": [
          {
              "google_search": {}
          }
      ]
  }' > result.json

cat result.json

Would it be equivelent to this in SK?

GeminiPromptExecutionSettings settings = new()
{
    ModelId = AIModel.Google_Gemini25ProPreview.ToModelIdentifier(),
    ServiceId = AIModel.Google_Gemini25ProPreview.ToModelIdentifier(),
    MaxTokens = 32768,
    ExtensionData = new Dictionary<string, object>()
    {
        ["tools"] = new List<Dictionary<string, object>>
        {
            new() 
            {
                ["google_search"] = new Dictionary<string, object>()
            }
        }
    }
};
scherervictor

scherervictor commented on Apr 29, 2025

@scherervictor
Author

@markwallace-microsoft @rogerbarreto I've created a PR implementing this, could you review it, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codeai connectorAnything related to AI connectors

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @rogerbarreto@scherervictor@dmm-l-mediehus@markwallace-microsoft

    Issue actions

      .Net: New Feature: Gemini Grounding with Google Search · Issue #11735 · microsoft/semantic-kernel