Class: Durable::Llm::Providers::OpenRouter::OpenRouterStreamChoice

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

Overview

Stream choice wrapper for OpenRouter API streaming responses.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(choice) ⇒ OpenRouterStreamChoice

Returns a new instance of OpenRouterStreamChoice.



227
228
229
230
231
# File 'lib/durable/llm/providers/openrouter.rb', line 227

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

Instance Attribute Details

#deltaObject (readonly)

Returns the value of attribute delta.



225
226
227
# File 'lib/durable/llm/providers/openrouter.rb', line 225

def delta
  @delta
end

#finish_reasonObject (readonly)

Returns the value of attribute finish_reason.



225
226
227
# File 'lib/durable/llm/providers/openrouter.rb', line 225

def finish_reason
  @finish_reason
end

Instance Method Details

#to_sObject



233
234
235
# File 'lib/durable/llm/providers/openrouter.rb', line 233

def to_s
  @delta.to_s
end