Class: Durable::Llm::Providers::Xai::XaiStreamDelta
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Xai::XaiStreamDelta
- Defined in:
- lib/durable/llm/providers/xai.rb
Overview
Represents a delta (incremental change) in a streaming response.
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) ⇒ XaiStreamDelta
constructor
Initializes the delta with role and content.
-
#to_s ⇒ String
Converts the delta to a string by returning the content or empty string.
Constructor Details
#initialize(delta) ⇒ XaiStreamDelta
Initializes the delta with role and content.
338 339 340 341 |
# File 'lib/durable/llm/providers/xai.rb', line 338 def initialize(delta) @role = delta['role'] @content = delta['content'] end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
333 334 335 |
# File 'lib/durable/llm/providers/xai.rb', line 333 def content @content end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
333 334 335 |
# File 'lib/durable/llm/providers/xai.rb', line 333 def role @role end |
Instance Method Details
#to_s ⇒ String
Converts the delta to a string by returning the content or empty string.
346 347 348 |
# File 'lib/durable/llm/providers/xai.rb', line 346 def to_s @content || '' end |