Class: Durable::Llm::Providers::Mistral::MistralStreamChoice

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

Overview

Represents a streaming choice from Mistral AI

Contains delta content and finish reason for streaming completions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(choice) ⇒ MistralStreamChoice

Initializes a new streaming choice object

Parameters:

  • choice (Array<Hash>, Hash)

    The raw streaming choice data



387
388
389
390
391
# File 'lib/durable/llm/providers/mistral.rb', line 387

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

Instance Attribute Details

#deltaMistralStreamDelta (readonly)

Returns The delta content for this streaming choice.

Returns:



382
383
384
# File 'lib/durable/llm/providers/mistral.rb', line 382

def delta
  @delta
end

#finish_reasonObject (readonly)

Returns the value of attribute finish_reason.



382
# File 'lib/durable/llm/providers/mistral.rb', line 382

attr_reader :delta, :finish_reason

Instance Method Details

#to_sString

Returns the text content of the delta

Returns:

  • (String)

    The delta content



396
397
398
# File 'lib/durable/llm/providers/mistral.rb', line 396

def to_s
  @delta.to_s
end