Langertha/Role/ParallelToolUse.pm

filter: Statementstmt 100% 14 / 14 Branchbran 100% 10 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 26 / 26 CC 6 SCAR 16.7
CC
6
Cov
100%
__ANON__
6.0
BEGIN
1.0
CRAP 5.3
« Langertha/RateLimit.pm ↑ Summary Langertha/Role/Embedding.pm »
1 package Langertha::Role::ParallelToolUse;
2 # ABSTRACT: Role for an engine that supports parallel tool calling control
3 37 our $VERSION = '0.502';
4 37 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 37 has parallel_tool_use => (
7 is => 'ro',
8 isa => 'Bool',
9 predicate => 'has_parallel_tool_use',
10 );
11  
12 around BUILDARGS => sub {
13 292 ▶ my ( $orig, $class, @args ) = @_;
Subroutine __ANON__: called CC=6 SCAR=17.9
14 292 my $params = $class->$orig(@args);
15  
16 292 ▶ return $params if exists $params->{parallel_tool_use};
Branch: 1 branch
BranchTrueFalseTotal
if exists $$params{"parallel_tool_use"} 1 291 292
17  
18 291 ▶ if ( exists $params->{parallel_tool_calls} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $$params{'parallel_tool_calls'}) { } 2 289 291
elsif (exists $$params{'disable_parallel_tool_use'}) { } 2 287 289
19 2 ▶ $params->{parallel_tool_use} = delete $params->{parallel_tool_calls} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
delete $$params{'parallel_tool_calls'} ? : 1 1 2
20 }
21 elsif ( exists $params->{disable_parallel_tool_use} ) {
22 2 ▶ $params->{parallel_tool_use} = delete $params->{disable_parallel_tool_use} ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
delete $$params{'disable_parallel_tool_use'} ? : 1 1 2
23 }
24  
25 291 return $params;
26 37 };
27  
28  
29  
30 37 1;
31  
32 __END__
33  
34 =pod
35  
36 =encoding UTF-8
37  
38 =head1 NAME
39  
40 Langertha::Role::ParallelToolUse - Role for an engine that supports parallel tool calling control
41  
42 =head1 VERSION
43  
44 version 0.502
45  
46 =head2 parallel_tool_use
47  
48 parallel_tool_use => 1 # allow multiple tool calls per assistant turn
49 parallel_tool_use => 0 # restrict to one tool call per turn
50  
51 Canonical boolean controlling whether the model may emit multiple tool calls
52 in a single assistant turn. Translated per-engine to the provider's native
53 parameter:
54  
55 =over 4
56  
57 =item * OpenAI-compatible engines send C<parallel_tool_calls> in the request.
58  
59 =item * Anthropic-compatible engines send C<< disable_parallel_tool_use => !parallel_tool_use >>
60 in the C<tool_choice> block.
61  
62 =back
63  
64 For convenience the constructor also accepts the provider-native names as
65 aliases and normalizes them:
66  
67 # all three are equivalent
68 ->new( parallel_tool_use => 0 )
69 ->new( parallel_tool_calls => 0 ) # OpenAI name
70 ->new( disable_parallel_tool_use => 1 ) # Anthropic name (inverted)
71  
72 If unset the provider default is used (typically parallel enabled).
73  
74 =head1 SEE ALSO
75  
76 =over
77  
78 =item * L<Langertha::Role::Tools> - MCP tool calling interface
79  
80 =item * L<Langertha::ToolChoice> - Canonical tool_choice conversion
81  
82 =back
83  
84 =head1 SUPPORT
85  
86 =head2 Issues
87  
88 Please report bugs and feature requests on GitHub at
89 L<https://github.com/Getty/langertha/issues>.
90  
91 =head2 IRC
92  
93 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
94  
95 =head1 CONTRIBUTING
96  
97 Contributions are welcome! Please fork the repository and submit a pull request.
98  
99 =head1 AUTHOR
100  
101 Torsten Raudssus <getty@cpan.org>
102  
103 =head1 COPYRIGHT AND LICENSE
104  
105 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
106  
107 This is free software; you can redistribute it and/or modify it under
108 the same terms as the Perl 5 programming language system itself.
109  
110 =cut
« Langertha/RateLimit.pm ↑ Summary Langertha/Role/Embedding.pm »