Class: DSPy::Instrumentation::LMTokensEvent

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

Overview

Token usage event payload

Instance Method Summary collapse

Instance Method Details

#to_hObject



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/dspy/instrumentation/event_payloads.rb', line 71

def to_h
  hash = {
    timestamp: timestamp,
    status: status,
    input_tokens: input_tokens,
    output_tokens: output_tokens,
    total_tokens: total_tokens,
    gen_ai_system: gen_ai_system,
    gen_ai_request_model: gen_ai_request_model
  }
  hash[:signature_class] = signature_class if signature_class
  hash
end