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
{{ message }}
Repository navigation
.Net: Bug: FunctionChoiceBehavior.None() does not prevent function call with AddAzureOpenAIChatClient #12209
Describe the bug
When specifying FunctionChoiceBehavior.None(), functions should not be called. However, when using AddAzureOpenAIChatClient, the function is still invoked. This issue does not occur when using AddAzureOpenAIChatCompletion, where the function is not called as expected. This only happens with AddAzureOpenAIChatClient.
To Reproduce
Steps to reproduce the behavior:
Create a new Console App project.
Add the following NuGet packages to your project:
Azure.Identity
Microsoft.SemanticKernel
Run the following code snippet:
usingAzure.Identity;usingMicrosoft.SemanticKernel;usingSystem.ComponentModel;varbuilder=Kernel.CreateBuilder();builder.AddAzureOpenAIChatClient("<<Your model deployment name>>","https://<<Your AOAI resource name>>.openai.azure.com/",newAzureCliCredential());builder.Plugins.AddFromType<TimePlugin>();varkernel=builder.Build();varresult=awaitkernel.InvokePromptAsync("What is the current date and time?",arguments:new(newPromptExecutionSettings{FunctionChoiceBehavior=FunctionChoiceBehavior.None(),}));Console.WriteLine(result.GetValue<string>());publicclassTimePlugin{[KernelFunction,Description("Returns the current local date and time as a formatted string (yyyy/MM/dd HH:mm:ss).")]publicstringGetCurrentDateTime()=>TimeProvider.System.GetLocalNow().ToString("yyyy/MM/dd HH:mm:ss");}
AI answers the prompt and calls the function, returning the current date and time like this:
The current date and time is 2025/05/21 13:35:05.
Expected behavior
The function should not be called, and the AI should respond based only on its own knowledge, without using any registered functions.
changed the title [-]Bug: FunctionChoiceBehavior.None() does not prevent function call with AddAzureOpenAIChatClient[/-][+].Net: Bug: FunctionChoiceBehavior.None() does not prevent function call with AddAzureOpenAIChatClient[/+]on May 21, 2025
Activity
[-]Bug: FunctionChoiceBehavior.None() does not prevent function call with AddAzureOpenAIChatClient[/-][+].Net: Bug: FunctionChoiceBehavior.None() does not prevent function call with AddAzureOpenAIChatClient[/+].Net: Fixes MCP Behavior for AIFunction.AsKernelFunction() + Fix ensu…
.Net: Fixes MCP Behavior for AIFunction.AsKernelFunction() + Fix ensu…
.Net: Fixes MCP Behavior for AIFunction.AsKernelFunction() + Fix ensu…