Class: DSPy::Tools::ToolSchema

Inherits:
T::Struct
  • Object
show all
Defined in:
lib/dspy/tools/schema.rb

Overview

Represents the complete schema for a tool’s parameters This is the “parameters” field in LLM tool definitions

Instance Method Summary collapse

Instance Method Details

#to_hObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dspy/tools/schema.rb', line 25

def to_h
  {
    type: type,
    properties: properties.transform_values do |param|
      h = { type: param.type }
      h[:description] = param.description if param.description
      h[:enum] = param.enum if param.enum
      h
    end,
    required: required
  }
end