Class: Boxcars::VectorStore::Pgvector::Search
- Inherits:
-
Object
- Object
- Boxcars::VectorStore::Pgvector::Search
- Includes:
- Boxcars::VectorStore
- Defined in:
- lib/boxcars/vector_store/pgvector/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 with the following parameters:.
Methods included from Boxcars::VectorStore
Constructor Details
#initialize(params) ⇒ Search
initialize the vector store with the following parameters:
15 16 17 18 19 20 21 22 |
# File 'lib/boxcars/vector_store/pgvector/search.rb', line 15 def initialize(params) require_dependencies! vector_store = validate_params(params) db_url = validate_vector_store(vector_store) @db_connection = test_db(db_url) @vector_documents = params[:vector_documents] end |
Instance Method Details
#call(query_vector:, count: 1) ⇒ Array
Returns array of hashes with :document and :distance keys.
27 28 29 30 31 |
# File 'lib/boxcars/vector_store/pgvector/search.rb', line 27 def call(query_vector:, count: 1) raise ::Boxcars::ArgumentError, 'query_vector is empty' if query_vector.empty? search(query_vector, count) end |