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



130
131
132
133
134
135
136
137
# File 'lib/dspy/lm/response.rb', line 130

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

#to_sObject



125
126
127
# File 'lib/dspy/lm/response.rb', line 125

def to_s
  content
end