-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
add: extend pgvector vector search functionality #17415
base: main
Are you sure you want to change the base?
Conversation
@@ -307,6 +310,7 @@ def from_params( | |||
async_conn_str = async_connection_string or ( | |||
f"postgresql+asyncpg://{user}:{password}@{host}:{port}/{database}" | |||
) | |||
cls.vector_search_method = vector_search_method |
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.
uhhhh this is not the proper way to do this. It should be an attribute defined on the class earlier, like all the other attributes (table_name, schema_name, etc.)
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.
sure let me make changes
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.
Making the changes or nah?
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.
Yes i was thinking that if i want to use direct the from_params() without creating class instance as it is class method so how can we pass the vector_search_method if we add vector_search_method attribute in class init and someone use directly the class method so it wont be able to find vector_search_method. I would like to hear your thoughts on it.
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.
uhhhh this is not the proper way to do this. It should be an attribute defined on the class earlier, like all the other attributes (table_name, schema_name, etc.)
I have made changes. Please review.
Description
This PR extends the functionality of the
PGVectorStore
class, specifically itsbuild_query
method. Previously, the build_query method only supported cosine vector similarity. However, thepgvector-python
library provides support for other vector similarity methods, which were not accessible through the current implementation ofPGVectorStore
.To address this, I have added support for additional vector similarity methods in the
build_query
method by introducing a parameter. This allows users to specify the similarity method they want to use, instead of being restricted to cosine similarity. Now, users can take advantage of all the similarity methods offered bypgvector-python
.Fixes # (issue)
New Package?
Did I fill in the
tool.llamahub
section in thepyproject.toml
and provide a detailed README.md for my new integration or package?Version Bump?
Did I bump the version in the
pyproject.toml
file of the package I am updating? (Except for thellama-index-core
package)Type of Change
Please delete options that are not relevant.
How Has This Been Tested?
Your pull-request will likely not be merged unless it is covered by some form of impactful unit testing.
Suggested Checklist:
make format; make lint
to appease the lint gods