Class: Durable::Llm::Providers::Anthropic::AnthropicStreamDelta

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

Overview

Represents the incremental content delta in a streaming response.

Contains the type and text content of the delta.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(delta) ⇒ AnthropicStreamDelta

Returns a new instance of AnthropicStreamDelta.



362
363
364
365
# File 'lib/durable/llm/providers/anthropic.rb', line 362

def initialize(delta)
  @type = delta['type']
  @text = delta['text']
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



360
361
362
# File 'lib/durable/llm/providers/anthropic.rb', line 360

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



360
361
362
# File 'lib/durable/llm/providers/anthropic.rb', line 360

def type
  @type
end

Instance Method Details

#to_sObject



367
368
369
# File 'lib/durable/llm/providers/anthropic.rb', line 367

def to_s
  @text || ''
end