NAME
Langertha::Knarr::Request - Normalized chat request shared across all Knarr protocols
VERSION
version 1.100
DESCRIPTION
The normalized request shape that every Langertha::Knarr::Protocol parser produces and every Langertha::Knarr::Handler receives. Wire-protocol-specific quirks (OpenAI's choices, Anthropic's system outside messages, A2A's JSON-RPC envelope, etc.) are handled by the protocol's parse_chat_request and don't leak into the handler API.
The original wire-format body is preserved in "raw" for handlers (like Langertha::Knarr::Handler::Passthrough) that need to forward it verbatim.
protocol
Required. Short string identifying the parser that produced this request: openai, anthropic, ollama, a2a, acp, agui.
model
Optional model id from the request body.
messages
ArrayRef of message hashes ({ role => ..., content => ... }).
stream
Boolean. Whether the client requested streaming.
temperature, max_tokens, tools, tool_choice, response_format, system
Optional generation parameters and tool definitions, if the protocol extracted them. tool_choice and response_format are passed to Langertha::Engine via chat_f in their canonical form; Langertha normalizes them to the target engine's wire format.
session_id
Optional session id, used for per-session state. Pulled from protocol-specific fields (e.g. OpenAI's user, A2A's sessionId, or the x-session-id header).
raw
The original decoded request body. Useful for passthrough handlers that need to forward without re-encoding.
extra
Per-protocol scratch space (e.g. JSON-RPC id for A2A, run_id for ACP).
chat_f_args
my @args = $request->chat_f_args($engine);
my $r = await $engine->chat_f(@args);
Builds a named-argument list suitable for "chat_f" in Langertha::Role::Chat. Always includes messages; conditionally adds tools, tool_choice, response_format, temperature, max_tokens when set on the request and the engine reports support for the matching capability via $engine->supports($cap). Engines without supports() get every defined parameter — older Langertha versions accepted unknown args silently.
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.