Reputation: 21
I've set up a table in a PGVector database and populated it with records, including two vector fields, using psycopg2-binary (version 2.9.9) in Python. The initial table creation was done through SQL in pgAdmin. Now, I'm looking to perform queries on this table utilizing the langchain framework in Python.
While langchain seems to support loading from an index by collection name, I haven't found documentation on how to work with an existing table directly or how to specify which of the two vector fields to query against.
My questions are:
Upvotes: 1
Views: 900
Reputation: 1
db = PGVector.from_existing_index( embedding=embeddings,
documents=splits,
collection_name=COLLECTION_NAME,
connection_string=CONNECTION_STRING)
similar = db.similarity_search_with_score(query, k=2)
for doc in similar:
print(doc, end="\n\n")
Upvotes: 0