| 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
| |||||||||||||
| 24 | |||||||||||||
| 25 | 12 | my $self = $class->SUPER::new(); | |||||||||||
| 26 | |||||||||||||
| 27 | 12 | ▶ | $self->set_blocks( $content // [] ); | ||||||||||
|
Condition50%1/2
$content // []
MC/DC0%0/1
$content // []
$content
Truth table50%1/2
A
A= $content
| |||||||||||||
| 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"} // ""
MC/DC0%0/1
$_->{"text"} // ""
$_->{"text"}
Truth table50%1/2
A
A= $_->{"text"}
| |||||||||||||
| 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"} // ""
MC/DC0%0/1
$_->{"thinking"} // ""
$_->{"thinking"}
Truth table0%0/2
A
A= $_->{"thinking"}
| |||||||||||||
| 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__ | ||||||||||||