| 1 | package Langertha::Content; | ||||||||||||||||||||
| 2 | # ABSTRACT: Base role for canonical multimodal content blocks with cross-provider serialization | ||||||||||||||||||||
| 3 | 17 | our $VERSION = '0.505'; | |||||||||||||||||||
| 4 | 17 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 17 | ▶ | use Carp qw( croak ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 17 | requires qw( to_openai to_anthropic to_gemini ); | |||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | # Serializers added after the role was public (karr k267) get croaking | ||||||||||||||||||||
| 11 | # defaults instead of joining `requires`, so an outside content class still | ||||||||||||||||||||
| 12 | # composes; it only fails when it is actually sent on such a wire. | ||||||||||||||||||||
| 13 | 3 | ▶ | sub _no_serializer { | ||||||||||||||||||
|
Subroutine
_no_serializer: called CC=2 SCAR=8.1
| |||||||||||||||||||||
| 14 | 3 | my ( $self, $fmt ) = @_; | |||||||||||||||||||
| 15 | 3 | ▶ | croak( ( ref $self || $self )." cannot be sent on the $fmt wire; implement to_$fmt" ); | ||||||||||||||||||
|
Condition33%1/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table33%1/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||
| 16 | } | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 1 | ▶ | sub to_responses { $_[0]->_no_serializer('responses') } | ||||||||||||||||||
|
Subroutine
to_responses: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 19 | 1 | ▶ | sub to_ollama { $_[0]->_no_serializer('ollama') } | ||||||||||||||||||
|
Subroutine
to_ollama: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 20 | 1 | ▶ | sub to_lmstudio { $_[0]->_no_serializer('lmstudio') } | ||||||||||||||||||
|
Subroutine
to_lmstudio: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 17 | 1; | |||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | __END__ | ||||||||||||||||||||