Class: Durable::Llm::Providers::Groq::GroqStreamChoice

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

Overview

Represents a single choice in a streaming Groq response chunk.

Contains the delta (incremental content) and finish reason for the choice.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(choice) ⇒ GroqStreamChoice

Returns a new instance of GroqStreamChoice.



236
237
238
239
240
# File 'lib/durable/llm/providers/groq.rb', line 236

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

Instance Attribute Details

#deltaObject (readonly)

Returns the value of attribute delta.



234
235
236
# File 'lib/durable/llm/providers/groq.rb', line 234

def delta
  @delta
end

#finish_reasonObject (readonly)

Returns the value of attribute finish_reason.



234
235
236
# File 'lib/durable/llm/providers/groq.rb', line 234

def finish_reason
  @finish_reason
end

Instance Method Details

#to_sObject



242
243
244
# File 'lib/durable/llm/providers/groq.rb', line 242

def to_s
  @delta.to_s
end