@@ -114,51 +114,70 @@ def recommend(
114114
115115 # High-dimensional vectors (>= 1024) - use LeanVec
116116 if dims >= CompressionAdvisor .HIGH_DIM_THRESHOLD :
117- base = {
118- "algorithm" : "svs-vamana" ,
119- "datatype" : datatype or "float16" ,
120- "graph_max_degree" : 64 ,
121- "construction_window_size" : 300 ,
122- }
117+ base_datatype = datatype or "float16"
123118
124119 if priority == "memory" :
125120 return SVSConfig (
126- ** base ,
121+ algorithm = "svs-vamana" ,
122+ datatype = base_datatype ,
123+ graph_max_degree = 64 ,
124+ construction_window_size = 300 ,
127125 compression = "LeanVec4x8" ,
128126 reduce = dims // 2 ,
129127 search_window_size = 20 ,
130128 )
131129 elif priority == "speed" :
132130 return SVSConfig (
133- ** base ,
131+ algorithm = "svs-vamana" ,
132+ datatype = base_datatype ,
133+ graph_max_degree = 64 ,
134+ construction_window_size = 300 ,
134135 compression = "LeanVec4x8" ,
135136 reduce = max (256 , dims // 4 ),
136137 search_window_size = 40 ,
137138 )
138139 else : # balanced
139140 return SVSConfig (
140- ** base ,
141+ algorithm = "svs-vamana" ,
142+ datatype = base_datatype ,
143+ graph_max_degree = 64 ,
144+ construction_window_size = 300 ,
141145 compression = "LeanVec4x8" ,
142146 reduce = dims // 2 ,
143147 search_window_size = 30 ,
144148 )
145149
146150 # Lower-dimensional vectors - use LVQ
147151 else :
148- base = {
149- "algorithm" : "svs-vamana" ,
150- "datatype" : datatype or "float32" ,
151- "graph_max_degree" : 40 ,
152- "construction_window_size" : 250 ,
153- "search_window_size" : 20 ,
154- }
152+ base_datatype = datatype or "float32"
155153
156154 if priority == "memory" :
157- return SVSConfig (** base , compression = "LVQ4" )
155+ return SVSConfig (
156+ algorithm = "svs-vamana" ,
157+ datatype = base_datatype ,
158+ graph_max_degree = 40 ,
159+ construction_window_size = 250 ,
160+ search_window_size = 20 ,
161+ compression = "LVQ4" ,
162+ )
158163 elif priority == "speed" :
159- return SVSConfig (** base , compression = "LVQ4x8" )
164+ return SVSConfig (
165+ algorithm = "svs-vamana" ,
166+ datatype = base_datatype ,
167+ graph_max_degree = 40 ,
168+ construction_window_size = 250 ,
169+ search_window_size = 20 ,
170+ compression = "LVQ4x8" ,
171+ )
160172 else : # balanced
161- return SVSConfig (** base , compression = "LVQ4x4" )
173+ return SVSConfig (
174+ algorithm = "svs-vamana" ,
175+ datatype = base_datatype ,
176+ graph_max_degree = 40 ,
177+ construction_window_size = 250 ,
178+ search_window_size = 20 ,
179+ compression = "LVQ4x4" ,
180+ )
162181
163182 @staticmethod
164183 def estimate_memory_savings (
0 commit comments