NAME

Langertha::Knarr::Handler::Engine - Knarr handler that proxies directly to a Langertha engine

VERSION

version 1.001

SYNOPSIS

use Langertha::Engine::Groq;
use Langertha::Knarr::Handler::Engine;

my $engine = Langertha::Engine::Groq->new(
    api_key    => $ENV{GROQ_API_KEY},
    chat_model => 'llama-3.3-70b-versatile',
);

my $handler = Langertha::Knarr::Handler::Engine->new(
    engine   => $engine,
    model_id => 'groq-llama-3.3-70b',
);

DESCRIPTION

Wraps a single Langertha::Engine::* instance and exposes it as a Knarr handler. Streaming requests use the engine's simple_chat_stream_realtime_f for native token-by-token streaming through Knarr's chunked response pump; engines that don't support streaming fall back to a single-chunk emission.

For routing across multiple engines based on model name, use Langertha::Knarr::Handler::Router with a Langertha::Knarr::Router config instead.

engine

Required. Any object consuming Langertha::Role::Chat. Streaming support requires the engine to also implement simple_chat_stream_realtime_f (most Langertha engines do).

model_id

Optional. The id reported by "list_models" and surfaced in responses. Defaults to the engine's chat_model, falling back to a derived name from the engine class.

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.