semantic-kernel
semantic-kernel copied to clipboard
.Net: New Feature: Gemini Grounding with Google Search
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)
@scherervictor Would you be interested in contributing this functionality to the Semantic Kernel?
@markwallace-microsoft sure! I could try to do that.
@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>()
}
}
}
};
@markwallace-microsoft @RogerBarreto I've created a PR implementing this, could you review it, please?