Class: Durable::Llm::Providers::Mistral::MistralStreamDelta

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

Overview

Represents a delta (incremental change) in streaming responses

Contains incremental content and role information for streaming completions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(delta) ⇒ MistralStreamDelta

Initializes a new stream delta object

Parameters:

  • delta (Hash)

    The raw delta data from the streaming response



414
415
416
417
# File 'lib/durable/llm/providers/mistral.rb', line 414

def initialize(delta)
  @role = delta['role']
  @content = delta['content']
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



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

attr_reader :role, :content

#roleString? (readonly)

Returns The role for this delta, or nil if not present.

Returns:

  • (String, nil)

    The role for this delta, or nil if not present



409
410
411
# File 'lib/durable/llm/providers/mistral.rb', line 409

def role
  @role
end

Instance Method Details

#to_sString

Returns the content of the delta, or empty string if none

Returns:

  • (String)

    The delta content or empty string



422
423
424
# File 'lib/durable/llm/providers/mistral.rb', line 422

def to_s
  @content || ''
end