| 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")
MC/DC0%0/1
delete $args{"text"} // croak("text is required")
delete $args{"text"}
Truth table0%0/2
A
A= delete $args{"text"}
| |||||||||||||||||||||
| 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
MC/DC0%0/2
$args{"content"} // $text
$args{"content"}
$text
Truth table0%0/3
A // B
A= $args{"content"}B= $text
| |||||||||||||||||||||
| 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")
MC/DC0%0/1
delete $args{"text"} // croak("text is required")
delete $args{"text"}
Truth table0%0/2
A
A= delete $args{"text"}
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||