Open kevinlu1248 opened 1 year ago
π Sweep Pro: I used GPT-4 to create this ticket. You have 31 GPT-4 tickets left.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
From looking through the relevant snippets, I decided to make the following modifications:
File Path | Proposed Changes |
---|---|
llama_index/vector_stores/milvus.py |
In the __init__ method of the MilvusVectorStore class, modify the condition that checks if the collection already exists and no search parameters were provided. Instead of using an elif statement, use an if statement to check if the search parameters are None . If they are, set the search parameters according to the index parameters. This should be done regardless of whether the collection already exists or not. |
I have created a plan for writing the pull request. I am now working my plan and coding the required changes to address this issue. Here is the planned pull request:
[Bug Fix] Set search_params according to index_params in MilvusVectorStore
sweep/fix/search_params_bug
Description
This PR fixes a bug in the MilvusVectorStore class where the search_params are not being set correctly according to the index_params. This causes a mismatch in the metric_type between the index and search parameters, leading to query failures.
Changes Made
In the
__init__
method of the MilvusVectorStore class, I modified the condition that checks if the collection already exists and no search parameters were provided. Instead of using anelif
statement, I used anif
statement to check if the search parameters areNone
. If they are, I set the search parameters according to the index parameters. This ensures that the search_params are always set correctly, regardless of whether the collection already exists or not.Testing
I have tested the changes by reproducing the issue and verifying that the search_params are now correctly set according to the index_params. I also ran the existing test suite to ensure that there are no regressions.
Related Issue
This PR addresses Issue #6.
Checklist
- [ ] Updated the documentation, if necessary.
- [ ] Added unit tests to cover the changes.
- [ ] Ran the test suite and ensured that all tests pass.
- [ ] Followed the style guidelines of the project.
Screenshots (if applicable)
N/A
I have finished coding the issue. I am now reviewing it for completeness.
Success! π
I'm a bot that handles simple bugs and feature requests but I might make mistakes. Please be kind! Join Our Discord
sweep: Retry
Bug Description
Consider the following code snippet
Will fail with the following error:
I am overriding a collection and creating an index with some parameters. If I run a query on this store, it will fail, because search_params did not get the right metric_type set. Search_params will default to IP, despite index being created with L2.
The workaround currently is to set the search_params explicitly such as
However tracing the source code I believe this line should be an if instead of elif and the bug will be resolved without any side effects?
Version
0.7.6
Steps to Reproduce
Create a collection and index in Milvus - specify custom index_params. Observe search_params are not being created correctly according to index_params. Instead defaulting to default_search_params.
Relevant Logs/Tracbacks
No response