morpheus.service.vdb.milvus_vector_db_service.MilvusVectorDBResourceService

class MilvusVectorDBResourceService(name, client)[source]

Bases: morpheus.service.vdb.vector_db_service.VectorDBResourceService

Represents a service for managing resources in a Milvus Vector Database.

Parameters
namestr

Name of the resource.

clientMilvusClient

An instance of the MilvusClient for interaction with the Milvus Vector Database.

Methods

count(**kwargs) Returns number of rows/entities.
delete(expr, **kwargs) Delete vectors from the collection using expressions.
delete_by_keys(keys, **kwargs) Delete vectors by keys from the collection.
describe(**kwargs) Provides a description of the collection.
drop(**kwargs) Drop a collection, index, or partition in the Milvus vector database.
insert(data, **kwargs) Insert data into the vector database.
insert_dataframe(df, **kwargs) Insert a dataframe entires into the vector database.
query(query, **kwargs) Query data in a collection in the Milvus vector database.
retrieve_by_keys(keys, **kwargs) Retrieve the inserted vectors using their primary keys.
similarity_search(embeddings[, k]) Perform a similarity search within the collection.
update(data, **kwargs) Update data in the collection.
count(**kwargs)[source]

Returns number of rows/entities.

Parameters
**kwargsdict[str, typing.Any]

Additional keyword arguments for the count operation.

Returns
int

Returns number of entities in the collection.

delete(expr, **kwargs)[source]

Delete vectors from the collection using expressions.

Parameters
exprstr

Delete expression.

**kwargsdict[str, typing.Any]

Extra keyword arguments specific to the vector database implementation.

Returns
dict[str, typing.Any]

Returns result of the given keys that are deleted from the collection.

delete_by_keys(keys, **kwargs)[source]

Delete vectors by keys from the collection.

Parameters
keysint | str | list

Primary keys to delete vectors.

**kwargsdict[str, typing.Any]

Extra keyword arguments specific to the vector database implementation.

Returns
typing.Any

Returns result of the given keys that are deleted from the collection.

describe(**kwargs)[source]

Provides a description of the collection.

Parameters
**kwargsdict[str, typing.Any]

Extra keyword arguments specific to the vector database implementation.

Returns
dict

Returns response content as a dictionary.

drop(**kwargs)[source]

Drop a collection, index, or partition in the Milvus vector database.

This function allows you to drop a collection.

Parameters
**kwargsdict

Additional keyword arguments for specifying the type and partition name (if applicable).

insert(data, **kwargs)[source]

Insert data into the vector database.

Parameters
datalist[list] | list[dict]

Data to be inserted into the collection.

**kwargsdict[str, typing.Any]

Extra keyword arguments specific to the vector database implementation.

Returns
dict

Returns response content as a dictionary.

insert_dataframe(df, **kwargs)[source]

Insert a dataframe entires into the vector database.

Parameters
dftyping.Union[cudf.DataFrame, pd.DataFrame]

Dataframe to be inserted into the collection.

**kwargsdict[str, typing.Any]

Extra keyword arguments specific to the vector database implementation.

Returns
dict

Returns response content as a dictionary.

query(query, **kwargs)[source]

Query data in a collection in the Milvus vector database.

This method performs a search operation in the specified collection/partition in the Milvus vector database.

Parameters
querystr, optional

The search query, which can be a filter expression, by default None.

**kwargsdict

Additional keyword arguments for the search operation.

Returns
typing.Any

The search result, which can vary depending on the query and options.

Raises
RuntimeError

If an error occurs during the search operation. If query argument is None and data keyword argument doesn’t exist. If data keyword arguement is None.

retrieve_by_keys(keys, **kwargs)[source]

Retrieve the inserted vectors using their primary keys.

Parameters
keysint | str | list

Primary keys to get vectors for. Depending on pk_field type it can be int or str or a list of either.

**kwargsdict[str, typing.Any]

Additional keyword arguments for the retrieval operation.

Returns
list[typing.Any]

Returns result rows of the given keys from the collection.

Perform a similarity search within the collection.

Parameters
embeddingslist[list[float]]

Embeddings for which to perform the similarity search.

kint, optional

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

**kwargsdict[str, typing.Any]

Extra keyword arguments specific to the vector database implementation.

Returns
list[dict]

Returns a list of dictionaries representing the results of the similarity search.

update(data, **kwargs)[source]

Update data in the collection.

Parameters
datalist[typing.Any]

Data to be updated in the collection.

**kwargsdict[str, typing.Any]

Extra keyword arguments specific to upsert operation.

Returns
dict[str, typing.Any]

Returns result of the updated operation stats.

Previous morpheus.service.vdb.milvus_vector_db_service.FieldSchemaEncoder
Next morpheus.service.vdb.milvus_vector_db_service.MilvusVectorDBService
© Copyright 2023, NVIDIA. Last updated on Feb 2, 2024.