Skip to content

Use Kernel Memory as Retrieval Process #693

Answered by vkilohani
Skyquek asked this question in 1. Q&A
Discussion options

You must be logged in to vote

Try something like this inside the chat function.

        var searchResult = await memory.SearchAsync(input, limit: 2, minRelevance: 0.5);
       if (searchResult .Results.Count == 0)
            {
                  return "INFO NOT FOUND"; // or whatever you want
             }
       else
            {
                String answer = "";

                foreach (Citation resultByDoc in searchResult.Results)
                {
                    int i = 1;
                    answer += $"DocumentId: {resultByDoc.DocumentId}\n";
                    foreach (Citation.Partition result in resultByDoc.Partitions)
                    {
                        answer += $"\nChunk {i}: " + $"{r…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Skyquek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
1. Q&A
Labels
None yet
2 participants