Class: Boxcars::VectorStore::Hnswlib::Search
- Inherits:
-
Object
- Object
- Boxcars::VectorStore::Hnswlib::Search
- Includes:
- Boxcars::VectorStore
- Defined in:
- lib/boxcars/vector_store/hnswlib/search.rb
Instance Method Summary collapse
-
#call(query_vector:, count: 1) ⇒ Array
Array of hashes with :document and :distance keys.
-
#initialize(params) ⇒ Search
constructor
initialize the vector store search with the following parameters: example: { type: :hnswlib, vector_store: [ Boxcars::VectorStore::Document.new( content: “hello”, embedding: [0.1, 0.2, 0.3], metadata: { a: 1 } ) ] }.
Methods included from Boxcars::VectorStore
Constructor Details
#initialize(params) ⇒ Search
initialize the vector store search with the following parameters: example: {
type: :hnswlib,
vector_store: [
Boxcars::VectorStore::Document.new(
content: "hello",
embedding: [0.1, 0.2, 0.3],
metadata: { a: 1 }
)
]
}
24 25 26 27 28 |
# File 'lib/boxcars/vector_store/hnswlib/search.rb', line 24 def initialize(params) @vector_store = validate_params(params[:vector_documents]) @metadata, @index_file = validate_files(vector_store) @search_index = load_index(, index_file) end |
Instance Method Details
#call(query_vector:, count: 1) ⇒ Array
Returns array of hashes with :document and :distance keys.
33 34 35 |
# File 'lib/boxcars/vector_store/hnswlib/search.rb', line 33 def call(query_vector:, count: 1) search(query_vector, count) end |