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 have some code that creates a number of agents dynamically, each with a stateful plugin created from a new object instance (following the example in the docs):
publicstaticChatCompletionAgentCreatePlayerAgent(Kernelkernel,intplayerId,stringinitialRole){// Clone kernel instance to allow for agent specific plug-in definitionKernelagentKernel=kernel.Clone();// Initialize plug-in from objectagentKernel.CreatePluginFromObject(newWerewolfPlayerPlugin(playerId,initialRole));// Create the agentreturnnewChatCompletionAgent(){Name=playerId.ToString(),Kernel=agentKernel,Instructions=Prompts.PlayerInstructions,Arguments=newKernelArguments(newOpenAIPromptExecutionSettings(){FunctionChoiceBehavior=FunctionChoiceBehavior.Auto()}){{"playerId",playerId},
...}};}
The plugin itself only has one KernelFunction:
publicclassWerewolfPlayerPlugin{publicintplayerId;publicstringinitialRole;publicWerewolfPlayerPlugin(intplayerId,stringinitialRole){this.playerId=playerId;this.initialRole=initialRole;}[KernelFunction("vote")][Description("Vote for another player to be eliminated")]publicasyncTaskVote([Description("The number of the player you want to vote for")]intid){Console.WriteLine($"Player {playerId} voted for player {id}");Werewolf.CurrentVotes[playerId]=id;}}
When initiating a group chat, I can see from the trace output that the function isn't being loaded:
Choice:auto, AutoInvoke:True, AllowConcurrentInvocation:False, AllowParallelCalls:(null) Functions:None (Function calling is disabled)
However, when I replace the CreatePluginFromObject with:
Looking at the code I believe the example in the docs is incorrect as the plugin isn't added to the plugins collection after being created within the CreatePluginFromObject function:
Describe the bug
I have some code that creates a number of agents dynamically, each with a stateful plugin created from a new object instance (following the example in the docs):
The plugin itself only has one KernelFunction:
When initiating a group chat, I can see from the trace output that the function isn't being loaded:
However, when I replace the
CreatePluginFromObject
with:It loads just fine:
Looking at the code I believe the example in the docs is incorrect as the plugin isn't added to the plugins collection after being created within the
CreatePluginFromObject
function:semantic-kernel/dotnet/src/SemanticKernel.Core/KernelExtensions.cs
Line 406 in 2984423
Whereas in
Plugins.AddFromObject
it is:semantic-kernel/dotnet/src/SemanticKernel.Core/KernelExtensions.cs
Line 676 in 2984423
Platform
The text was updated successfully, but these errors were encountered: