Class: Aws::BedrockRuntime::EventStreams::ResponseStream

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-bedrockruntime/event_streams.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponseStream

Returns a new instance of ResponseStream.



98
99
100
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 98

def initialize
  @event_emitter = Aws::EventEmitter.new
end

Instance Attribute Details

#event_emitterObject (readonly)

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 Aws::EventEmitter.

Returns:

  • Aws::EventEmitter



157
158
159
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 157

def event_emitter
  @event_emitter
end

Instance Method Details

#on_chunk_event(&block) ⇒ Object



102
103
104
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 102

def on_chunk_event(&block)
  @event_emitter.on(:chunk, block) if block_given?
end

#on_error_event(&block) ⇒ Object



130
131
132
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 130

def on_error_event(&block)
  @event_emitter.on(:error, block) if block_given?
end

#on_event(&block) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 142

def on_event(&block)
  on_chunk_event(&block)
  on_internal_server_exception_event(&block)
  on_model_stream_error_exception_event(&block)
  on_validation_exception_event(&block)
  on_throttling_exception_event(&block)
  on_model_timeout_exception_event(&block)
  on_service_unavailable_exception_event(&block)
  on_error_event(&block)
  on_initial_response_event(&block)
  on_unknown_event(&block)
end

#on_initial_response_event(&block) ⇒ Object



134
135
136
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 134

def on_initial_response_event(&block)
  @event_emitter.on(:initial_response, block) if block_given?
end

#on_internal_server_exception_event(&block) ⇒ Object



106
107
108
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 106

def on_internal_server_exception_event(&block)
  @event_emitter.on(:internal_server_exception, block) if block_given?
end

#on_model_stream_error_exception_event(&block) ⇒ Object



110
111
112
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 110

def on_model_stream_error_exception_event(&block)
  @event_emitter.on(:model_stream_error_exception, block) if block_given?
end

#on_model_timeout_exception_event(&block) ⇒ Object



122
123
124
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 122

def on_model_timeout_exception_event(&block)
  @event_emitter.on(:model_timeout_exception, block) if block_given?
end

#on_service_unavailable_exception_event(&block) ⇒ Object



126
127
128
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 126

def on_service_unavailable_exception_event(&block)
  @event_emitter.on(:service_unavailable_exception, block) if block_given?
end

#on_throttling_exception_event(&block) ⇒ Object



118
119
120
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 118

def on_throttling_exception_event(&block)
  @event_emitter.on(:throttling_exception, block) if block_given?
end

#on_unknown_event(&block) ⇒ Object



138
139
140
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 138

def on_unknown_event(&block)
  @event_emitter.on(:unknown_event, block) if block_given?
end

#on_validation_exception_event(&block) ⇒ Object



114
115
116
# File 'lib/aws-sdk-bedrockruntime/event_streams.rb', line 114

def on_validation_exception_event(&block)
  @event_emitter.on(:validation_exception, block) if block_given?
end