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

feat: add hnsw index functionality to PGVector #85

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wulifu2hao
Copy link

issue: langchain-ai/langchain#23853

description: unlike the PGEmbedding class (which uses "pg_embedding" extension) , the PGVector class (which uses "pg_vector" extension) currently doesn't support HNSW index. Since the pg_embedding project is deprecated since 2023 https://github.com/neondatabase/pg_embedding and it is encouraged to move to pg_vector, I added the HNSW support in the PGVector class

langchain_postgres/vectorstores.py Show resolved Hide resolved

return create_index_query

def create_hnsw_index(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anyway to move this to a classmethod, so we can create the ahead of time.

I want to create a control plane -- that allows managing the indexes without having to actually instantiate an index.

class IndexManager:
  def list_indexes(**kwargs) -> List[Dict]:
  
def get_index(id) -> VectorStore:
   pass

 def create_index(**kwargs) -> str:
    pass

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @eyurtsev thanks for the feedback. Honestly I'm not too sure how to do this as this is my first PR to the project. Feel free to commandeer the PR (or merge it and create a new one if it makes more sense)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants