Class: DSPy::Instrumentation::PredictEvent

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dspy/instrumentation/event_payloads.rb

Overview

Predict event payload

Instance Method Summary collapse

Instance Method Details

#to_hObject



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/dspy/instrumentation/event_payloads.rb', line 150

def to_h
  hash = {
    timestamp: timestamp,
    duration_ms: duration_ms,
    cpu_time_ms: cpu_time_ms,
    status: status,
    signature_class: signature_class,
    module_name: module_name,
    model: model,
    provider: provider,
    input_fields: input_fields
  }
  hash[:input_size] = input_size if input_size
  hash[:output_size] = output_size if output_size
  hash[:error_type] = error_type if error_type
  hash[:error_message] = error_message if error_message
  hash
end