Class: DSPy::LM::Response

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

Overview

Normalized response format for all LM providers

Instance Method Summary collapse

Instance Method Details

#to_hObject



101
102
103
104
105
106
107
108
# File 'lib/dspy/lm/response.rb', line 101

def to_h
  hash = {
    content: content
  }
  hash[:usage] = usage.to_h if usage
  hash[:metadata] = .is_a?(Hash) ?  : .to_h
  hash
end

#to_sObject



96
97
98
# File 'lib/dspy/lm/response.rb', line 96

def to_s
  content
end