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

.Net: Bug: The Milvus connector search metric type is incorrect #7062

Closed
shuaihuadu opened this issue Jul 2, 2024 · 0 comments
Closed

.Net: Bug: The Milvus connector search metric type is incorrect #7062

shuaihuadu opened this issue Jul 2, 2024 · 0 comments
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@shuaihuadu
Copy link
Contributor

Describe the bug
The metricType parameter in the SearchAsync method of the Milvus connector is incorrect.

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.

To Reproduce

The source code:

semantic-kernel/dotnet/src/Connectors/Connectors.Memory.Milvus
/MilvusMemoryStore.cs#L449

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots

image

Platform

@shuaihuadu shuaihuadu added the bug Something isn't working label Jul 2, 2024
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Jul 2, 2024
github-merge-queue bot pushed a commit that referenced this issue Jul 3, 2024
### 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: [#7062](#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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

No branches or pull requests

2 participants