Possible Bug: context.Terminate Ignored When Using JSON Schema in .NET Semantic Kernel (1.39.0) #10721
-
I have a solution in .NET Semantic Kernel (1.39.0) with multiple agents and plugins. I want to return a result to the user based on a kernel function, where the user first needs to make a choice before other tools can be invoked. An example of this is: "Search for information about employee: X." I have applied an IAutoFunctionInvocationFilter to achieve this. This works when I return only text from the agents(ResponseFormat = Text). However, when I define a JSON schema on the agent, other tool calls are still invoked, even though I set context.Terminate = true in my function. It seems that when a JSON schema is defined on the agent, context.Terminate does nothing. Below, I have added my sample code. Is this the correct way to implement this, or are there better approaches to achieve this? Example code
In my agent i have an class AssistantCreationOptions with ResponseFormat = BaseModel class (json object) public enum Action
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@StefandewitSPS Thanks for asking this question!
I think the approach presented by you is correct and should cover your scenario.
I'm not sure if |
Beta Was this translation helpful? Give feedback.
@StefandewitSPS Thanks for asking this question!
I think the approach presented by you is correct and should cover your scenario.
I'm not sure if
context.Terminate
depends on the format of response, whether it's a text or JSON schema, but I will need to double check. Thanks for providing code snippet for your filter and JSON schema. In order to reproduce this behavior, I will also need an example of your agent initialization as well as the example of agent invocation, if possible. Thank you!