Class: Durable::Llm::Providers::Groq::GroqStreamResponse
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Groq::GroqStreamResponse
- Defined in:
- lib/durable/llm/providers/groq.rb
Instance Attribute Summary collapse
-
#choices ⇒ Object
readonly
Returns the value of attribute choices.
Instance Method Summary collapse
-
#initialize(fragment) ⇒ GroqStreamResponse
constructor
A new instance of GroqStreamResponse.
- #to_s ⇒ Object
Constructor Details
#initialize(fragment) ⇒ GroqStreamResponse
Returns a new instance of GroqStreamResponse.
134 135 136 137 138 139 |
# File 'lib/durable/llm/providers/groq.rb', line 134 def initialize(fragment) json_frag = fragment.split('data: ').last.strip puts json_frag parsed = JSON.parse(json_frag) @choices = parsed['choices'].map { |choice| GroqStreamChoice.new(choice) } end |
Instance Attribute Details
#choices ⇒ Object (readonly)
Returns the value of attribute choices.
132 133 134 |
# File 'lib/durable/llm/providers/groq.rb', line 132 def choices @choices end |
Instance Method Details
#to_s ⇒ Object
141 142 143 |
# File 'lib/durable/llm/providers/groq.rb', line 141 def to_s @choices.map(&:to_s).join(' ') end |