morpheus_llm.service.vdb.kinetica_vector_db_service.KineticaVectorDBService#

class KineticaVectorDBService(
uri,
user='',
password='',
kinetica_schema='ki_home',
)[source]#

Bases: VectorDBService

Service class for Kinetica Database implementation. This class provides functions for interacting with a Kinetica database.

Parameters:
uristr

The hostname or IP address of the Kinetica server along with the port e.g., http://localhost:9191.

userstr

The username for connecting to the Kinetica server.

passwordstr

The password for connecting to the Kinetica server.

kinetica_schemastr, optional

Kinetica schema name, by default “ki_home”.

Methods

close()

Close connection to the vector database.

collection_name(name)

Returns a fully qualified Kinetica table name

count(name, **kwargs)

Returns number of rows/entities in the given Kinetica table.

create(name[, overwrite])

Create a table in the Kinetica database with the specified name and configuration.

create_from_dataframe(name, df[, overwrite])

Create collections in the vector database.

delete(name, expr, **kwargs)

Delete vectors from the Kinetica table using expressions.

delete_by_keys(name, keys, **kwargs)

Delete vectors by keys from the resource.

describe(name, **kwargs)

Describe the Kinetica table in the vector database.

drop(name, **kwargs)

Drop a table in the Kinetica database.

has_store_object(name)

Check if a table exists in the Kinetica database.

insert(name, data, **kwargs)

Insert a collection specific data in the Kinetica vector database.

insert_dataframe(name, df, **kwargs)

Converts dataframe to rows and insert to a Kinetica table in the Kinetica vector database.

list_store_objects(**kwargs)

List existing resources in the vector database.

load_resource(name, **kwargs)

@param name: @param kwargs: @return:

query(name[, query])

Query data in a Kinetica table in the Kinetica vector database.

release_resource(name)

Release a loaded resource from the memory.

retrieve_by_keys(name, keys, **kwargs)

Retrieve the inserted vectors using their primary keys from the Kinetica table.

similarity_search(name, **kwargs)

Perform a similarity search within the Kinetica table.

transform(data, **kwargs)

Transform data according to the specific vector database implementation.

update(name, data, **kwargs)

Update data in the vector database.

close()[source]#

Close connection to the vector database. Not used by Kinetica

collection_name(name)[source]#

Returns a fully qualified Kinetica table name

Parameters:
namestr

Name fo the Kinetica table

Returns:
str:

Fully qualified Kinetica table name by prepending the schema name

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

Returns number of rows/entities in the given Kinetica table.

Parameters:
namestr

Name of the Kinetica table.

**kwargsdict[str, typing.Any]

Additional keyword arguments for the count operation.

Returns:
int

Returns number of entities in the Kinetica table.

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

Create a table in the Kinetica database with the specified name and configuration. If the table already exists, it can be overwritten if the overwrite parameter is set to True.

Parameters:
namestr

Name of the table to be created. The name must be in the form ‘schema_name.table_name’.

overwritebool, optional

If True, the Kinetica table will be overwritten if it already exists, by default False.

**kwargsdict

Additional keyword arguments containing Kinetica /create/table options.

Raises:
GPUdbException

If the provided type schema configuration is empty.

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

Create collections in the vector database.

Parameters:
namestr

Name of the Kinetica table.

dfDataFrameType

The dataframe to create the Kinetica table from.

overwritebool, optional

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

**kwargsdict[str, typing.Any]

Not used by Kinetica.

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

Delete vectors from the Kinetica table using expressions.

Parameters:
namestr

Name of the Kinetica table.

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 delete from the Kinetica table.

delete_by_keys(name, keys, **kwargs)[source]#

Delete vectors by keys from the resource. Not supported by Kinetica

Parameters:
namestr

Name of the resource.

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 vectors of the given keys that are delete from the resource.

describe(name, **kwargs)[source]#

Describe the Kinetica table in the vector database.

Parameters:
namestr

Name of the Kinetica table.

**kwargsdict[str, typing.Any]

Additional keyword arguments specific to the Kinetica vector database.

Returns:
dict

Returns Kinetica table information.

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

Drop a table in the Kinetica database.

This method allows you to drop a table in the Kinetica database.

Parameters:
namestr

Name of the table

**kwargsdict

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

Other Parameters:
schemastr

Specifies the schema of the table to drop. Default ‘ki_home’

Raises:
ValueError

If mandatory arguments are missing or if the provided ‘Kinetica table’ value is invalid.

has_store_object(name)[source]#

Check if a table exists in the Kinetica database.

Parameters:
namestr

Name of the table to check.

Returns:
bool

True if the table exists, False otherwise.

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

Insert a collection specific data in the Kinetica vector database.

Parameters:
namestr

Name of the Kinetica table to be inserted.

datalist[list] | list[dict]

Data to be inserted in the Kinetica table.

**kwargsdict[str, typing.Any]

Additional keyword arguments containing Kinetica table configuration.

Returns:
dict

Returns response content as a dictionary.

Raises:
RuntimeError

If the table not exists.

insert_dataframe(name, df, **kwargs)[source]#

Converts dataframe to rows and insert to a Kinetica table in the Kinetica vector database.

Parameters:
namestr

Name of the Kinetica table to be inserted.

dfDataFrameType

Dataframe to be inserted in the Kinetica table.

**kwargsdict[str, typing.Any]

Additional keyword arguments containing Kinetica table configuration.

Returns:
dict

Returns response content as a dictionary.

Raises:
RuntimeError

If the Kinetica table not exists.

list_store_objects(**kwargs)[source]#

List existing resources in the vector database. Not used by Kinetica

Parameters:
**kwargsdict[str, typing.Any]

Extra keyword arguments specific to the vector database implementation.

Returns:
list[str]

Returns available resouce names in the vector database.

load_resource(name, **kwargs)[source]#

@param name: @param kwargs: @return:

query(name, query=None, **kwargs)[source]#

Query data in a Kinetica table in the Kinetica vector database.

This method performs a search operation in the specified Kinetica table/partition in the Kinetica vector database.

Parameters:
namestr

Name of the Kinetica table to search within.

querystr

The search query, which is an SQL query.

**kwargsdict

Additional keyword arguments for the search operation.

Returns:
typing.Any

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

release_resource(name)[source]#

Release a loaded resource from the memory. Not used by Kinetica

Parameters:
namestr

Name of the resource to release.

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

Retrieve the inserted vectors using their primary keys from the Kinetica table.

Parameters:
namestr

Name of the Kinetica table.

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 Kinetica table.

Perform a similarity search within the Kinetica table.

Parameters:
namestr

Name of the Kinetica table.

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

transform(data, **kwargs)[source]#

Transform data according to the specific vector database implementation.

Parameters:
datatyping.Any

Data to be updated in the resource.

**kwargsdict[str, typing.Any]

Extra keyword arguments specific to the vector database implementation.

Returns:
typing.Any

Returns transformed data as per the implementation.

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

Update data in the vector database.

Parameters:
namestr

Name of the Kinetica table.

datalist[typing.Any]

Data to be updated in the Kinetica table.

**kwargsdict[str, typing.Any]

Extra keyword arguments specific to upsert operation.

Returns:
dict[str, typing.Any]

Returns result of the updated operation stats.