Class: OpenAI::Helpers::Streaming::UnknownStreamEvent
- Inherits:
-
Object
- Object
- OpenAI::Helpers::Streaming::UnknownStreamEvent
- Defined in:
- lib/openai/helpers/streaming/unknown_stream_event.rb,
sig/openai/helpers/streaming/unknown_stream_event.rbs
Overview
A Responses event whose discriminator is newer than this SDK version.
Instance Attribute Summary collapse
- #data ⇒ Hash{Symbol=>Object} readonly
- #sequence_number ⇒ Integer? readonly
- #type ⇒ Symbol readonly
Instance Method Summary collapse
-
#initialize(data:) ⇒ UnknownStreamEvent
constructor
private
A new instance of UnknownStreamEvent.
- #to_h ⇒ Hash{Symbol=>Object}
Constructor Details
#initialize(data:) ⇒ UnknownStreamEvent
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of UnknownStreamEvent.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/openai/helpers/streaming/unknown_stream_event.rb', line 18 def initialize(data:) value = data.fetch(:type) unless value.is_a?(String) || value.is_a?(Symbol) raise ArgumentError, "Responses stream event type must be a string or symbol" end @type = value.to_sym sequence_number = data[:sequence_number] @sequence_number = sequence_number if sequence_number.is_a?(Integer) @data = freeze_json(data) freeze end |
Instance Attribute Details
#data ⇒ Hash{Symbol=>Object} (readonly)
15 16 17 |
# File 'lib/openai/helpers/streaming/unknown_stream_event.rb', line 15 def data @data end |
#sequence_number ⇒ Integer? (readonly)
12 13 14 |
# File 'lib/openai/helpers/streaming/unknown_stream_event.rb', line 12 def sequence_number @sequence_number end |
#type ⇒ Symbol (readonly)
9 10 11 |
# File 'lib/openai/helpers/streaming/unknown_stream_event.rb', line 9 def type @type end |
Instance Method Details
#to_h ⇒ Hash{Symbol=>Object}
32 |
# File 'lib/openai/helpers/streaming/unknown_stream_event.rb', line 32 def to_h = @data |