Class: Durable::Llm::Providers::Huggingface::HuggingfaceResponse
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Huggingface::HuggingfaceResponse
- Defined in:
- lib/durable/llm/providers/huggingface.rb
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
- #choices ⇒ Object
-
#initialize(response) ⇒ HuggingfaceResponse
constructor
A new instance of HuggingfaceResponse.
- #to_s ⇒ Object
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_response ⇒ Object (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
#choices ⇒ Object
71 72 73 |
# File 'lib/durable/llm/providers/huggingface.rb', line 71 def choices [@raw_response.first].map { |choice| HuggingfaceChoice.new(choice) } end |
#to_s ⇒ Object
75 76 77 |
# File 'lib/durable/llm/providers/huggingface.rb', line 75 def to_s choices.map(&:to_s).join(' ') end |