Class: Durable::Llm::Providers::OpenAI::OpenAIStreamChoice

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(choice) ⇒ OpenAIStreamChoice

Returns a new instance of OpenAIStreamChoice.



221
222
223
224
225
# File 'lib/durable/llm/providers/openai.rb', line 221

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

Instance Attribute Details

#deltaObject (readonly)

Returns the value of attribute delta.



219
220
221
# File 'lib/durable/llm/providers/openai.rb', line 219

def delta
  @delta
end

#finish_reasonObject (readonly)

Returns the value of attribute finish_reason.



219
220
221
# File 'lib/durable/llm/providers/openai.rb', line 219

def finish_reason
  @finish_reason
end

Instance Method Details

#to_sObject



227
228
229
# File 'lib/durable/llm/providers/openai.rb', line 227

def to_s
  @delta.to_s
end