| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SignalWire::Agents::Skills::Builtin::WikipediaSearch; |
|
2
|
3
|
|
|
3
|
|
22
|
use strict; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
145
|
|
|
3
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
265
|
|
|
4
|
3
|
|
|
3
|
|
25
|
use Moo; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
28
|
|
|
5
|
|
|
|
|
|
|
extends 'SignalWire::Agents::Skills::SkillBase'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1494
|
use SignalWire::Agents::Skills::SkillRegistry; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
1458
|
|
|
8
|
|
|
|
|
|
|
SignalWire::Agents::Skills::SkillRegistry->register_skill('wikipedia_search', __PACKAGE__); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has '+skill_name' => (default => sub { 'wikipedia_search' }); |
|
11
|
|
|
|
|
|
|
has '+skill_description' => (default => sub { 'Search Wikipedia for information about a topic and get article summaries' }); |
|
12
|
|
|
|
|
|
|
has '+supports_multiple_instances' => (default => sub { 0 }); |
|
13
|
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
0
|
2347
|
sub setup { 1 } |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub register_tools { |
|
17
|
3
|
|
|
3
|
0
|
602
|
my ($self) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$self->define_tool( |
|
20
|
|
|
|
|
|
|
name => 'search_wiki', |
|
21
|
|
|
|
|
|
|
description => 'Search Wikipedia for information about a topic and get article summaries', |
|
22
|
|
|
|
|
|
|
parameters => { |
|
23
|
|
|
|
|
|
|
type => 'object', |
|
24
|
|
|
|
|
|
|
properties => { |
|
25
|
|
|
|
|
|
|
query => { type => 'string', description => 'The search query' }, |
|
26
|
|
|
|
|
|
|
}, |
|
27
|
|
|
|
|
|
|
required => ['query'], |
|
28
|
|
|
|
|
|
|
}, |
|
29
|
|
|
|
|
|
|
handler => sub { |
|
30
|
1
|
|
|
1
|
|
3
|
my ($args, $raw) = @_; |
|
31
|
1
|
|
|
|
|
948
|
require SignalWire::Agents::SWAIG::FunctionResult; |
|
32
|
1
|
|
|
|
|
16
|
return SignalWire::Agents::SWAIG::FunctionResult->new( |
|
33
|
|
|
|
|
|
|
response => "Wikipedia search for: $args->{query}" |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
}, |
|
36
|
3
|
|
|
|
|
71
|
); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _get_prompt_sections { |
|
40
|
|
|
|
|
|
|
return [{ |
|
41
|
1
|
|
|
1
|
|
11
|
title => 'Wikipedia Search', |
|
42
|
|
|
|
|
|
|
body => 'You can search Wikipedia for factual information.', |
|
43
|
|
|
|
|
|
|
bullets => [ |
|
44
|
|
|
|
|
|
|
'Use search_wiki to find information about any topic', |
|
45
|
|
|
|
|
|
|
'Results include article summaries from Wikipedia', |
|
46
|
|
|
|
|
|
|
], |
|
47
|
|
|
|
|
|
|
}]; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub get_parameter_schema { |
|
51
|
|
|
|
|
|
|
return { |
|
52
|
1
|
|
|
1
|
0
|
7180
|
%{ SignalWire::Agents::Skills::SkillBase->get_parameter_schema }, |
|
|
1
|
|
|
|
|
9
|
|
|
53
|
|
|
|
|
|
|
num_results => { type => 'integer', default => 1, min => 1, max => 5 }, |
|
54
|
|
|
|
|
|
|
no_results_message => { type => 'string' }, |
|
55
|
|
|
|
|
|
|
}; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |