kernel-memory
kernel-memory copied to clipboard
Semantic Kernel plugin - sample with reference
Could you provide sample how to use Semantic Kernel plugin to answer question in a way that also provide reference to reference document? Something similar what is availably already while using Azure Open AI with own data.
I've hit a similar issue - wanting to retain RelevantSources from MemoryAnswer but still getting the benefit of further prompt instructions controlling output formatting, etc from Semantic Kernel.
The workaround I've found is to simply not use the 'plugin' model at all and invoke both operations independently.
- Call
IKernelMemory.AskAsync()independently (Instead of something like{{memory.ask $input}}inside a Semantic Kernel prompt) - Pass
MemoryAnswer.Resultinto my Semantic Function as an input variable inKernelArguments - Call
Kernel.InvokeAsync() - Construct a custom Result class combining
MemoryAnswer.RelevantSourcesand Semantic Kernel'sFunctionResult.Value
I'm not sure if there is a way to do this with the plugin as it stands today.