Class: Anthemic::Tools::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/anthemic/tools/base.rb

Direct Known Subclasses

WebSearch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, description:) ⇒ Base

Initialize a new tool

Parameters:

  • name (String)

    the name of the tool

  • description (String)

    a description of what the tool does



12
13
14
15
# File 'lib/anthemic/tools/base.rb', line 12

def initialize(name:, description:)
  @name = name
  @description = description
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/anthemic/tools/base.rb', line 6

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/anthemic/tools/base.rb', line 6

def name
  @name
end

Instance Method Details

#run(args = {}) ⇒ Object

Run the tool with provided arguments

Parameters:

  • args (Hash) (defaults to: {})

    arguments for the tool

Returns:

  • (Object)

    the result of running the tool

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/anthemic/tools/base.rb', line 21

def run(args = {})
  raise NotImplementedError, "Subclasses must implement #run"
end