Add Items to an Encrypted Index
Once you have created or loaded an encrypted index, you can add items to it. To do this, you can use the upsert()
function:
For more info on Array2D
in C++, see the API Reference.
Adding Items with Contents
It’s also possible to store item contents alongside vectors. To do this, include contents
(which must be bytes) to the upsert()
call.
The bytes in the contents
field will be encrypted using the index key.
Adding Items with Metadata
CyborgDB also supports metadata storage, retrieval and filtering. To add metadata to an item, include metadata
in the upsert()
call.
All metadata fields will be encrypted using the index key.
For more info on metadata storage and filtering, see Metadata Filtering.
Automatic Embedding Generation
If you provided an embedding_model
during index creation, you can automatically generate embeddings for items by providing contents
to the upsert()
call:
In this example, the embedding_model
will automatically generate embeddings for the contents
field. Note that contents
must be a string. It will also be converted to bytes
for encrypted item storage.
This feature uses sentence-transformers
for embedding generation. You can use any model from the HuggingFace Model Hub that is compatible with sentence-transformers
.
API Reference
For more information on adding items to an encrypted index, refer to the API reference:
Was this page helpful?