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 }
)
]
}
25 26 27 28 29 |
# File 'lib/boxcars/vector_store/hnswlib/search.rb', line 25 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.
34 35 36 |
# File 'lib/boxcars/vector_store/hnswlib/search.rb', line 34 def call(query_vector:, count: 1) search(query_vector, count) end |