Class: Durable::Llm::Providers::OpenAI::OpenAIStreamDelta
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::OpenAI::OpenAIStreamDelta
- Defined in:
- lib/durable/llm/providers/openai.rb
Overview
Represents the incremental content delta in a streaming response.
Contains the role (for the first chunk) and content updates.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Instance Method Summary collapse
-
#initialize(delta) ⇒ OpenAIStreamDelta
constructor
A new instance of OpenAIStreamDelta.
- #to_s ⇒ Object
Constructor Details
#initialize(delta) ⇒ OpenAIStreamDelta
Returns a new instance of OpenAIStreamDelta.
379 380 381 382 |
# File 'lib/durable/llm/providers/openai.rb', line 379 def initialize(delta) @role = delta['role'] @content = delta['content'] end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
377 378 379 |
# File 'lib/durable/llm/providers/openai.rb', line 377 def content @content end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
377 378 379 |
# File 'lib/durable/llm/providers/openai.rb', line 377 def role @role end |
Instance Method Details
#to_s ⇒ Object
384 385 386 |
# File 'lib/durable/llm/providers/openai.rb', line 384 def to_s @content || '' end |