Class: Durable::Llm::Providers::Opencode::OpencodeStreamChoice

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

Overview

Stream choice class for OpenCode API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(choice) ⇒ OpencodeStreamChoice

Returns a new instance of OpencodeStreamChoice.



224
225
226
227
228
# File 'lib/durable/llm/providers/opencode.rb', line 224

def initialize(choice)
  @choice = [choice].flatten.first
  @delta = OpencodeStreamDelta.new(@choice['delta'])
  @finish_reason = @choice['finish_reason']
end

Instance Attribute Details

#deltaObject (readonly)

Returns the value of attribute delta.



222
223
224
# File 'lib/durable/llm/providers/opencode.rb', line 222

def delta
  @delta
end

#finish_reasonObject (readonly)

Returns the value of attribute finish_reason.



222
223
224
# File 'lib/durable/llm/providers/opencode.rb', line 222

def finish_reason
  @finish_reason
end

Instance Method Details

#to_sObject



230
231
232
# File 'lib/durable/llm/providers/opencode.rb', line 230

def to_s
  @delta.to_s
end