API/Content.pm

filter: Statementstmt 76.9% 30 / 39 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 77.7% 7 / 9 Podpod 100% 4 / 4 totaltotal 69.8% 44 / 63 CC 5 SCAR 9.1
CC
5
Cov
70%
thinking
6.0
new
3.1
text
2.0
CRAP 2.5
« API/Anthropic.pm ↑ Summary API/Response.pm »
1 package LLM::API::Content;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 ▶use English qw(-no_match_vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 ▶use JSON::PP;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 6 our @ACCESSORS = qw(blocks);
10  
11 6 __PACKAGE__->follow_best_practice;
12 6 __PACKAGE__->mk_accessors(@ACCESSORS);
13  
14 6 our $VERSION = '2.0.0';
15  
16 6 ▶use parent qw(Class::Accessor::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 ########################################################################
19 12 ▶sub new {
Subroutine new: called CC=3 SCAR=11.3
Pod documented
20 ########################################################################
21 12 my ( $class, $content ) = @_;
22  
23 12 ▶ $content = ref $content ? $content : decode_json($content);
Branch: 1 branch
BranchTrueFalseTotal
ref $content ? : 12 0 12
24  
25 12 my $self = $class->SUPER::new();
26  
27 12 ▶ $self->set_blocks( $content // [] );
Condition50%1/2
$content // []
l!l
120
MC/DC0%0/1
$content // []
$content
Truth table50%1/2
A
A= $content
Aresult
11
00
28  
29 12 return $self;
30 }
31  
32 ########################################################################
33 8 ▶sub text {
Subroutine text: called CC=2 SCAR=7.0
Pod documented
34 ########################################################################
35 8 my ($self) = @_;
36  
37 8 ▶ return join q{}, map { $_->{text} // q{} } grep { $_->{type} eq 'text' } @{ $self->get_blocks };
Condition50%1/2
$_->{"text"} // ""
l!l
80
MC/DC0%0/1
$_->{"text"} // ""
$_->{"text"}
Truth table50%1/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 6 1;
57  
58 __END__
« API/Anthropic.pm ↑ Summary API/Response.pm »