-
Notifications
You must be signed in to change notification settings - Fork 4.4k
.Net: Fix milvus search metric type bug. #7063
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
.Net: Fix milvus search metric type bug. #7063
Conversation
|
@shuaihuadu Thanks for the update, mind adding a Unit Test to ensuring the metric type is sent thru Http? Thanks! |
…' of https://github.com/shuaihuadu/semantic-kernel into upstream/fix_connector_memory_milvus_search_metric_type
@rogerbarreto The unit tests have been added. Please review. |
@microsoft-github-policy-service agree |
|
@microsoft-github-policy-service agree |
dotnet/src/IntegrationTests/Connectors/Memory/Milvus/MilvusMemoryStoreTests.cs
Outdated
Show resolved
Hide resolved
…us_search_metric_type
dmytrostruk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shuaihuadu Thank you for contribution!
### 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. --> The `metricType` parameter in the `SearchAsync` method of the Milvus connector is incorrect. It will always use the `SimilarityMetricType.Ip` for searching. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> The current code hard-codes the milvus search metric type to `SimilarityMetricType.Ip`, which causes the issue where even if the Metric type is specified as `SimilarityMetricType.Cosine` when creating the `MilvusMemoryStore`, `SimilarityMetricType.IP` is still used during the search. Issue: [microsoft#7062](microsoft#7062) ### 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: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
Motivation and Context
The
metricTypeparameter in theSearchAsyncmethod of the Milvus connector is incorrect.It will always use the
SimilarityMetricType.Ipfor searching.Description
The current code hard-codes the milvus search metric type to
SimilarityMetricType.Ip, which causes the issue where even if the Metric type is specified asSimilarityMetricType.Cosinewhen creating theMilvusMemoryStore,SimilarityMetricType.IPis still used during the search.Issue: #7062
Contribution Checklist