Collection
Attributes:
client: The PGVector client.
collection_name (str): The name of the collection. Default is “documents”.
embedding_function (Callable): 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-transformers metadata (Optional[dict[str, Any]]): The metadata of the collection.
get_or_create (Optional): The flag indicating whether to get or create the collection.
Initialize the Collection object.
Parameters:
Instance Methods
add
Parameters:
Returns:
convert_string_to_array
Parameters:
- array_string (str): The string representation of the array.
Returns:
- list: A list of floats parsed from the input string. If the input is not a string, it returns the input itself. Parameters:
Returns:
cosine_distance
Parameters:
- arr1 (List[float]): The first vector.
- arr2 (List[float]): The second vector.
Returns:
- float: The cosine distance between arr1 and arr2. Parameters:
Returns:
count
Returns:
int: The total number of documents. Returns:
create_collection
Parameters:
Returns:
delete
Parameters:
Returns:
delete_collection
Parameters:
Returns:
euclidean_distance
Parameters:
- arr1 (List[float]): The first vector.
- arr2 (List[float]): The second vector.
Returns:
- float: The Euclidean distance between arr1 and arr2. Parameters:
Returns:
get
Parameters:
Returns:
inner_product_distance
Parameters:
- arr1 (List[float]): The first vector.
- arr2 (List[float]): The second vector.
Returns:
- float: The Euclidean distance between arr1 and arr2. Parameters:
Returns:
modify
Parameters:
Returns:
query
Parameters:
Returns:
set_collection_name
table_exists
Parameters:
Returns:
update
Parameters:
Returns:
upsert
Parameters:
Returns: