NAME

Langertha::Role::ResponseSize - Role for an engine where you can specify the response size (in tokens)

VERSION

version 0.503

response_size

Maximum number of tokens to generate in the response. Optional. When not set, the engine uses its own default_response_size if available, or omits the parameter from the request.

get_response_size

my $size = $engine->get_response_size;

Returns the effective response size: the explicit response_size if set, otherwise the per-model default from "model_response_size_defaults" for the current chat_model, otherwise the engine's default_response_size, otherwise undef.

model_response_size_defaults

sub model_response_size_defaults {
  return ( qr/\Akimi-k3(?!\d)/ => 16000 );
}

Per-model default response size, used only when the caller set no response_size. Returns an ordered list of ( $matcher => $tokens ) pairs; $matcher is an exact model id (eq) or a qr// matched against chat_model, and later matching entries win. A matching entry replaces the engine's default_response_size for that model; it never overrides an explicit response_size or a per-request max_tokens. The default returns an empty list.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.