morpheus.service.vdb.vector_db_service.VectorDBResourceService

class VectorDBResourceService[source]

Bases: abc.ABC

Abstract base class for a Vector Database Resource Service.

Methods

count(**kwargs) Returns number of rows/entities in the given resource.
delete(expr, **kwargs) Delete data in the vector database.
delete_by_keys(keys, **kwargs) Delete vectors by keys from the resource.
describe(**kwargs) Provide a description of the vector database.
insert(data, **kwargs) Insert data into the vector database.
insert_dataframe(df, **kwargs) Insert a dataframe into the vector database.
retrieve_by_keys(keys, **kwargs) Retrieve the inserted vectors using keys from the resource.
similarity_search(embeddings[, k]) Perform a similarity search within the vector database.
update(data, **kwargs) Update data in the vector database.
abstract count(**kwargs)[source]

Returns number of rows/entities in the given resource.

Parameters
**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
int

Returns number of rows/entities in the given resource.

abstract delete(expr, **kwargs)[source]

Delete data in the vector database.

Parameters
expr

Delete expression.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
dict[str, typing.Any]

Returns result of the delete operation stats.

abstract delete_by_keys(keys, **kwargs)[source]

Delete vectors by keys from the resource.

Parameters
keys

Primary keys to delete vectors.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
typing.Any

Returns vectors of the given keys that are delete from the resource.

abstract describe(**kwargs)[source]

Provide a description of the vector database.

Parameters
**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
dict

Returns response content as a dictionary.

abstract insert(data, **kwargs)[source]

Insert data into the vector database.

Parameters
data

Data to be inserted into the resource.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
dict

Returns response content as a dictionary.

abstract insert_dataframe(df, **kwargs)[source]

Insert a dataframe into the vector database.

Parameters
df

Dataframe to be inserted into the resource.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
dict

Returns response content as a dictionary.

abstract retrieve_by_keys(keys, **kwargs)[source]

Retrieve the inserted vectors using keys from the resource.

Parameters
keys

Primary keys to get vectors.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
list[typing.Any]

Returns rows of the given keys that exists in the resource.

Perform a similarity search within the vector database.

Parameters
embeddings

Embeddings for which to perform the similarity search.

k

The number of nearest neighbors to return, by default 4.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
list[list[dict]]

Returns a list of lists, where each inner list contains dictionaries representing the results of the similarity search.

abstract update(data, **kwargs)[source]

Update data in the vector database.

Parameters
data

Data to be updated in the resource.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
dict[str, typing.Any]

Returns result of the updated operation stats.

Previous morpheus.service.vdb.vector_db_service
Next morpheus.service.vdb.vector_db_service.VectorDBService
© Copyright 2024, NVIDIA. Last updated on Apr 25, 2024.