Class: Durable::Llm::Providers::Xai::XaiEmbeddingResponse

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

Overview

Represents an embedding response from xAI’s API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ XaiEmbeddingResponse

Initializes the embedding response with the embedding data.

Parameters:

  • data (Hash)

    The parsed JSON response containing embeddings



298
299
300
# File 'lib/durable/llm/providers/xai.rb', line 298

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

Instance Attribute Details

#embeddingObject (readonly)

Returns the value of attribute embedding.



293
294
295
# File 'lib/durable/llm/providers/xai.rb', line 293

def embedding
  @embedding
end

Instance Method Details

#to_aArray<Float>

Returns the embedding as an array.

Returns:

  • (Array<Float>)

    The embedding vector



305
306
307
# File 'lib/durable/llm/providers/xai.rb', line 305

def to_a
  @embedding
end