Camel.storages.vectordb storages.oceanbase
OceanBaseStorage
An implementation of the BaseVectorStorage
for interacting with
OceanBase Vector Database.
Parameters:
- vector_dim (int): The dimension of storing vectors.
- table_name (str): Name for the table in OceanBase.
- uri (str): Connection URI for OceanBase (host:port). (default: :obj:
"127.0.0.1:2881"
) - user (str): Username for connecting to OceanBase. (default: :obj:
"root@test"
) - password (str): Password for the user. (default: :obj:
""
) (default:""
) - db_name (str): Database name in OceanBase. (default: :obj:
"test"
) - distance (
Literal["l2", "cosine"], optional
): The distance metric for vector comparison. Options: “l2”, “cosine”. (default: :obj:"l2"
) - delete_table_on_del (bool, optional): Flag to determine if the table should be deleted upon object destruction. (default: :obj:
False
) **kwargs (Any): Additional keyword arguments for initializingObVecClient
.
init
del
Deletes the table if :obj:delete_table_on_del
is set to
:obj:True
.
add
Saves a list of vector records to the storage.
Parameters:
- records (List[VectorRecord]): List of vector records to be saved.
- batch_size (int): Number of records to insert each batch. Larger batches are more efficient but use more memory. (default: :obj:
100
) **kwargs (Any): Additional keyword arguments.
delete
Deletes a list of vectors identified by their IDs from the storage.
Parameters:
- ids (List[str]): List of unique identifiers for the vectors to be deleted. **kwargs (Any): Additional keyword arguments.
status
Returns:
VectorDBStatus: The vector database status.
query
Searches for similar vectors in the storage based on the provided query.
Parameters:
- query (VectorDBQuery): The query object containing the search vector and the number of top similar vectors to retrieve. **kwargs (Any): Additional keyword arguments.
Returns:
List[VectorDBQueryResult]: A list of vectors retrieved from the storage based on similarity to the query vector.
_convert_distance_to_similarity
Converts distance to similarity score based on distance metric.
clear
Remove all vectors from the storage.
load
Load the collection hosted on cloud service.
client
Provides access to underlying OceanBase vector database client.