Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #851 : relevanceThreshold is not utilized preventing additional memory items #920

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

habanoz
Copy link
Contributor

@habanoz habanoz commented Apr 6, 2024

fix bug related to issue #851.
Unused parameter relevanceThreshold is passed to SearchAsync method to ensure only relevant documents are fetched.

Motivation and Context

Please help reviewers and future users, providing the following information:

  1. The code change is related because current code retrieves all memory items regardless of similarity which prevents adding new memory items. Check SemanticChatMemoryExtractor.ExtractCognitiveMemoryAsync.
  2. The issue is only the first memory item is preserved. Additional memory items are lost because they always seem to be similar to the first memory item.
  3. With this fix, a memory item is skipped only if there is similar memory item in the memory. As a result distinct memory items will be preserved.
  4. It fixes an open issue relevanceThreshold is not utilized preventing additional memory items #851 .

Description

The chance is simple, it utilizes unutilized relevanceThreshold parameter in ISemanticMemoryClientExtensions.SearchAsync method. SemanticChatMemoryExtractor.ExtractCognitiveMemoryAsync sends an upper threshold to find similar items, but since it is not used all non relevant memory items are returned.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines and the pre-submission formatting script raises no violations
  • [?] All unit tests pass, and I have added new tests where possible. I could not find any unit tests to run or extend. Please point out if there are any tests relevant to memory retrieval.
  • I didn't break anyone 😄

fix bug related to issue #851.
Unused parameter relevanceThreshold is passed to SearchAsync method to ensure only relevant documents are fetched.
@github-actions github-actions bot added the webapi Pull requests that update .net code label Apr 6, 2024
@glahaye glahaye added this pull request to the merge queue Apr 8, 2024
Merged via the queue into microsoft:main with commit b0fe77a Apr 8, 2024
7 checks passed
teamleader-dev pushed a commit to vlink-group/chat-copilot that referenced this pull request Oct 7, 2024
…dditional memory items (microsoft#920)

fix bug related to issue microsoft#851.
Unused parameter relevanceThreshold is passed to SearchAsync method to
ensure only relevant documents are fetched.

### Motivation and Context

Please help reviewers and future users, providing the following
information:
1. The code change is related because current code retrieves all memory
items regardless of similarity which prevents adding new memory items.
Check SemanticChatMemoryExtractor.ExtractCognitiveMemoryAsync.
2. The issue is only the first memory item is preserved. Additional
memory items are lost because they always seem to be similar to the
first memory item.
3. With this fix, a memory item is skipped only if there is similar
memory item in the memory. As a result distinct memory items will be
preserved.
  4. It fixes an open issue microsoft#851 .

### Description

The chance is simple, it utilizes unutilized relevanceThreshold
parameter in ISemanticMemoryClientExtensions.SearchAsync method.
SemanticChatMemoryExtractor.ExtractCognitiveMemoryAsync sends an upper
threshold to find similar items, but since it is not used all non
relevant memory items are returned.

### Contribution Checklist

- [X] The code builds clean without any errors or warnings
- [X] The PR follows the [Contribution
Guidelines](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [?] All unit tests pass, and I have added new tests where possible. I
could not find any unit tests to run or extend. Please point out if
there are any tests relevant to memory retrieval.
- [X] I didn't break anyone 😄
kb0039 pushed a commit to aaronba/chat-copilot that referenced this pull request Jan 8, 2025
…dditional memory items (microsoft#920)

fix bug related to issue microsoft#851.
Unused parameter relevanceThreshold is passed to SearchAsync method to
ensure only relevant documents are fetched.

### Motivation and Context

Please help reviewers and future users, providing the following
information:
1. The code change is related because current code retrieves all memory
items regardless of similarity which prevents adding new memory items.
Check SemanticChatMemoryExtractor.ExtractCognitiveMemoryAsync.
2. The issue is only the first memory item is preserved. Additional
memory items are lost because they always seem to be similar to the
first memory item.
3. With this fix, a memory item is skipped only if there is similar
memory item in the memory. As a result distinct memory items will be
preserved.
  4. It fixes an open issue microsoft#851 .

### Description

The chance is simple, it utilizes unutilized relevanceThreshold
parameter in ISemanticMemoryClientExtensions.SearchAsync method.
SemanticChatMemoryExtractor.ExtractCognitiveMemoryAsync sends an upper
threshold to find similar items, but since it is not used all non
relevant memory items are returned.

### Contribution Checklist

- [X] The code builds clean without any errors or warnings
- [X] The PR follows the [Contribution
Guidelines](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [?] All unit tests pass, and I have added new tests where possible. I
could not find any unit tests to run or extend. Please point out if
there are any tests relevant to memory retrieval.
- [X] I didn't break anyone 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
webapi Pull requests that update .net code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants