Class: Roseflow::Embeddings::Embedding
- Inherits:
-
Object
- Object
- Roseflow::Embeddings::Embedding
- Defined in:
- lib/roseflow/embeddings/embedding.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
writeonly
Sets the attribute input.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#vector ⇒ Object
readonly
Returns the value of attribute vector.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**kwargs) ⇒ Embedding
constructor
A new instance of Embedding.
Constructor Details
#initialize(**kwargs) ⇒ Embedding
Returns a new instance of Embedding.
11 12 13 14 15 16 |
# File 'lib/roseflow/embeddings/embedding.rb', line 11 def initialize(**kwargs) @length = kwargs.fetch(:length, 1024) @input = kwargs.fetch(:input, nil) @model = kwargs.fetch(:model, nil) @vector = kwargs.fetch(:vector, nil) end |
Instance Attribute Details
#input=(value) ⇒ Object (writeonly)
Sets the attribute input
9 10 11 |
# File 'lib/roseflow/embeddings/embedding.rb', line 9 def input=(value) @input = value end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
8 9 10 |
# File 'lib/roseflow/embeddings/embedding.rb', line 8 def length @length end |
#vector ⇒ Object (readonly)
Returns the value of attribute vector.
8 9 10 |
# File 'lib/roseflow/embeddings/embedding.rb', line 8 def vector @vector end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 |
# File 'lib/roseflow/embeddings/embedding.rb', line 18 def call raise ArgumentError, "An input must be provided" unless @input raise EmbeddingModelNotSpecifiedError, "An embedding model must be specified" unless @model response = @model.provider.(model: @model, input: @input) response. end |