NAME
Langertha::Knarr::Handler::Router - Knarr handler that resolves model names via Langertha::Knarr::Router and dispatches to engines
VERSION
version 1.001
SYNOPSIS
use Langertha::Knarr::Config;
use Langertha::Knarr::Router;
use Langertha::Knarr::Handler::Router;
use Langertha::Knarr::Handler::Passthrough;
my $config = Langertha::Knarr::Config->new(file => 'knarr.yaml');
my $router = Langertha::Knarr::Router->new(config => $config);
my $handler = Langertha::Knarr::Handler::Router->new(
router => $router,
passthrough => Langertha::Knarr::Handler::Passthrough->new(
upstreams => $config->passthrough,
),
);
DESCRIPTION
Resolves incoming model names against a Langertha::Knarr::Router (which knows your knarr.yaml) and dispatches to the matched Langertha::Engine. When a passthrough fallback handler is supplied, unknown model names tunnel through to it instead of failing — this preserves the classic Knarr behaviour where configured models go via Langertha and everything else passes straight to the upstream API.
Streaming responses are pumped via the engine's simple_chat_stream_realtime_f for native token-by-token delivery.
router
Required. A Langertha::Knarr::Router instance.
passthrough
Optional. Any Langertha::Knarr::Handler consumer used as a fallback when the router can't resolve a model.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-knarr/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 <torsten@raudssus.de> https://raudssus.de/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.