Class: Phronomy::VectorStore::Base
- Inherits:
-
Object
- Object
- Phronomy::VectorStore::Base
- Defined in:
- lib/phronomy/vector_store/base.rb
Overview
Abstract interface for vector stores.
Implementations manage a collection of (embedding, metadata) pairs and support similarity search.
Direct Known Subclasses
Instance Method Summary collapse
-
#add(id:, embedding:, metadata: {}) ⇒ Object
Add a document with its vector embedding.
-
#clear ⇒ Object
Remove all documents.
-
#remove(id:) ⇒ Object
Remove a single document by id.
-
#search(query_embedding:, k: 5) ⇒ Array<Hash>
Return the k most similar documents to the query embedding.
Instance Method Details
#add(id:, embedding:, metadata: {}) ⇒ Object
Add a document with its vector embedding.
15 16 17 |
# File 'lib/phronomy/vector_store/base.rb', line 15 def add(id:, embedding:, metadata: {}) raise NotImplementedError, "#{self.class}#add is not implemented" end |
#clear ⇒ Object
Remove all documents.
36 37 38 |
# File 'lib/phronomy/vector_store/base.rb', line 36 def clear raise NotImplementedError, "#{self.class}#clear is not implemented" end |
#remove(id:) ⇒ Object
Remove a single document by id.
31 32 33 |
# File 'lib/phronomy/vector_store/base.rb', line 31 def remove(id:) raise NotImplementedError, "#{self.class}#remove is not implemented" end |
#search(query_embedding:, k: 5) ⇒ Array<Hash>
Return the k most similar documents to the query embedding.
24 25 26 |
# File 'lib/phronomy/vector_store/base.rb', line 24 def search(query_embedding:, k: 5) raise NotImplementedError, "#{self.class}#search is not implemented" end |