blib/lib/Langertha/Knarr/Handler.pm

filter: Statementstmt 70.8% 17 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 73.3% 22 / 30 CC 1 SCAR 1.8
CC
1
Cov
71%
handle_stream_f
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Langertha/Knarr/Handler/Code.pm ↑ Summary blib/lib/Langertha/Knarr/Session.pm »
1 package Langertha::Knarr::Handler;
2 # ABSTRACT: Role for Knarr backend handlers (Raider, Engine, Code, ...)
3 46 our $VERSION = '1.103';
4 46 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 46 ▶use Future::AsyncAwait;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 46 ▶use Langertha::Knarr::Stream;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 46 ▶use Langertha::Knarr::Response;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 46 requires 'handle_chat_f';
11 46 requires 'list_models';
12  
13 # Default streaming = run handle_chat_f and emit one chunk.
14 # Handlers that natively stream should override.
15 0 ▶async sub handle_stream_f {
Subroutine handle_stream_f: not called CC=1 SCAR=6.9
Pod documented
16 0 my ($self, $session, $request) = @_;
17 0 my $r = Langertha::Knarr::Response->coerce( await $self->handle_chat_f($session, $request) );
18 0 my $stream = Langertha::Knarr::Stream->from_list( $r->content );
19 0 $stream->finish_reason( $r->finish_reason );
20 0 $stream->tool_calls( $r->tool_calls );
21 0 return $stream;
22 46 }
23  
24 46 1;
25  
26 __END__
« blib/lib/Langertha/Knarr/Handler/Code.pm ↑ Summary blib/lib/Langertha/Knarr/Session.pm »