Skip to content

Commit

Permalink
.Net: Improved Logging for 06-memory-and-embeddings.ipynb (#5638)
Browse files Browse the repository at this point in the history
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

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

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

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

<!-- Before submitting this PR, please make sure: -->

- [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 😄

Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
  • Loading branch information
sangyuxiaowu and markwallace-microsoft committed Apr 2, 2024
1 parent 0735e84 commit c65644a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dotnet/notebooks/06-memory-and-embeddings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"}"
]
},
Expand Down

0 comments on commit c65644a

Please sign in to comment.