Class: OmniAI::Google::Chat::Stream
- Inherits:
-
Chat::Stream
- Object
- Chat::Stream
- OmniAI::Google::Chat::Stream
- Defined in:
- lib/omniai/google/chat/stream.rb
Overview
A stream given when streaming.
Instance Method Summary collapse
Instance Method Details
#stream! {|OmniAI::Chat::Chunk| ... } ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/omniai/google/chat/stream.rb', line 9 def stream!(&) @response.body.each do |chunk| @parser.feed(chunk) do |_, data| yield(Chunk.new(data: JSON.parse(data))) end end end |