Class: Durable::Llm::Providers::Anthropic::AnthropicStreamResponse
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Anthropic::AnthropicStreamResponse
- Defined in:
- lib/durable/llm/providers/anthropic.rb
Overview
Response object for streaming Anthropic messages chunks.
This wraps individual chunks from the Server-Sent Events stream, providing access to the incremental content updates.
Instance Attribute Summary collapse
-
#choices ⇒ Object
readonly
Returns the value of attribute choices.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(parsed) ⇒ AnthropicStreamResponse
constructor
A new instance of AnthropicStreamResponse.
- #to_s ⇒ Object
Constructor Details
#initialize(parsed) ⇒ AnthropicStreamResponse
Returns a new instance of AnthropicStreamResponse.
326 327 328 329 330 331 332 333 334 |
# File 'lib/durable/llm/providers/anthropic.rb', line 326 def initialize(parsed) @type = parsed['type'] @choices = case @type when 'content_block_delta' [AnthropicStreamChoice.new(parsed)] else [] end end |
Instance Attribute Details
#choices ⇒ Object (readonly)
Returns the value of attribute choices.
324 325 326 |
# File 'lib/durable/llm/providers/anthropic.rb', line 324 def choices @choices end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
324 325 326 |
# File 'lib/durable/llm/providers/anthropic.rb', line 324 def type @type end |
Instance Method Details
#to_s ⇒ Object
336 337 338 |
# File 'lib/durable/llm/providers/anthropic.rb', line 336 def to_s @choices.map(&:to_s).join(' ') end |