Skip to content

vectorstore_PGVector

Mehraneh-Barani edited this page Jul 26, 2024 · 1 revision

PGVector

class PGVectorStore(host, port, dbname, user, password, collection_name, embedding)

Bases: VectorStore

A concrete implementation of VectorStoreBase using PostgreSQL for storage.

Attributes:

db (PGVector): The PostgreSQL vector store.

add_document(docs)

Adds documents to the PostgreSQL vector store.

Args:

docs: The documents to be added to the vector store.

retrieve(query, top_k=5)

Retrieves documents similar to the given query from the PostgreSQL vector store.

Args:

  • query (str): The query to retrieve similar documents.
  • top_k (int, optional): The number of top similar documents to retrieve. Defaults to 5.

Returns:

Tuple[List[str], List[float]]: The context and scores of the retrieved documents.

Clone this wiki locally