Class: RubyLLM::Tool::Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/tool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type: 'string', description: nil, required: true) ⇒ Parameter

Returns a new instance of Parameter.



8
9
10
11
12
13
# File 'lib/ruby_llm/tool.rb', line 8

def initialize(name, type: 'string', description: nil, required: true)
  @name = name
  @type = type
  @description = description
  @required = required
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/ruby_llm/tool.rb', line 6

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/ruby_llm/tool.rb', line 6

def name
  @name
end

#requiredObject (readonly)

Returns the value of attribute required.



6
7
8
# File 'lib/ruby_llm/tool.rb', line 6

def required
  @required
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/ruby_llm/tool.rb', line 6

def type
  @type
end

Instance Method Details

#to_hObject



15
16
17
18
19
20
21
# File 'lib/ruby_llm/tool.rb', line 15

def to_h
  {
    type: type,
    description: description,
    required: required
  }.compact
end