Langertha
view release on metacpan or search on metacpan
lib/Langertha/Response.pm view on Meta::CPAN
produced.
=head2 tool_call_args
my $args = $response->tool_call_args; # first tool call
my $args = $response->tool_call_args($name); # named lookup
Returns the C<arguments> HashRef of the first tool call, or of the
first tool call matching C<$name>. Returns C<undef> when no tool
calls were produced.
=head2 rate_limit
Optional L<Langertha::RateLimit> object with rate limit information from the
API response headers. Only present when the provider returns rate limit headers.
=head2 thinking
Chain-of-thought reasoning content. Populated automatically from native API
fields (DeepSeek C<reasoning_content>, Anthropic C<thinking> blocks, Gemini
C<thought> parts) or from C<E<lt>thinkE<gt>> tag filtering when
L<Langertha::Role::ThinkTag/think_tag_filter> is enabled.
=head2 clone_with
my $new = $response->clone_with(content => $filtered, thinking => $thought);
Returns a new Response with the same attributes as the original, except for
the overrides provided. Used by L<Langertha::Role::ThinkTag> to produce a
filtered response while preserving metadata.
=head2 prompt_tokens
Returns the number of prompt/input tokens. Checks C<prompt_tokens> and
C<input_tokens> keys in usage.
=head2 completion_tokens
Returns the number of completion/output tokens. Checks C<completion_tokens>
and C<output_tokens> keys in usage.
=head2 total_tokens
Returns the total token count. Uses C<total_tokens> from usage if available,
otherwise sums prompt and completion tokens.
=head2 requests_remaining
Returns the number of requests remaining from rate limit headers, or C<undef>.
=head2 tokens_remaining
Returns the number of tokens remaining from rate limit headers, or C<undef>.
=head1 SEE ALSO
=over
=item * L<Langertha::RateLimit> - Rate limit data from response headers
=item * L<Langertha::Stream::Chunk> - Single chunk from a streaming response
=item * L<Langertha::Role::Chat> - Chat role that produces response objects
=item * L<Langertha::Role::OpenAICompatible> - Parses responses into this class
=back
=head1 SUPPORT
=head2 Issues
Please report bugs and feature requests on GitHub at
L<https://github.com/Getty/langertha/issues>.
=head2 IRC
Join C<#langertha> on C<irc.perl.org> or message Getty directly.
=head1 CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
=head1 AUTHOR
Torsten Raudssus <getty@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus L<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.
=cut
( run in 0.833 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )