EncryptedIndex instance based on the provided configuration.
Parameters
| Parameter | Type | Description |
|---|---|---|
indexName | string | Name of the index to create. Must be unique within the CyborgDB service. |
indexKey | Uint8Array | 32-byte encryption key for the index, used to secure the index data. |
indexConfig | IndexIVFPQ | IndexIVFFlat | IndexIVF | (Optional) Configuration object specifying the index type (ivf, ivfpq, or ivfflat). Defaults to { type: 'ivfflat', dimension: undefined }. |
metric | 'euclidean' | 'squared_euclidean' | 'cosine' | (Optional) Distance metric to use for the index. Defaults to 'euclidean'. |
embeddingModel | string | (Optional) Name of the embedding model used to auto-generate embeddings on the server. Defaults to undefined, no auto-generation. |
Returns
Promise<EncryptedIndex>: A Promise that resolves to an instance of the newly created encrypted index.
Exceptions
Error
Error
- Throws if the index name already exists on the server.
- Throws if the index configuration is invalid or missing required parameters.
- Throws if the encryption key is not exactly 32 bytes.
- Throws if the embedding model is not supported by the server.
Service Errors
Service Errors
- Throws if the CyborgDB service is unavailable or unreachable.
- Throws if there are internal server errors on the CyborgDB service.
Example Usage
Automatic Index Config
For more info on
generateKey, refer to Generate Key.IVFFlat Index with Embedding Model
For more info on auto-generating embeddings, refer to Auto-Generate Embeddings.