Class: Coolhand::OpenAi::BatchResultProcessor
- Inherits:
-
Object
- Object
- Coolhand::OpenAi::BatchResultProcessor
- Defined in:
- lib/coolhand/open_ai/batch_result_processor.rb
Instance Attribute Summary collapse
-
#event_data ⇒ Object
readonly
Returns the value of attribute event_data.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(event_data:) ⇒ BatchResultProcessor
constructor
A new instance of BatchResultProcessor.
Constructor Details
#initialize(event_data:) ⇒ BatchResultProcessor
Returns a new instance of BatchResultProcessor.
8 9 10 |
# File 'lib/coolhand/open_ai/batch_result_processor.rb', line 8 def initialize(event_data:) @event_data = event_data end |
Instance Attribute Details
#event_data ⇒ Object (readonly)
Returns the value of attribute event_data.
6 7 8 |
# File 'lib/coolhand/open_ai/batch_result_processor.rb', line 6 def event_data @event_data end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/coolhand/open_ai/batch_result_processor.rb', line 12 def call Rails.logger.info("[Interceptor] BatchResultProcessor: #{event_data}") case batch_info["status"] when "completed" process_completed_batch when "failed", "expired", "cancelled" handle_failed_batch when "in_progress", "validating", "finalizing" Rails.logger.info("[Interceptor] OpenAI batch #{event_data} still processing") else Rails.logger.warn("[Interceptor] Unknown batch status: #{batch_info['status']} for batch #{event_data}") end rescue StandardError => e Rails.logger.error("[Interceptor] Failed to process OpenAI batch results for #{event_data}: #{e.}") end |