Closed JohnGalt1717 closed 10 months ago
hi @JohnGalt1717 we've made it easier in the latest version 0.20, e.g.
var results = await memory.SearchSummariesAsync(filter: MemoryFilters.ByDocument("doc1"));
That will work with any pipeline as long as the summarization step is included. Here's a complete example: https://github.com/microsoft/kernel-memory/blob/main/examples/106-dotnet-retrieve-synthetics/Program.cs
You can leverage the same feature if you have custom handlers that generate synthetic memories (the summary is a synthetic memory). For instance, assume you have a TranslationHandler that translates documents, adding the "translation" synthetic tag (AddSyntheticTag("translation")
), you can then retrieve those translations with code like this:
var results = await memory.SearchSyntheticsAsync("translation", filter: MemoryFilters.ByDocument("doc1"));
forgot to add, if you're using the web service, you can also do:
POST /search
{
"filters": [
{
"__document_id": ["doc1"],
"__synth": ["summary"]
}
]
}
Great! Thanks!
Bing chat says that this should work:
which obviously doesn't and I can't find anything in the documentation to get the summary that was extracted during the pipeline stage when using Constants.PipelineWithSummary
How does one retrieve it?