Class: Durable::Llm::Providers::Together::TogetherResponse
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Together::TogetherResponse
- Defined in:
- lib/durable/llm/providers/together.rb
Overview
Response class for Together API completions.
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
-
#choices ⇒ Array<TogetherChoice>
Returns the choices from the response.
-
#data ⇒ Array, Hash
Returns the data from the response.
-
#initialize(response) ⇒ TogetherResponse
constructor
Initializes the response with raw API data.
-
#to_s ⇒ String
Converts the response to a string.
Constructor Details
#initialize(response) ⇒ TogetherResponse
Initializes the response with raw API data.
197 198 199 |
# File 'lib/durable/llm/providers/together.rb', line 197 def initialize(response) @raw_response = response end |
Instance Attribute Details
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
192 193 194 |
# File 'lib/durable/llm/providers/together.rb', line 192 def raw_response @raw_response end |
Instance Method Details
#choices ⇒ Array<TogetherChoice>
Returns the choices from the response.
204 205 206 |
# File 'lib/durable/llm/providers/together.rb', line 204 def choices @raw_response['choices'].map { |choice| TogetherChoice.new(choice) } end |
#data ⇒ Array, Hash
Returns the data from the response.
211 212 213 |
# File 'lib/durable/llm/providers/together.rb', line 211 def data @raw_response['data'] end |
#to_s ⇒ String
Converts the response to a string.
218 219 220 |
# File 'lib/durable/llm/providers/together.rb', line 218 def to_s choices.map(&:to_s).join(' ') end |