Class: ActiveRecordVector::Providers::Base
- Inherits:
-
Object
- Object
- ActiveRecordVector::Providers::Base
- Defined in:
- lib/active_record_vector/providers/base.rb
Overview
Abstract base class for embedding providers.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#embed(_text) ⇒ Object
Generate embedding vector array for input text string.
-
#embed_batch(texts) ⇒ Object
Generate batch embedding vector arrays for array of text strings.
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
9 10 11 |
# File 'lib/active_record_vector/providers/base.rb', line 9 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/active_record_vector/providers/base.rb', line 7 def @options end |
Instance Method Details
#embed(_text) ⇒ Object
Generate embedding vector array for input text string
14 15 16 |
# File 'lib/active_record_vector/providers/base.rb', line 14 def (_text) raise NotImplementedError, "#{self.class.name}#embed must be implemented" end |
#embed_batch(texts) ⇒ Object
Generate batch embedding vector arrays for array of text strings
19 20 21 |
# File 'lib/active_record_vector/providers/base.rb', line 19 def (texts) texts.map { |text| (text) } end |