Class: Phronomy::VectorStore::Embeddings::Base
- Inherits:
-
Object
- Object
- Phronomy::VectorStore::Embeddings::Base
- Defined in:
- lib/phronomy/vector_store/embeddings/base.rb
Overview
Abstract interface for embedding adapters.
Concrete implementations must override #embed and return a vector
as an Array<Float>.
Direct Known Subclasses
Instance Method Summary collapse
-
#embed(text, cancellation_token = nil) ⇒ Array<Float>
Embed the given text and return a vector representation.
-
#embed_async(text, cancellation_token = nil, timeout: nil) ⇒ OffloadPool::PendingOperation
Submits an #embed call to OffloadPool and returns an OffloadPool::PendingOperation.
Instance Method Details
#embed(text, cancellation_token = nil) ⇒ Array<Float>
Embed the given text and return a vector representation.
17 18 19 20 |
# File 'lib/phronomy/vector_store/embeddings/base.rb', line 17 def (text, cancellation_token = nil) cancellation_token&.raise_if_cancelled! raise NotImplementedError, "#{self.class}#embed is not implemented" end |
#embed_async(text, cancellation_token = nil, timeout: nil) ⇒ OffloadPool::PendingOperation
Submits an #embed call to OffloadPool and returns an OffloadPool::PendingOperation.
30 31 32 33 34 35 36 37 38 |
# File 'lib/phronomy/vector_store/embeddings/base.rb', line 30 def (text, cancellation_token = nil, timeout: nil) Phronomy::Runtime.instance.offload.submit( timeout: timeout, cancellation_token: cancellation_token, on_full: :raise ) do (text, cancellation_token) end end |