Class: DSPy::Instrumentation::LMRequestEvent

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

Overview

LM Request event payload

Instance Method Summary collapse

Instance Method Details

#to_hObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/dspy/instrumentation/event_payloads.rb', line 34

def to_h
  hash = {
    timestamp: timestamp,
    duration_ms: duration_ms,
    cpu_time_ms: cpu_time_ms,
    status: status,
    gen_ai_operation_name: gen_ai_operation_name,
    gen_ai_system: gen_ai_system,
    gen_ai_request_model: gen_ai_request_model,
    provider: provider,
    adapter_class: adapter_class,
    input_size: input_size
  }
  hash[:signature_class] = signature_class if signature_class
  hash[:error_type] = error_type if error_type
  hash[:error_message] = error_message if error_message
  hash
end