Class: Durable::Llm::Providers::Together::TogetherStreamChoice

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

Overview

Represents a choice in streaming responses.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(choice) ⇒ TogetherStreamChoice

Initializes a stream choice.

Parameters:

  • choice (Array, Hash)

    The choice data



308
309
310
311
312
# File 'lib/durable/llm/providers/together.rb', line 308

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

Instance Attribute Details

#deltaObject (readonly)

Returns the value of attribute delta.



303
304
305
# File 'lib/durable/llm/providers/together.rb', line 303

def delta
  @delta
end

#finish_reasonObject (readonly)

Returns the value of attribute finish_reason.



303
304
305
# File 'lib/durable/llm/providers/together.rb', line 303

def finish_reason
  @finish_reason
end

Instance Method Details

#to_sString

Converts to string.

Returns:

  • (String)

    The delta content



317
318
319
# File 'lib/durable/llm/providers/together.rb', line 317

def to_s
  @delta.to_s
end