NAME
Langertha::Role::Capabilities - Engine-capability registry derived from composed roles
VERSION
version 0.500
SYNOPSIS
if ( $engine->supports('tool_choice_named') ) { ... }
my $caps = $engine->engine_capabilities;
for my $cap ( sort keys %$caps ) {
say "$cap" if $caps->{$cap};
}
# Engine-level override for a wire reality the role inventory
# cannot express (e.g. provider only accepts string tool_choice):
around engine_capabilities => sub {
my ( $orig, $self, @rest ) = @_;
my $caps = $self->$orig(@rest);
delete $caps->{tool_choice_named};
return $caps;
};
DESCRIPTION
Composed by Langertha::Role::Chat (and therefore present on every engine), this role provides the engine_capabilities method plus the supports helper. The default implementation derives the flag set from which capability-bearing roles the engine composes — no per-role plumbing required, the registry below is the single source of truth.
Engines override (via around) when the wire reality differs from the role inventory — for example to clear tool_choice_named on a provider that only accepts string forms of tool_choice.
The mapping from role to flag is intentionally kept inside this one module so adding a new capability is a single-file change. The role itself does not need to know about engine_capabilities.
engine_capabilities
my $caps = $engine->engine_capabilities;
Returns a HashRef of capability flags. The default scans the composed role inventory and sets flags from a static role-to-flags map. Override via around on an engine to remove flags for capabilities the wire reality cannot deliver, or to add ad-hoc flags an engine wants to advertise.
supports
if ( $engine->supports('tool_choice_named') ) { ... }
Convenience wrapper that returns a true value when the named capability is present and truthy in engine_capabilities.
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.