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

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

Instance Method Summary collapse

Constructor Details

#initializeResponseStream

Returns a new instance of ResponseStream.



185
186
187
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 185

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

Instance Method Details

#on_chunk_event(&block) ⇒ Object



189
190
191
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 189

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

#on_error_event(&block) ⇒ Object



217
218
219
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 217

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

#on_event(&block) ⇒ Object



229
230
231
232
233
234
235
236
237
238
239
240
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 229

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



221
222
223
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 221

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

#on_internal_server_exception_event(&block) ⇒ Object



193
194
195
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 193

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



197
198
199
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 197

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



209
210
211
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 209

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



213
214
215
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 213

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

#on_throttling_exception_event(&block) ⇒ Object



205
206
207
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 205

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

#on_unknown_event(&block) ⇒ Object



225
226
227
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 225

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

#on_validation_exception_event(&block) ⇒ Object



201
202
203
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 201

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