GetChatMessageContentAsync update with infromation from SK - c# #7404
-
With a prompt that instructs an LLM to update the user on what it's doing, and GetChatMessageContentAsync we've manged to get updates like: I will now fetch data from the database -> a call of SK. Sometimes, we do a lot of heavy lifting in the function, e.g.: Validate user input, call LLM to generate SQL, run SQL, and possibly process the data fetched from the database—the call can last 2-5 seconds. Is there a way to feed the LLM/and then the LLM to update the user via GetChatMessageContentAsync method, with custom messages from the SK like: we are parsing your input |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@JP-droidic If your operations like parsing an input, generating SQL, running the query are SK functions, then you could use Filter definition: Filter registration: Please let us know if this could cover your scenario. Thanks! |
Beta Was this translation helpful? Give feedback.
@JP-droidic If your operations like parsing an input, generating SQL, running the query are SK functions, then you could use
IFunctionInvocationFilter
to receive a call before each function is executed. When it happens, you can get an information about function, it's arguments, rendered prompt etc, so you can share this information with user.Filter definition:
semantic-kernel/dotnet/samples/Concepts/Filtering/FunctionInvocationFiltering.cs
Lines 262 to 272 in de2f1bf