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.



93
94
95
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 93

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

Instance Method Details

#on_chunk_event(&block) ⇒ Object



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

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

#on_error_event(&block) ⇒ Object



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

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

#on_event(&block) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
# File 'gems/aws-sdk-bedrockruntime/lib/aws-sdk-bedrockruntime/event_streams.rb', line 133

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_error_event(&block)
  on_initial_response_event(&block)
  on_unknown_event(&block)
end

#on_initial_response_event(&block) ⇒ Object



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

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

#on_internal_server_exception_event(&block) ⇒ Object



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

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



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

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



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

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

#on_throttling_exception_event(&block) ⇒ Object



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

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

#on_unknown_event(&block) ⇒ Object



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

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

#on_validation_exception_event(&block) ⇒ Object



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

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