NVIDIA Morpheus (24.10.01)
(Latest Version)

morpheus.service.vdb.vector_db_service.VectorDBService

class VectorDBService[source]

Bases: <a href="https://docs.python.org/3/library/abc.html#abc.ABC">abc.ABC</a>

Class used for vectorstore specific implementation.

Methods

<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.close">close</a>() Close connection to the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.count">count</a>(name, **kwargs) Returns number of rows/entities in the given resource.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.create">create</a>(name[, overwrite]) Create resources in the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.create_from_dataframe">create_from_dataframe</a>(name, df[, overwrite]) Create resources in the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.delete">delete</a>(name, expr, **kwargs) Delete data in the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.delete_by_keys">delete_by_keys</a>(name, keys, **kwargs) Delete vectors by keys from the resource.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.describe">describe</a>(name, **kwargs) Describe resource in the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.drop">drop</a>(name, **kwargs) Drop resources from the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.has_store_object">has_store_object</a>(name) Check if a resource exists in the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.insert">insert</a>(name, data, **kwargs) Insert data into the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.insert_dataframe">insert_dataframe</a>(name, df, **kwargs) Converts dataframe to rows and insert into the vector database resource.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.list_store_objects">list_store_objects</a>(**kwargs) List existing resources in the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.query">query</a>(name, query, **kwargs) Query a resource in the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.release_resource">release_resource</a>(name) Release a loaded resource from the memory.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.retrieve_by_keys">retrieve_by_keys</a>(name, keys, **kwargs) Retrieve the inserted vectors using keys from the resource.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.similarity_search">similarity_search</a>(name, **kwargs) Perform a similarity search within the vector database.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.transform">transform</a>(data, **kwargs) Transform data according to the specific vector database implementation.
<a href="#morpheus.service.vdb.vector_db_service.VectorDBService.update">update</a>(name, data, **kwargs) Update data in the vector database.
load_resource
abstract close()[source]

Close connection to the vector database.

abstract count(name, **kwargs)[source]

Returns number of rows/entities in the given resource.

Parameters
name

Name of the resource.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
int

Returns number of rows/entities in the given resource.

abstract create(name, overwrite=False, **kwargs)[source]

Create resources in the vector database.

Parameters
name

Name of the resource.

overwrite

Whether to overwrite the resource if it already exists.

**kwargs

Extra keyword arguments specific to the vector database implementation.

abstract create_from_dataframe(name, df, overwrite=False, **kwargs)[source]

Create resources in the vector database.

Parameters
name

Name of the resource.

df

The dataframe to create the resource from.

overwrite

Whether to overwrite the resource if it already exists. Default is False.

**kwargs

Extra keyword arguments specific to the vector database implementation.

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

Delete data in the vector database.

Parameters
name

Name of the resource.

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(name, keys, **kwargs)[source]

Delete vectors by keys from the resource.

Parameters
name

Name of the resource.

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(name, **kwargs)[source]

Describe resource in the vector database.

Parameters
name

Name of the resource.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
dict

Returns resource information.

abstract drop(name, **kwargs)[source]

Drop resources from the vector database.

Parameters
name

Name of the resource.

**kwargs

Extra keyword arguments specific to the vector database implementation.

abstract has_store_object(name)[source]

Check if a resource exists in the vector database.

Parameters
name

Name of the resource.

Returns
bool

Returns True if resource exists in the vector database, otherwise False.

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

Insert data into the vector database.

Parameters
name

Name of the resource.

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(name, df, **kwargs)[source]

Converts dataframe to rows and insert into the vector database resource.

Parameters
name

Name of the resource to be inserted.

df

Dataframe to be inserted.

**kwargs

Additional keyword arguments containing collection configuration.

Returns
dict

Returns response content as a dictionary.

Raises
RuntimeError

If the resource not exists exists.

abstract list_store_objects(**kwargs)[source]

List existing resources in the vector database.

Parameters
**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
list[str]

Returns available resouce names in the vector database.

abstract query(name, query, **kwargs)[source]

Query a resource in the vector database.

Parameters
name

Name of the resource.

query

Query to execute on the given resource.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
typing.Any

Returns search results.

abstract release_resource(name)[source]

Release a loaded resource from the memory.

Parameters
name

Name of the resource to release.

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

Retrieve the inserted vectors using keys from the resource.

Parameters
name

Name of the resource.

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
name

Name of the resource.

**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.

transform(data, **kwargs)[source]

Transform data according to the specific vector database implementation.

Parameters
data

Data to be updated in the resource.

**kwargs

Extra keyword arguments specific to the vector database implementation.

Returns
typing.Any

Returns transformed data as per the implementation.

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

Update data in the vector database.

Parameters
name

Name of the resource.

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.VectorDBResourceService
Next morpheus.stages
© Copyright 2024, NVIDIA. Last updated on Jul 8, 2024.