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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ HuggingfaceResponse

Returns a new instance of HuggingfaceResponse.



67
68
69
# File 'lib/durable/llm/providers/huggingface.rb', line 67

def initialize(response)
  @raw_response = response
end

Instance Attribute Details

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



65
66
67
# File 'lib/durable/llm/providers/huggingface.rb', line 65

def raw_response
  @raw_response
end

Instance Method Details

#choicesObject



71
72
73
# File 'lib/durable/llm/providers/huggingface.rb', line 71

def choices
  [@raw_response.first].map { |choice| HuggingfaceChoice.new(choice) }
end

#to_sObject



75
76
77
# File 'lib/durable/llm/providers/huggingface.rb', line 75

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