Module: LLM::Tool::Param::Utils Private

Extended by:
Utils
Included in:
Utils
Defined in:
lib/llm/tool/param.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#fetch(properties, name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



79
80
81
# File 'lib/llm/tool/param.rb', line 79

def fetch(properties, name)
  properties[name] || properties.fetch(name.to_s)
end

#resolve(schema, type) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



64
65
66
# File 'lib/llm/tool/param.rb', line 64

def resolve(schema, type)
  LLM::Schema::Utils.resolve(schema, type)
end

#setup(leaf, description, options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



68
69
70
71
72
73
74
75
76
77
# File 'lib/llm/tool/param.rb', line 68

def setup(leaf, description, options)
  required = options.fetch(:required, false)
  default = options.fetch(:default, nil)
  enum = options.fetch(:enum, nil)
  leaf.required if required
  leaf.description(description) if description
  leaf.default(default) if default
  leaf.enum(*enum) if enum
  leaf
end