Class: Boxcars::VectorStore::Hnswlib::LoadFromDisk

Inherits:
Object
  • Object
show all
Includes:
Boxcars::VectorStore
Defined in:
lib/boxcars/vector_store/hnswlib/load_from_disk.rb

Instance Method Summary collapse

Methods included from Boxcars::VectorStore

included

Constructor Details

#initialize(params) ⇒ LoadFromDisk

params: base_dir_path: string (absolute path to the directory containing the index_file_path and json_doc_file_path), index_file_path: string (relative path to the index file from the base_dir_path), json_doc_file_path: string (relative path to the json file from the base_dir_path)



17
18
19
20
# File 'lib/boxcars/vector_store/hnswlib/load_from_disk.rb', line 17

def initialize(params)
  @base_dir_path, @index_file_path, @json_doc_file_path =
    validate_params(params)
end

Instance Method Details

#callObject



22
23
24
25
26
27
28
29
30
# File 'lib/boxcars/vector_store/hnswlib/load_from_disk.rb', line 22

def call
  vectors = parse_json_file(json_doc_file_path)
  hnsw_vectors = load_as_hnsw_vectors(vectors)

  {
    type: :hnswlib,
    vector_store: hnsw_vectors
  }
end