| 1 | package CPAN::Maker::Bootstrapper::Role::LLM::Models; | ||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use open ':std', ':encoding(UTF-8)'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use CLI::Simple::Constants qw(:booleans); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use CPAN::Maker::Bootstrapper::Role::LLM::Utils; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Role::Tiny; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||
| 13 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub cmd_models { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_models: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 15 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||
| 18 | 0 | $self->_load_ASCIITable; | |||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my ($api_key) = $self->get_args; | |||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||
| 22 | 0 | my $llm = $self->_check_llm($api_key); | |||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||
| 24 | 0 | $self->_show_models( $llm->models ); | |||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||
| 26 | 0 | return $SUCCESS; | |||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||
| 29 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub _show_models { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_show_models: not called CC=16 SCAR=56.1
| |||||||||||||||||||||||||||||||||||||||
| 31 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my ( $self, $models ) = @_; | |||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if ( !$models || !%{$models} ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$models and %{$models;}
MC/DC0%0/2
$models and %{$models;}
$models
%{$models;}
Truth table0%0/3
A and B
A= $modelsB= %{$models;}
| |||||||||||||||||||||||||||||||||||||||
| 35 | 0 | print {*STDOUT} "No models available.\n\n"; | |||||||||||||||||||||||||||||||||||||
| 36 | 0 | return; | |||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $t = Text::ASCIITable->new( { headingText => 'Available Models' } ); | |||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $t->setCols( 'Model ID', 'Display Name', 'Context', 'Output', 'Released', 'Capabilities' ); | |||||||||||||||||||||||||||||||||||||
| 42 | 0 | $t->setColWidth( 'Model ID', 30 ); | |||||||||||||||||||||||||||||||||||||
| 43 | 0 | $t->setColWidth( 'Display Name', 18 ); | |||||||||||||||||||||||||||||||||||||
| 44 | 0 | $t->setColWidth( 'Context', 9 ); | |||||||||||||||||||||||||||||||||||||
| 45 | 0 | $t->setColWidth( 'Output', 9 ); | |||||||||||||||||||||||||||||||||||||
| 46 | 0 | $t->setColWidth( 'Released', 10 ); | |||||||||||||||||||||||||||||||||||||
| 47 | 0 | $t->setColWidth( 'Capabilities', 30 ); | |||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||
| 49 | 0 | foreach my $model_id ( sort keys %{$models} ) { | |||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $m = $models->{$model_id}; | |||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my $caps = $m->{capabilities} // {}; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$m->{"capabilities"} // {}
MC/DC0%0/1
$m->{"capabilities"} // {}
$m->{"capabilities"}
Truth table0%0/2
A
A= $m->{"capabilities"}
| |||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | my $display = $m->{display_name} // q{-}; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$m->{"display_name"} // "-"
MC/DC0%0/1
$m->{"display_name"} // "-"
$m->{"display_name"}
Truth table0%0/2
A
A= $m->{"display_name"}
| |||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $context = CPAN::Maker::Bootstrapper::Role::LLM::Utils::_fmt_tokens( $m->{max_input_tokens} ); | |||||||||||||||||||||||||||||||||||||
| 55 | 0 | my $output = CPAN::Maker::Bootstrapper::Role::LLM::Utils::_fmt_tokens( $m->{max_tokens} ); | |||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | my $released = ( $m->{created_at} // q{} ) =~ s/T.+//xsmr; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$m->{"created_at"} // ""
MC/DC0%0/1
$m->{"created_at"} // ""
$m->{"created_at"}
Truth table0%0/2
A
A= $m->{"created_at"}
| |||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | my $cap_str = join q{ }, grep {defined} ( $caps->{thinking}{supported} ? 'think' : undef ), | ||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||
| 59 | ( $caps->{image_input}{supported} ? 'img' : undef ), | ||||||||||||||||||||||||||||||||||||||
| 60 | ( $caps->{pdf_input}{supported} ? 'pdf' : undef ), | ||||||||||||||||||||||||||||||||||||||
| 61 | ( $caps->{code_execution}{supported} ? 'code' : undef ), | ||||||||||||||||||||||||||||||||||||||
| 62 | ( $caps->{batch}{supported} ? 'batch' : undef ), | ||||||||||||||||||||||||||||||||||||||
| 63 | ( $caps->{citations}{supported} ? 'cite' : undef ), | ||||||||||||||||||||||||||||||||||||||
| 64 | ( $caps->{structured_outputs}{supported} ? 'json' : undef ), | ||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ( $caps->{effort}{supported} ? 'effort' : undef ); | |||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $t->addRow( $model_id, $display, $context, $output, $released, $cap_str ); | |||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||
| 70 | 0 | print {*STDOUT} $t; | |||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | printf {*STDOUT} "%d model%s.\n\n", scalar keys %{$models}, scalar keys %{$models} == 1 ? q{} : q{s}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||
| 74 | 0 | return; | |||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||
| 77 | 2 | 1; | |||||||||||||||||||||||||||||||||||||