Class: DSPy::LM::AnthropicResponseMetadata

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

Overview

Anthropic-specific metadata with additional fields

Instance Method Summary collapse

Instance Method Details

#to_hObject



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/dspy/lm/response.rb', line 72

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[:stop_reason] = stop_reason if stop_reason
  hash[:stop_sequence] = stop_sequence if stop_sequence
  hash[:tool_calls] = tool_calls if tool_calls
  hash
end