Class: SignalWire::Skills::Builtin::MathSkill

Inherits:
SkillBase
  • Object
show all
Defined in:
lib/signalwire/skills/builtin/math.rb

Instance Attribute Summary

Attributes inherited from SkillBase

#agent, #logger, #params, #swaig_fields

Instance Method Summary collapse

Methods inherited from SkillBase

#cleanup, #get_global_data, #get_hints, #get_param, #get_parameter_schema, #initialize, #instance_key, #required_env_vars, #setup, #supports_multiple_instances?, #version

Constructor Details

This class inherits a constructor from SignalWire::Skills::SkillBase

Instance Method Details

#descriptionObject



11
# File 'lib/signalwire/skills/builtin/math.rb', line 11

def description; 'Perform basic mathematical calculations'; end

#get_prompt_sectionsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/signalwire/skills/builtin/math.rb', line 26

def get_prompt_sections
  [
    {
      'title' => 'Mathematical Calculations',
      'body' => 'You can perform mathematical calculations for users.',
      'bullets' => [
        'Use the calculate tool for any math expressions',
        'Supports basic operations: +, -, *, /, %, ** (power)',
        'Can handle parentheses for complex expressions'
      ]
    }
  ]
end

#nameObject



10
# File 'lib/signalwire/skills/builtin/math.rb', line 10

def name;        'math'; end

#register_toolsObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/signalwire/skills/builtin/math.rb', line 13

def register_tools
  [
    {
      name: 'calculate',
      description: 'Perform a mathematical calculation with basic operations (+, -, *, /, %, **)',
      parameters: {
        'expression' => { 'type' => 'string', 'description' => "Mathematical expression to evaluate (e.g., '2 + 3 * 4', '(10 + 5) / 3')" }
      },
      handler: method(:handle_calculate)
    }
  ]
end