Class: Durable::Llm::Providers::Cohere::CohereEmbeddingResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/durable/llm/providers/cohere.rb

Overview

Response object for Cohere embedding API responses.

Wraps embedding data and provides array access to the vector representation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ CohereEmbeddingResponse

Returns a new instance of CohereEmbeddingResponse.



188
189
190
# File 'lib/durable/llm/providers/cohere.rb', line 188

def initialize(data)
  @embedding = data.dig('embeddings', 'float', 0)
end

Instance Attribute Details

#embeddingObject (readonly)

Returns the value of attribute embedding.



186
187
188
# File 'lib/durable/llm/providers/cohere.rb', line 186

def embedding
  @embedding
end

Instance Method Details

#to_aObject



192
193
194
# File 'lib/durable/llm/providers/cohere.rb', line 192

def to_a
  @embedding
end