-
Notifications
You must be signed in to change notification settings - Fork 33
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 index build arguments #58
Add index build arguments #58
Conversation
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.
nicely done!
a few tweaks to the logic and tests and we can get this merged. thanks!
@olirice thanks for the review. Made a couple changes:
That should address your comments. Please let me know if there are any further changes you'd like to see to this PR! |
thats great, thanks for the contribution! |
Thanks for getting it over the finish line! I'm looking forward to testing out some different index configurations! |
What kind of change does this PR introduce?
Feature
What is the current behavior?
See supabase/vecs/issues/56
What is the new behavior?
Indexes can now be built with specific parameters (
n_lists
for IndexIVFFlat andm
,ef_construction
for IndexHSNW). PGvector default values are used in absence of user-supplied parameters and a warning will be raised if the user requests an index of one type but supplies arguments corresponding to a different type (eg: create index with typevecs.IndexMethod.hsnw
and supplyindex_arguments=vecs.IndexArgsIVFFlat(n_lists=123)
).Note: this PR also changes the naming scheme for indexes slightly. Currently the indexes are named:
index ix_{ops}_ivfflat_{n_lists}_{unique_string}
andix_{ops}_hnsw_{unique_string}
forIndexIVFFlat
andIndexHNSW
, respectively. Since the values ofm
andef_construction
are customizable and not easily accessible from the vecs client, it makes sense to encode these in the index name, similarly to the value ofn_lists
in theIndexIVFFlat
index.In order to avoid confusion between the two
IndexHNSW
build values in the index name, the values have been prepended withm
andefc
respectively. To maintain consistency, then_lists
value in theIndexIVFFLat
is prepended withnl
. So index names now looks like:ix_{ops}_ivfflat_nl{n_lists}_{unique_string}
forIndexIVFFlat
andix_{ops}_hnsw_m{m}_efc{ef_construction}_{unique_string}
forIndexHSNW
.Examples: