diff --git a/vector.go b/vector.go index d98ba7e..12c5433 100644 --- a/vector.go +++ b/vector.go @@ -23,6 +23,8 @@ type VectorField interface { Dims() int // Similarity metric to be used for scoring the vectors Similarity() string + // nlist/nprobe config (recall/latency) the index is optimized for + IndexOptimizedFor() string } // ----------------------------------------------------------------------------- @@ -45,3 +47,23 @@ var SupportedSimilarityMetrics = map[string]struct{}{ EuclideanDistance: {}, CosineSimilarity: {}, } + +// ----------------------------------------------------------------------------- + +const ( + IndexOptimizedForRecall = "recall" + IndexOptimizedForLatency = "latency" +) + +const DefaultIndexOptimization = IndexOptimizedForRecall + +var SupportedVectorIndexOptimizations = map[string]int{ + IndexOptimizedForRecall: 0, + IndexOptimizedForLatency: 1, +} + +// Reverse maps vector index optimizations': int -> string +var VectorIndexOptimizationsReverseLookup = map[int]string{ + 0: IndexOptimizedForRecall, + 1: IndexOptimizedForLatency, +}