Skip to main content

VectorItem

Represents a single vector with its associated data.
type VectorItem struct {
    Id       string                 `json:"id"`                // Unique identifier
    Vector   []float32              `json:"vector,omitempty"`  // Vector data
    Contents NullableContents       `json:"contents,omitempty"` // Optional text content  
    Metadata map[string]interface{} `json:"metadata,omitempty"` // Optional metadata
}

Fields

FieldTypeDescription
IdstringUnique identifier for the vector (required)
Vector[]float32The vector data as float32 slice
ContentsNullableContentsOptional text content associated with the vector
Metadatamap[string]interface{}Optional key-value pairs for filtering and retrieval

CreateIndexParams

Parameters for creating a new encrypted vector index.
type CreateIndexParams struct {
    IndexName      string     `json:"index_name"`            // Unique identifier for the index
    IndexKey       []byte     `json:"index_key"`             // 32-byte encryption key
    IndexConfig    IndexModel `json:"index_config,omitempty"` // Index configuration
    Metric         *string    `json:"metric,omitempty"`       // Distance metric
    EmbeddingModel *string    `json:"embedding_model,omitempty"` // Associated embedding model
}

Fields

FieldTypeRequiredDescription
IndexNamestringYesUnique identifier for the index
IndexKey[]byteYes32-byte encryption key (use GenerateKey() to create)
IndexConfigIndexModelNoIndex configuration (IVFFlat, IVFPQ, or IVFSQ)
Metric*stringNoDistance metric (“euclidean”, “squared_euclidean”, “cosine”)
EmbeddingModel*stringNoName of embedding model to associate

Index Configuration Types

IndexModel Interface

All index configuration types implement this interface.
type IndexModel interface {
    ToIndexConfig() *internal.IndexConfig
}

IVFSQ Configuration

Create an IVFSQ (Scalar Quantization) index configuration that compresses each dimension independently.
func IndexIVFSQ(dimension int32, sqBits int32) *indexIVFSQ

Parameters

ParameterTypeDescription
dimensionint32The dimensionality of vectors that will be stored
sqBitsint32Number of bits per dimension for scalar quantization (typically 16)

IVFFlat Configuration

Create an IVFFlat (Inverted File Flat) index configuration for higher accuracy.
func IndexIVFFlat(dimension int32) *indexIVFFlat

Parameters

ParameterTypeDescription
dimensionint32The dimensionality of vectors that will be stored

IVFPQ Configuration

Create an IVFPQ (Inverted File with Product Quantization) index configuration for memory efficiency.
func IndexIVFPQ(dimension int32, pqDim int32, pqBits int32) *indexIVFPQ

Parameters

ParameterTypeDescription
dimensionint32The dimensionality of vectors that will be stored
pqDimint32Product quantization dimension (typically dimension/8 or dimension/16)
pqBitsint32Bits per PQ code (typically 8, higher = more accurate but larger)

Response Types

QueryResponse

Response from similarity search operations.
type QueryResponse = internal.QueryResponse
Contains search results with similar vectors and their metadata.

QueryResultItem

A single result from a similarity search query.
type QueryResultItem = internal.QueryResultItem
Represents one matching vector with its similarity score and metadata.

GetResponse

Response from Get operations containing retrieved vectors.
type GetResponse = internal.GetResponseModel

ListIDsResponse

Response from ListIDs operations.
type ListIDsResponse = internal.ListIDsResponse
Contains the list of vector IDs in the index.

Fields

FieldTypeDescription
Ids[]stringList of all vector ID strings in the index
Countint32Total number of IDs in the index

TrainParams

Parameters for training an encrypted vector index.
type TrainParams struct {
    BatchSize  *int32   `json:"batch_size,omitempty"`  // Number of vectors per training batch
    MaxIters   *int32   `json:"max_iters,omitempty"`   // Maximum training iterations  
    Tolerance  *float64 `json:"tolerance,omitempty"`   // Convergence tolerance
    MaxMemory  *int32   `json:"max_memory,omitempty"`  // Maximum memory usage in MB
    NLists     *int32   `json:"n_lists,omitempty"`     // Number of IVF clusters
}

Fields

FieldTypeDescription
BatchSize*int32Number of vectors processed per training batch (default: 2048)
MaxIters*int32Maximum training iterations (default: 100)
Tolerance*float64Convergence tolerance for training (default: 1e-6)
MaxMemory*int32Maximum memory usage in MB, 0 = no limit (default: 0)
NLists*int32Number of IVF clusters, 0 = auto-determine (default: 0)

UpsertInput Interface

Sealed interface implemented by types that can be passed to Upsert.
type UpsertInput interface {
    isUpsertInput()
}
Valid implementations: VectorItems, BinaryUpsertParams

QueryInput Interface

Sealed interface implemented by types that can be passed to Query.
type QueryInput interface {
    isQueryInput()
}
Valid implementations: QueryParams, BinaryQueryParams

VectorItems

A slice of VectorItem that implements UpsertInput for type-safe upsert operations.
type VectorItems []VectorItem

BinaryUpsertParams

Parameters for binary format vector upserts. More efficient than VectorItems for large batches.
type BinaryUpsertParams struct {
    IDs      []string
    Vectors  [][]float32
    Metadata []map[string]interface{}
    Contents []string
}

Fields

FieldTypeRequiredDescription
IDs[]stringYesUnique identifiers for each vector
Vectors[][]float32YesVector data, shape [n_vectors][dimension]
Metadata[]map[string]interface{}NoOptional metadata for each vector (length must match IDs if provided)
Contents[]stringNoOptional content strings for each vector (length must match IDs if provided)

BinaryQueryParams

Parameters for binary format similarity search. More efficient than QueryParams for large batch queries.
type BinaryQueryParams struct {
    QueryVectors [][]float32
    TopK         int32
    NProbes      *int32
    Greedy       *bool
    Filters      map[string]interface{}
    Include      []string
}

Fields

FieldTypeRequiredDescription
QueryVectors[][]float32YesQuery vectors, shape [n_queries][dimension]
TopKint32NoNumber of nearest neighbors to return (default: 100)
NProbes*int32NoNumber of IVF lists to probe
Greedy*boolNoEnable greedy search mode
Filtersmap[string]interface{}NoMetadata filters to apply
Include[]stringNoFields to include in response

QueryParams

Parameters for similarity search queries. Supports single vector, batch, and content-based queries.
type QueryParams struct {
    QueryVector       []float32              `json:"query_vector,omitempty"`
    BatchQueryVectors [][]float32            `json:"query_vectors,omitempty"`
    QueryContents     *string                `json:"query_contents,omitempty"`
    TopK              int32                  `json:"top_k"`
    NProbes           *int32                 `json:"n_probes,omitempty"`
    Greedy            *bool                  `json:"greedy,omitempty"`
    Filters           map[string]interface{} `json:"filters,omitempty"`
    Include           []string               `json:"include"`
}

Fields

FieldTypeRequiredDescription
QueryVector[]float32NoSingle query vector for similarity search
BatchQueryVectors[][]float32NoMultiple query vectors for batch search
QueryContents*stringNoText content for semantic search
TopKint32NoNumber of nearest neighbors to return
NProbes*int32NoNumber of clusters to probe for search
Greedy*boolNoUse greedy search algorithm
Filtersmap[string]interface{}NoMetadata filters to apply
Include[]stringYesFields to include in results: "metadata", "distance", "vector", "contents"