Class: OpenAICompatibleErrors::StreamState

Inherits:
Struct
  • Object
show all
Defined in:
lib/openai_compatible_errors/sse.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(events_seen: 0, malformed_events: 0, has_output: false, protocol: :unknown, termination: :open, error: nil) ⇒ StreamState

Returns a new instance of StreamState.



8
9
10
11
12
# File 'lib/openai_compatible_errors/sse.rb', line 8

def initialize(events_seen: 0, malformed_events: 0, has_output: false,
               protocol: :unknown, termination: :open, error: nil)
  super
  freeze
end

Instance Attribute Details

#errorObject

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



6
7
8
# File 'lib/openai_compatible_errors/sse.rb', line 6

def error
  @error
end

#events_seenObject

Returns the value of attribute events_seen

Returns:

  • (Object)

    the current value of events_seen



6
7
8
# File 'lib/openai_compatible_errors/sse.rb', line 6

def events_seen
  @events_seen
end

#has_outputObject

Returns the value of attribute has_output

Returns:

  • (Object)

    the current value of has_output



6
7
8
# File 'lib/openai_compatible_errors/sse.rb', line 6

def has_output
  @has_output
end

#malformed_eventsObject

Returns the value of attribute malformed_events

Returns:

  • (Object)

    the current value of malformed_events



6
7
8
# File 'lib/openai_compatible_errors/sse.rb', line 6

def malformed_events
  @malformed_events
end

#protocolObject

Returns the value of attribute protocol

Returns:

  • (Object)

    the current value of protocol



6
7
8
# File 'lib/openai_compatible_errors/sse.rb', line 6

def protocol
  @protocol
end

#terminationObject

Returns the value of attribute termination

Returns:

  • (Object)

    the current value of termination



6
7
8
# File 'lib/openai_compatible_errors/sse.rb', line 6

def termination
  @termination
end

Instance Method Details

#done?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/openai_compatible_errors/sse.rb', line 14

def done?
  termination == :done
end

#incomplete?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/openai_compatible_errors/sse.rb', line 18

def incomplete?
  termination == :incomplete
end

#unexpected_eof?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/openai_compatible_errors/sse.rb', line 22

def unexpected_eof?
  termination == :unexpected_eof
end