Class: Durable::Llm::Providers::Opencode::OpencodeResponse

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

Overview

Response class for OpenCode API completions

Instance Attribute Summary collapse

Instance Method Summary collapse

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_responseObject (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

#choicesObject



153
154
155
# File 'lib/durable/llm/providers/opencode.rb', line 153

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

#dataObject



157
158
159
# File 'lib/durable/llm/providers/opencode.rb', line 157

def data
  @raw_response['data']
end

#to_sObject



161
162
163
# File 'lib/durable/llm/providers/opencode.rb', line 161

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