NAME
Langertha::Content - Base role for canonical multimodal content blocks with cross-provider serialization
VERSION
version 0.503
SYNOPSIS
package Langertha::Content::Image;
use Moose;
with 'Langertha::Content';
sub to_openai { ... }
sub to_anthropic { ... }
sub to_gemini { ... }
sub to_responses { ... }
sub to_ollama { ... }
sub to_lmstudio { ... }
DESCRIPTION
Marker role for canonical content blocks that can be embedded inside the content arrayref of a chat message and serialized to any provider wire format by Langertha::Role::Chat.
Implementations must provide to_openai, to_anthropic and to_gemini, and may provide to_responses, to_ollama and to_lmstudio (one per "content_format" in Langertha::Role::Chat). Each returns what its wire expects for the block: a HashRef for the message content / parts / input array, or (to_ollama) the raw base64 string for the message images array. The role's defaults for the last three croak with "<class> cannot be sent on the <fmt> wire; implement to_<fmt>".
to_responses
to_ollama
to_lmstudio
Default serializers for the responses, ollama and lmstudio "content_format" in Langertha::Role::Chats. They croak; a content class that can be sent on those wires overrides them (Langertha::Content::Image does).
SEE ALSO
Langertha::Content::Image - Image (URL / base64 / local file) content block
Langertha::ToolChoice - Sibling value object for tool_choice normalization
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.