morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService
- class FaissVectorDBResourceService(parent, *, name)[source]
Bases:
<a href="morpheus.service.vdb.vector_db_service.VectorDBResourceService.html#morpheus.service.vdb.vector_db_service.VectorDBResourceService">morpheus.service.vdb.vector_db_service.VectorDBResourceService</a>
Represents a service for managing resources in a FAISS Vector Database.
- Parameters
- parent
- name
The parent service for this resource.
The name of the resource.
Methods
<a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.count">count</a>
(**kwargs)Returns number of rows/entities. <a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.delete">delete</a>
(expr, **kwargs)Delete vectors by giving a list of IDs. <a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.delete_by_keys">delete_by_keys</a>
(keys, **kwargs)Delete vectors by keys from the collection. <a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.describe">describe</a>
(**kwargs)Provides a description of the collection. <a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.drop">drop</a>
(**kwargs)Drops the resource from the vector database service. <a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.insert">insert</a>
(data, **kwargs)Insert data into the vector database. <a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.insert_dataframe">insert_dataframe</a>
(df, **kwargs)Insert a dataframe entires into the vector database. <a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.query">query</a>
(query, **kwargs)Query data in a collection in the vector database. <a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.retrieve_by_keys">retrieve_by_keys</a>
(keys, **kwargs)Retrieve the inserted vectors using their primary keys. <a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.similarity_search">similarity_search</a>
(embeddings[, k])Perform a similarity search within the FAISS docstore. <a href="#morpheus.service.vdb.faiss_vdb_service.FaissVectorDBResourceService.update">update</a>
(data, **kwargs)Update data in the collection. - count(**kwargs)[source]
Returns number of rows/entities.
- Parameters
- **kwargs
Additional keyword arguments for the count operation.
- Returns
- int
Returns number of entities in the collection.
- delete(expr, **kwargs)[source]
Delete vectors by giving a list of IDs.
- Parameters
- expr
- **kwargs
Delete expression.
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
- keys
- **kwargs
Primary keys to delete vectors.
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
- **kwargs
Extra keyword arguments specific to the vector database implementation.
- Returns
- dict
Returns response content as a dictionary.
- drop(**kwargs)[source]
Drops the resource from the vector database service.
This function allows you to drop a collection.
- Parameters
- **kwargs
Additional keyword arguments for specifying the type and partition name (if applicable).
- insert(data, **kwargs)[source]
Insert data into the vector database.
- Parameters
- data
- **kwargs
Data to be inserted into the collection.
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
- df
- **kwargs
Dataframe to be inserted into the collection.
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 vector database.
- Parameters
- query
- **kwargs
The search query, which can be a filter expression, by default None.
Additional keyword arguments for the search operation.
- Returns
- typing.Any
The search result, which can vary depending on the query and options.
- retrieve_by_keys(keys, **kwargs)[source]
Retrieve the inserted vectors using their primary keys.
- Parameters
- keys
- **kwargs
Primary keys to get vectors for. Depending on pk_field type it can be int or str or a list of either.
Additional keyword arguments for the retrieval operation.
- Returns
- list[typing.Any]
Returns result rows of the given keys from the collection.
- async similarity_search(embeddings, k=4, **kwargs)[source]
Perform a similarity search within the FAISS docstore.
- Parameters
- embeddings
- k
- **kwargs
Embeddings for which to perform the similarity search.
The number of nearest neighbors to return, by default 4.
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
- data
- **kwargs
Data to be updated in the collection.
Extra keyword arguments specific to upsert operation.
- Returns
- dict[str, typing.Any]
Returns result of the updated operation stats.