You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I set "hnsw_dist_method": "vector_cosine_ops" in hnsw_kwargs when using PGVectorStore.from_params, I got the following warning:
WARNING 2025-01-21 05:22:38,543 base 30247 140612435187392 PG Setup: Error creating HNSW index: (psycopg2.errors.UndefinedObject) operator class "vector_cosine_ops" does not exist for access method "hnsw"
[SQL: CREATE INDEX IF NOT EXISTS data_paul_graham_essay_embedding_idx ON onshape_schema.data_paul_graham_essay USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64)]
(Background on this error at: https://sqlalche.me/e/20/f405)
Version
0.12.11
Steps to Reproduce
Create an index
Load it using PGVectorStore.from_params() and set hnsw_kwargs as follows
2025-01-21 05:22:38,541 INFO sqlalchemy.engine.Engine CREATE INDEX IF NOT EXISTS data_paul_graham_essay_embedding_idx ON db_schema.data_paul_graham_essay USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64)
INFO 2025-01-21 05:22:38,541 base 30247 140612435187392 CREATE INDEX IF NOT EXISTS data_paul_graham_essay_embedding_idx ON db_schema.data_paul_graham_essay USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64)
2025-01-21 05:22:38,541 INFO sqlalchemy.engine.Engine [generated in 0.00008s] {}
INFO 2025-01-21 05:22:38,541 base 30247 140612435187392 [generated in 0.00008s] {}
2025-01-21 05:22:38,542 INFO sqlalchemy.engine.Engine ROLLBACK
INFO 2025-01-21 05:22:38,542 base 30247 140612435187392 ROLLBACK
WARNING 2025-01-21 05:22:38,543 base 30247 140612435187392 PG Setup: Error creating HNSW index: (psycopg2.errors.UndefinedObject) operator class "vector_cosine_ops" does not exist for access method "hnsw"
[SQL: CREATE INDEX IF NOT EXISTS data_paul_graham_essay_embedding_idx ON db_schema.data_paul_graham_essay USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64)]
(Background on this error at: https://sqlalche.me/e/20/f405)
The text was updated successfully, but these errors were encountered:
Hey @kjnez! I'm here to assist you with any bugs, questions, or contributions. Let's work together to resolve your issue.
The error you're encountering indicates that the operator class "vector_cosine_ops" does not exist for the HNSW access method in PostgreSQL. This suggests that the specified distance method might not be supported or correctly configured for the HNSW index in your PostgreSQL setup.
Here are a few steps you can take to address this issue:
Verify Supported Operator Classes: Check the PostgreSQL documentation or your database configuration to ensure that "vector_cosine_ops" is a valid operator class for the HNSW access method. It's possible that this operator class is not available in your current PostgreSQL version or configuration.
Check for Typographical Errors: Ensure there are no typographical errors in the operator class name. It should match exactly with what is supported by your PostgreSQL setup.
Alternative Distance Methods: If "vector_cosine_ops" is not supported, consider using an alternative distance method that is compatible with the HNSW access method. You might need to consult the documentation or community resources for a list of supported methods.
Database Extensions: Ensure that any necessary extensions or plugins required for using HNSW with specific operator classes are installed and enabled in your PostgreSQL database.
If none of these steps resolve the issue, you may need to consult further documentation or resources specific to your PostgreSQL version and configuration to identify the correct operator class to use.
Bug Description
If I set
"hnsw_dist_method": "vector_cosine_ops"
inhnsw_kwargs
when usingPGVectorStore.from_params
, I got the following warning:Version
0.12.11
Steps to Reproduce
PGVectorStore.from_params()
and sethnsw_kwargs
as followsRelevant Logs/Tracbacks
The text was updated successfully, but these errors were encountered: