Class: Durable::Llm::Providers::Perplexity::PerplexityStreamChoice
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Perplexity::PerplexityStreamChoice
- Defined in:
- lib/durable/llm/providers/perplexity.rb
Overview
Represents a single choice in a Perplexity streaming response.
Contains the delta and finish reason for the streaming choice.
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) ⇒ PerplexityStreamChoice
constructor
A new instance of PerplexityStreamChoice.
- #to_s ⇒ Object
Constructor Details
#initialize(choice) ⇒ PerplexityStreamChoice
Returns a new instance of PerplexityStreamChoice.
242 243 244 245 246 |
# File 'lib/durable/llm/providers/perplexity.rb', line 242 def initialize(choice) @choice = [choice].flatten.first @delta = PerplexityStreamDelta.new(@choice['delta']) @finish_reason = @choice['finish_reason'] end |
Instance Attribute Details
#delta ⇒ Object (readonly)
Returns the value of attribute delta.
240 241 242 |
# File 'lib/durable/llm/providers/perplexity.rb', line 240 def delta @delta end |
#finish_reason ⇒ Object (readonly)
Returns the value of attribute finish_reason.
240 241 242 |
# File 'lib/durable/llm/providers/perplexity.rb', line 240 def finish_reason @finish_reason end |
Instance Method Details
#to_s ⇒ Object
248 249 250 |
# File 'lib/durable/llm/providers/perplexity.rb', line 248 def to_s @delta.to_s end |