.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 |
…us_search_metric_type
dmytrostruk
left a comment
There was a problem hiding this comment.
@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