VecDB/Role/Embedding.pm

filter: Statementstmt 52.9% 9 / 17 Branchbran n/a Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 2 / 4 Podpod 100% 2 / 2 totaltotal 38.2% 13 / 34 CC 4 SCAR 19.7
CC
4
Cov
38%
add_text
12.0
search_text
6.0
BEGIN
1.0
CRAP 7.1
« VecDB/Collection.pm ↑ Summary VecDB.pm »
1 package SQLite::VecDB::Role::Embedding;
2 # ABSTRACT: Langertha embedding integration for SQLite::VecDB collections
3 1 our $VERSION = '0.001';
4  
5 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 requires qw( add search embedding );
9  
10 0 ▶sub add_text {
Subroutine add_text: not called CC=3 SCAR=24.8
Pod documented
11 0 my ( $self, %args ) = @_;
12 0 ▶ my $text = delete $args{text} // croak "text is required";
Condition0%0/2
delete $args{"text"} // croak("text is required")
l!l
00
MC/DC0%0/1
delete $args{"text"} // croak("text is required")
delete $args{"text"}
Truth table0%0/2
A
A= delete $args{"text"}
Aresult
11
00
13 0 my $vector = $self->embedding->simple_embedding($text);
14 return $self->add(
15 %args,
16 vector => $vector,
17 0 ▶ content => $args{content} // $text,
Condition0%0/3
$args{"content"} // $text
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{"content"} // $text
$args{"content"} $text
Truth table0%0/3
A // B
A= $args{"content"}B= $text
ABresult
1X1
011
000
18 );
19 }
20  
21  
22 0 ▶sub search_text {
Subroutine search_text: not called CC=2 SCAR=17.9
Pod documented
23 0 my ( $self, %args ) = @_;
24 0 ▶ my $text = delete $args{text} // croak "text is required";
Condition0%0/2
delete $args{"text"} // croak("text is required")
l!l
00
MC/DC0%0/1
delete $args{"text"} // croak("text is required")
delete $args{"text"}
Truth table0%0/2
A
A= delete $args{"text"}
Aresult
11
00
25 0 my $vector = $self->embedding->simple_embedding($text);
26 0 return $self->search(
27 %args,
28 vector => $vector,
29 );
30 }
31  
32  
33 1 1;
34  
35 __END__
« VecDB/Collection.pm ↑ Summary VecDB.pm »