Class: Durable::Llm::Providers::Huggingface::HuggingfaceResponse

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

Overview

Response wrapper for Hugging Face completion API responses.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ HuggingfaceResponse



128
129
130
# File 'lib/durable/llm/providers/huggingface.rb', line 128

def initialize(response)
  @raw_response = response
end

Instance Attribute Details

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



126
127
128
# File 'lib/durable/llm/providers/huggingface.rb', line 126

def raw_response
  @raw_response
end

Instance Method Details

#choicesObject



132
133
134
# File 'lib/durable/llm/providers/huggingface.rb', line 132

def choices
  [HuggingfaceChoice.new(@raw_response)]
end

#to_sObject



136
137
138
# File 'lib/durable/llm/providers/huggingface.rb', line 136

def to_s
  choices.map(&:to_s).join(' ')
end