API/Content.pm

filter: Statementstmt 51.2% 20 / 39 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 55.5% 5 / 9 Podpod 100% 4 / 4 totaltotal 46.0% 29 / 63 CC 5 SCAR 16.4
CC
5
Cov
43%
new
12.0
text
6.0
thinking
6.0
CRAP 5.2
« API.pm ↑ Summary API/Response.pm »
1 package LLM::API::Content;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use English qw(-no_match_vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use JSON::PP;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our @ACCESSORS = qw(blocks);
10  
11 1 __PACKAGE__->follow_best_practice;
12 1 __PACKAGE__->mk_accessors(@ACCESSORS);
13  
14 1 our $VERSION = '1.0.1';
15  
16 1 ▶use parent qw(Class::Accessor::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 ########################################################################
19 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
20 ########################################################################
21 0 my ( $class, $content ) = @_;
22  
23 0 ▶ $content = ref $content ? $content : decode_json($content);
Branch: 1 branch
BranchTrueFalseTotal
ref $content ? : 0 0 0
24  
25 0 my $self = $class->SUPER::new();
26  
27 0 ▶ $self->set_blocks( $content // [] );
Condition0%0/2
$content // []
l!l
00
MC/DC0%0/1
$content // []
$content
Truth table0%0/2
A
A= $content
Aresult
11
00
28  
29 0 return $self;
30 }
31  
32 ########################################################################
33 0 ▶sub text {
Subroutine text: not called CC=2 SCAR=17.9
Pod documented
34 ########################################################################
35 0 my ($self) = @_;
36  
37 0 ▶ return join q{}, map { $_->{text} // q{} } grep { $_->{type} eq 'text' } @{ $self->get_blocks };
Condition0%0/2
$_->{"text"} // ""
l!l
00
MC/DC0%0/1
$_->{"text"} // ""
$_->{"text"}
Truth table0%0/2
A
A= $_->{"text"}
Aresult
11
00
38 }
39  
40 ########################################################################
41 0 ▶sub thinking {
Subroutine thinking: not called CC=2 SCAR=17.9
Pod documented
42 ########################################################################
43 0 my ($self) = @_;
44  
45 0 ▶ return join qq{\n}, map { $_->{thinking} // q{} } grep { $_->{type} eq 'thinking' } @{ $self->get_blocks };
Condition0%0/2
$_->{"thinking"} // ""
l!l
00
MC/DC0%0/1
$_->{"thinking"} // ""
$_->{"thinking"}
Truth table0%0/2
A
A= $_->{"thinking"}
Aresult
11
00
46 }
47  
48 ########################################################################
49 0 ▶sub tool_uses {
Subroutine tool_uses: not called CC=1 SCAR=6.9
Pod documented
50 ########################################################################
51 0 my ($self) = @_;
52  
53 0 return [ grep { $_->{type} eq 'tool_use' } @{ $self->get_blocks } ];
54 }
55  
56 1 1;
57  
58 __END__
« API.pm ↑ Summary API/Response.pm »