agentchat.contrib.vectordb.pgvectordb
Collection
class Collection()
A Collection object for PGVector.
Attributes:
client- The PGVector client.collection_namestr - The name of the collection. Default is "documents".embedding_functionCallable - The embedding function used to generate the vector representation. Default is None. SentenceTransformer("all-MiniLM-L6-v2").encode will be used when None. Models can be chosen from: https://huggingface.co/models?library=sentence-transformersmetadataOptional[dict] - The metadata of the collection.get_or_createOptional - The flag indicating whether to get or create the collection.
__init__
def __init__(client=None,
collection_name: str = "autogen-docs",
embedding_function: Callable = None,
metadata=None,
get_or_create=None)
Initialize the Collection object.
Arguments:
client- The PostgreSQL client.collection_name- The name of the collection. Default is "documents".embedding_function- The embedding function used to generate the vector representation.metadata- The metadata of the collection.get_or_create- The flag indicating whether to get or create the collection.
Returns:
None
add
def add(ids: List[ItemID],
documents: List,
embeddings: List = None,
metadatas: List = None) -> None
Add documents to the collection.
Arguments:
idsList[ItemID] - A list of document IDs.embeddingsList - A list of document embeddings. OptionalmetadatasList - A list of document metadatas. OptionaldocumentsList - A list of documents.
Returns:
None