Class: DSPy::LM::OpenAIResponseMetadata

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

Overview

OpenAI-specific metadata with additional fields

Instance Method Summary collapse

Instance Method Details

#to_hObject



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/dspy/lm/response.rb', line 44

def to_h
  hash = {
    provider: provider,
    model: model
  }
  hash[:response_id] = response_id if response_id
  hash[:created] = created if created
  hash[:structured_output] = structured_output unless structured_output.nil?
  hash[:system_fingerprint] = system_fingerprint if system_fingerprint
  hash[:finish_reason] = finish_reason if finish_reason
  hash
end