You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I was following https://devblogs.microsoft.com/semantic-kernel/integrating-model-context-protocol-tools-with-semantic-kernel-a-step-by-step-guide/.
kernel.Plugins.AddFromFunctions("GitHub", tools.Select(aiFunction => aiFunction.AsKernelFunction()));
worked well until I change AddOpenAIChatCompletion to AddGoogleAIGeminiChatCompletion and its parameter values.
With AddGoogleAIGeminiChatCompletion, the response that should be about the latest commits on Github is about those commited about one year ago. It is not calling a function but just making up using the data in LLM.
To Reproduce
Steps to reproduce the behavior:
Install the followings in Nuget package: ModelContextProtocol (0.1.0-preview.10), Microsoft.SemanticKernel (1.47.0), Microsoft.SemanticKernel.Connectors.Google (1.47.0-alpha)
Run the followings
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Connectors.Google;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using ModelContextProtocol.Client;
using ModelContextProtocol.Protocol.Transport;
#pragma warning disable SKEXP0070
#pragma warning disable SKEXP0001
// Prepare and build kernel
var builder = Kernel.CreateBuilder();
#region AzureOpenAI
/*
builder.Services.AddAzureOpenAIChatCompletion(
deploymentName: Credential.AzureOpenAI.ModelId,
endpoint: Credential.AzureOpenAI.Endpoint,
apiKey: Credential.AzureOpenAI.ApiKey);
OpenAIPromptExecutionSettings executionSettings = new()
{
FunctionChoiceBehavior = FunctionChoiceBehavior.Auto(options: new() { RetainArgumentTypes = true })
};
*/
#endregion
#region GoogleAIGemini
builder.Services.AddGoogleAIGeminiChatCompletion(
Credential.GoogleAIGemini.ModelId,
Credential.GoogleAIGemini.ApiKey
);
GeminiPromptExecutionSettings executionSettings = new()
{
FunctionChoiceBehavior = FunctionChoiceBehavior.Auto(options: new() { RetainArgumentTypes = true }), // shows '2024 commits'
//ToolCallBehavior = GeminiToolCallBehavior.AutoInvokeKernelFunctions // 400 bad request
};
#endregion
Kernel kernel = builder.Build();
// Create an MCPClient for the GitHub server
await using IMcpClient mcpClient = await McpClientFactory.CreateAsync(new StdioClientTransport(new()
{
Name = "GitHub",
Command = "npx",
Arguments = ["-y", "@modelcontextprotocol/server-github"],
}));
var tools = await mcpClient.ListToolsAsync().ConfigureAwait(false);
kernel.Plugins.AddFromFunctions("GitHub", tools.Select(aiFunction => aiFunction.AsKernelFunction()));
var prompt = "Summarize the last four commits to the microsoft/semantic-kernel repository?";
var result = await kernel.InvokePromptAsync(prompt, new(executionSettings)).ConfigureAwait(false);
Console.WriteLine($"\n\n{prompt}\n{result}");
Console.ReadLine();
Expected behavior
A response should include the latest 4 commits of microsoft/semantic-kernel repository.
Describe the bug
I was following https://devblogs.microsoft.com/semantic-kernel/integrating-model-context-protocol-tools-with-semantic-kernel-a-step-by-step-guide/.
kernel.Plugins.AddFromFunctions("GitHub", tools.Select(aiFunction => aiFunction.AsKernelFunction()));
worked well until I change AddOpenAIChatCompletion to AddGoogleAIGeminiChatCompletion and its parameter values.
With AddGoogleAIGeminiChatCompletion, the response that should be about the latest commits on Github is about those commited about one year ago. It is not calling a function but just making up using the data in LLM.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A response should include the latest 4 commits of microsoft/semantic-kernel repository.
Screenshots
Platform
The text was updated successfully, but these errors were encountered: