« blib/lib/SignalWire/Agents/Skills/Builtin/InfoGatherer.pm
↑ Summary
blib/lib/SignalWire/Agents/REST/Namespaces/Compat.pm »
| 1 | package SignalWire::Agents::Skills::Builtin::CustomSkills; | ||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 3 | ▶ | use Moo; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 3 | extends 'SignalWire::Agents::Skills::SkillBase'; | |||||||||||||
| 6 | |||||||||||||||
| 7 | 3 | ▶ | use SignalWire::Agents::Skills::SkillRegistry; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | 3 | SignalWire::Agents::Skills::SkillRegistry->register_skill('custom_skills', __PACKAGE__); | |||||||||||||
| 9 | |||||||||||||||
| 10 | 8 | ▶ | has '+skill_name' => (default => sub { 'custom_skills' }); | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | 8 | ▶ | has '+skill_description' => (default => sub { 'Register user-defined custom tools' }); | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 12 | 8 | ▶ | has '+supports_multiple_instances' => (default => sub { 1 }); | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 13 | |||||||||||||||
| 14 | 7 | ▶ | sub setup { 1 } | ||||||||||||
|
Subroutine
setup: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||
| 15 | |||||||||||||||
| 16 | 6 | ▶ | sub register_tools { | ||||||||||||
|
Subroutine
register_tools: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 17 | 6 | my ($self) = @_; | |||||||||||||
| 18 | 6 | ▶ | my $tools = $self->params->{tools} // []; | ||||||||||||
|
Condition100%2/2
$self->params->{"tools"} // []
MC/DC100%1/1
$self->params->{"tools"} // []
$self->params->{"tools"}
Truth table100%2/2
A
A= $self->params->{"tools"}
| |||||||||||||||
| 19 | |||||||||||||||
| 20 | 6 | for my $tool_def (@$tools) { | |||||||||||||
| 21 | 7 | ▶ | next unless ref $tool_def eq 'HASH'; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 22 | 5 | ▶ | if (exists $tool_def->{function}) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 23 | 2 | $self->agent->register_swaig_function($tool_def); | |||||||||||||
| 24 | } elsif (exists $tool_def->{name}) { | ||||||||||||||
| 25 | 3 | $self->agent->define_tool(%$tool_def); | |||||||||||||
| 26 | } | ||||||||||||||
| 27 | } | ||||||||||||||
| 28 | } | ||||||||||||||
| 29 | |||||||||||||||
| 30 | 1 | ▶ | sub get_parameter_schema { | ||||||||||||
|
Subroutine
get_parameter_schema: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||
| 31 | return { | ||||||||||||||
| 32 | 1 | %{ SignalWire::Agents::Skills::SkillBase->get_parameter_schema }, | |||||||||||||
| 33 | tools => { type => 'array', description => 'Array of tool definition objects' }, | ||||||||||||||
| 34 | }; | ||||||||||||||
| 35 | } | ||||||||||||||
| 36 | |||||||||||||||
| 37 | 3 | 1; | |||||||||||||