Class: Roseflow::OpenRouter::StreamingData

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/roseflow/open_router/response.rb

Class Method Summary collapse

Class Method Details

.from_chunk(data) ⇒ Object



82
83
84
85
86
87
88
# File 'lib/roseflow/open_router/response.rb', line 82

def self.from_chunk(data)
  return StreamingDone.new if data == "[DONE]"
  new(FastJsonparser.parse(data.strip))
rescue StandardError => e
  puts "FAILED: #{data}"
  puts "EXCEPTION: #{e.message}"
end