Class: Durable::Llm::Providers::OpenAI::OpenAIStreamChoice
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::OpenAI::OpenAIStreamChoice
- Defined in:
- lib/durable/llm/providers/openai.rb
Instance Attribute Summary collapse
-
#delta ⇒ Object
readonly
Returns the value of attribute delta.
-
#finish_reason ⇒ Object
readonly
Returns the value of attribute finish_reason.
Instance Method Summary collapse
-
#initialize(choice) ⇒ OpenAIStreamChoice
constructor
A new instance of OpenAIStreamChoice.
- #to_s ⇒ Object
Constructor Details
#initialize(choice) ⇒ OpenAIStreamChoice
Returns a new instance of OpenAIStreamChoice.
221 222 223 224 225 |
# File 'lib/durable/llm/providers/openai.rb', line 221 def initialize(choice) @choice = [choice].flatten.first @delta = OpenAIStreamDelta.new(@choice['delta']) @finish_reason = @choice['finish_reason'] end |
Instance Attribute Details
#delta ⇒ Object (readonly)
Returns the value of attribute delta.
219 220 221 |
# File 'lib/durable/llm/providers/openai.rb', line 219 def delta @delta end |
#finish_reason ⇒ Object (readonly)
Returns the value of attribute finish_reason.
219 220 221 |
# File 'lib/durable/llm/providers/openai.rb', line 219 def finish_reason @finish_reason end |
Instance Method Details
#to_s ⇒ Object
227 228 229 |
# File 'lib/durable/llm/providers/openai.rb', line 227 def to_s @delta.to_s end |