Class: Durable::Llm::Providers::Anthropic::AnthropicStreamResponse
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Anthropic::AnthropicStreamResponse
- Defined in:
- lib/durable/llm/providers/anthropic.rb
Instance Attribute Summary collapse
-
#choices ⇒ Object
readonly
Returns the value of attribute choices.
Instance Method Summary collapse
-
#initialize(fragment) ⇒ AnthropicStreamResponse
constructor
A new instance of AnthropicStreamResponse.
- #to_s ⇒ Object
Constructor Details
#initialize(fragment) ⇒ AnthropicStreamResponse
Returns a new instance of AnthropicStreamResponse.
131 132 133 134 |
# File 'lib/durable/llm/providers/anthropic.rb', line 131 def initialize(fragment) parsed = JSON.parse(fragment.split('data: ').last) @choices = [AnthropicStreamChoice.new(parsed['delta'])] end |
Instance Attribute Details
#choices ⇒ Object (readonly)
Returns the value of attribute choices.
129 130 131 |
# File 'lib/durable/llm/providers/anthropic.rb', line 129 def choices @choices end |
Instance Method Details
#to_s ⇒ Object
136 137 138 |
# File 'lib/durable/llm/providers/anthropic.rb', line 136 def to_s @choices.map(&:to_s).join(' ') end |