From c65644a1757d9b2e4792cd5d0b14dead799348be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=91=E6=A6=86=E8=82=96=E7=89=A9?= Date: Wed, 3 Apr 2024 03:04:31 +0800 Subject: [PATCH] .Net: Improved Logging for 06-memory-and-embeddings.ipynb (#5638) ### Motivation and Context 1. This change is required to provide a more detailed and readable output from the memory search operation. 2. It solves the problem of not having enough information about the relevance of the search results. 3. This change contributes to the scenario where developers are debugging or monitoring the memory search operation, as the enhanced logging will provide more insight into the performance of the search. 4. This change also facilitates learners to modify the search content and test with the stored vector data. ### Description This PR modifies the logging format in the 06-memory-and-embeddings.ipynb file in the semantic-kernel project. The change involves printing out the question and the corresponding response's relevance and text. This will help developers better understand the relevance information of the memory search results. ### Contribution Checklist - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile: Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com> --- dotnet/notebooks/06-memory-and-embeddings.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dotnet/notebooks/06-memory-and-embeddings.ipynb b/dotnet/notebooks/06-memory-and-embeddings.ipynb index 0dc4f28085..5b8e902cd1 100644 --- a/dotnet/notebooks/06-memory-and-embeddings.ipynb +++ b/dotnet/notebooks/06-memory-and-embeddings.ipynb @@ -194,7 +194,8 @@ "foreach (var q in questions)\n", "{\n", " var response = await memory.SearchAsync(MemoryCollectionName, q).FirstOrDefaultAsync();\n", - " Console.WriteLine(q + \" \" + response?.Metadata.Text);\n", + " Console.WriteLine(\"Q: \" + q);\n", + " Console.WriteLine(\"A: \" + response?.Relevance.ToString() + \"\\t\" + response?.Metadata.Text);\n", "}" ] },