Class: Durable::Llm::Providers::Opencode::OpencodeResponse
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Opencode::OpencodeResponse
- Defined in:
- lib/durable/llm/providers/opencode.rb
Overview
Response class for OpenCode API completions
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
- #choices ⇒ Object
- #data ⇒ Object
-
#initialize(response) ⇒ OpencodeResponse
constructor
A new instance of OpencodeResponse.
- #to_s ⇒ Object
Constructor Details
#initialize(response) ⇒ OpencodeResponse
Returns a new instance of OpencodeResponse.
149 150 151 |
# File 'lib/durable/llm/providers/opencode.rb', line 149 def initialize(response) @raw_response = response end |
Instance Attribute Details
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
147 148 149 |
# File 'lib/durable/llm/providers/opencode.rb', line 147 def raw_response @raw_response end |
Instance Method Details
#choices ⇒ Object
153 154 155 |
# File 'lib/durable/llm/providers/opencode.rb', line 153 def choices @raw_response['choices'].map { |choice| OpencodeChoice.new(choice) } end |
#data ⇒ Object
157 158 159 |
# File 'lib/durable/llm/providers/opencode.rb', line 157 def data @raw_response['data'] end |
#to_s ⇒ Object
161 162 163 |
# File 'lib/durable/llm/providers/opencode.rb', line 161 def to_s choices.map(&:to_s).join(' ') end |