Class: Durable::Llm::Providers::Mistral::MistralStreamChoice
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Mistral::MistralStreamChoice
- 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
-
#delta ⇒ MistralStreamDelta
readonly
The delta content for this streaming choice.
-
#finish_reason ⇒ Object
readonly
Returns the value of attribute finish_reason.
Instance Method Summary collapse
-
#initialize(choice) ⇒ MistralStreamChoice
constructor
Initializes a new streaming choice object.
-
#to_s ⇒ String
Returns the text content of the delta.
Constructor Details
#initialize(choice) ⇒ MistralStreamChoice
Initializes a new streaming choice object
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
#delta ⇒ MistralStreamDelta (readonly)
Returns The delta content for this streaming choice.
382 383 384 |
# File 'lib/durable/llm/providers/mistral.rb', line 382 def delta @delta end |
#finish_reason ⇒ Object (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_s ⇒ String
Returns the text content of the delta
396 397 398 |
# File 'lib/durable/llm/providers/mistral.rb', line 396 def to_s @delta.to_s end |