Class: ClusterKit::HNSW::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/clusterkit/hnsw.rb

Overview

Builder pattern for creating HNSW indices

Instance Method Summary collapse

Constructor Details

#initializeBuilder



190
191
192
# File 'lib/clusterkit/hnsw.rb', line 190

def initialize
  @config = {}
end

Instance Method Details

#buildObject



224
225
226
# File 'lib/clusterkit/hnsw.rb', line 224

def build
  HNSW.new(**@config)
end

#dimensions(dim) ⇒ Object



199
200
201
202
# File 'lib/clusterkit/hnsw.rb', line 199

def dimensions(dim)
  @config[:dim] = dim
  self
end

#ef_construction(ef) ⇒ Object



214
215
216
217
# File 'lib/clusterkit/hnsw.rb', line 214

def ef_construction(ef)
  @config[:ef_construction] = ef
  self
end

#m_parameter(m) ⇒ Object



209
210
211
212
# File 'lib/clusterkit/hnsw.rb', line 209

def m_parameter(m)
  @config[:m] = m
  self
end

#max_elements(n) ⇒ Object



204
205
206
207
# File 'lib/clusterkit/hnsw.rb', line 204

def max_elements(n)
  @config[:max_elements] = n
  self
end

#seed(seed) ⇒ Object



219
220
221
222
# File 'lib/clusterkit/hnsw.rb', line 219

def seed(seed)
  @config[:random_seed] = seed
  self
end

#space(type) ⇒ Object



194
195
196
197
# File 'lib/clusterkit/hnsw.rb', line 194

def space(type)
  @config[:space] = type
  self
end