Langertha/Role/ResponseSize.pm

filter: Statementstmt 100% 10 / 10 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 100% 17 / 17 CC 3 SCAR 9.2
CC
3
Cov
100%
get_response_size
3.0
BEGIN
1.0
CRAP 2.5
« Langertha/Role/KeepAlive.pm ↑ Summary Langertha/Role/ImageGeneration.pm »
1 package Langertha::Role::ResponseSize;
2 # ABSTRACT: Role for an engine where you can specify the response size (in tokens)
3 33 our $VERSION = '0.502';
4 33 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 33 has response_size => (
7 isa => 'Int',
8 is => 'ro',
9 predicate => 'has_response_size',
10 );
11  
12  
13 sub get_response_size {
14 70 ▶ my ( $self ) = @_;
Subroutine get_response_size: called CC=3 SCAR=11.0
Pod documented
15 70 ▶ return $self->response_size if $self->has_response_size;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_response_size 10 60 70
16 60 ▶ return $self->default_response_size if $self->can('default_response_size');
Branch: 1 branch
BranchTrueFalseTotal
if $self->can("default_response_size") 13 47 60
17 47 return;
18 }
19  
20  
21  
22 33 1;
23  
24 __END__
25  
26 =pod
27  
28 =encoding UTF-8
29  
30 =head1 NAME
31  
32 Langertha::Role::ResponseSize - Role for an engine where you can specify the response size (in tokens)
33  
34 =head1 VERSION
35  
36 version 0.502
37  
38 =head2 response_size
39  
40 Maximum number of tokens to generate in the response. Optional. When not set,
41 the engine uses its own C<default_response_size> if available, or omits the
42 parameter from the request.
43  
44 =head2 get_response_size
45  
46 my $size = $engine->get_response_size;
47  
48 Returns the effective response size: the explicit C<response_size> if set,
49 otherwise the engine's C<default_response_size>, otherwise C<undef>.
50  
51 =head1 SEE ALSO
52  
53 =over
54  
55 =item * L<Langertha::Role::ContextSize> - Limit total context tokens
56  
57 =item * L<Langertha::Role::Temperature> - Sampling temperature
58  
59 =back
60  
61 =head1 SUPPORT
62  
63 =head2 Issues
64  
65 Please report bugs and feature requests on GitHub at
66 L<https://github.com/Getty/langertha/issues>.
67  
68 =head2 IRC
69  
70 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
71  
72 =head1 CONTRIBUTING
73  
74 Contributions are welcome! Please fork the repository and submit a pull request.
75  
76 =head1 AUTHOR
77  
78 Torsten Raudssus <getty@cpan.org>
79  
80 =head1 COPYRIGHT AND LICENSE
81  
82 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
83  
84 This is free software; you can redistribute it and/or modify it under
85 the same terms as the Perl 5 programming language system itself.
86  
87 =cut
« Langertha/Role/KeepAlive.pm ↑ Summary Langertha/Role/ImageGeneration.pm »