NAME

Langertha::Role::ReasoningEffort - Role for an engine with a request-side reasoning-effort control

VERSION

version 0.503

reasoning_effort

Normalized request-side reasoning effort. Vocabulary (the OpenAI superset): none, minimal, low, medium, high, xhigh, max. When set, it is translated to the provider-specific wire field via Langertha::Reasoning keyed by "reasoning_wire_format"; values the target wire cannot accept are dropped. When not set, no reasoning field is emitted and the model's own default applies.

Note this is a request-side control, distinct from Langertha::Role::ThinkTag (which filters <think> tags out of responses).

thinking_budget

Optional integer thinking budget, currently consumed only by Gemini 2.5 models (Langertha::Engine::Gemini): on gemini-2.5-* the value is emitted as generationConfig.thinkingConfig.thinkingBudget. On Gemini 3 models thinking_budget is rejected — Gemini 3 takes thinkingLevel, not the integer budget; setting both "reasoning_effort" and thinking_budget on a Gemini 3 model croaks at construction ("BUILD" in Langertha::Reasoning). When unset, no budget field is emitted. (Anthropic legacy budget_tokens is deliberately not modeled: it 400s on current Claude families.)

thinking_display

Optional Anthropic thinking-visibility control (summarized | omitted | updates), serialized by "to_anthropic" in Langertha::Reasoning to thinking.display. On every current Claude model the wire default is omitted, which returns an empty $response->thinking; set thinking_display => 'summarized' to get a readable reasoning summary back (it costs summary tokens, so it is opt-in rather than the Langertha default). Ignored on non-Anthropic wires and on Fable-class models (which never carry a thinking block). Like "reasoning_effort", a per-request control (chat_f) beats this attribute.

reasoning_wire_format

reasoning_wire_format => 'anthropic'

The per-engine enum naming which reasoning dialect this engine speaks — openai | anthropic | gemini | responses. Drives the value-object dispatch in "reasoning_kwargs". The default follows the engine base-class hierarchy: OpenAIBase leaves it at openai, AnthropicBase overrides to anthropic, Gemini to gemini, OpenAIResponses to responses.

reasoning_kwargs_for

my %kwargs = $engine->reasoning_kwargs_for( effort => 'high' );
my %kwargs = $engine->reasoning_kwargs_for( %$controls );

Returns the body kwargs to merge into a chat request for the reasoning control, serialized for "reasoning_wire_format" via Langertha::Reasoning. %args may carry effort and/or thinking_budget (or the canonical control names reasoning_effort / thinking_budget, so the whole controls hash from chat_f can be passed wholesale); keys it does not carry fall back to the engine attributes, so a per-request control (chat_f, karr #46) beats the configured attribute on a per-key basis. Empty list when neither a per-request value nor an attribute is set, when the value is unsupported on the engine's wire, or when the engine advertises neither reasoning_effort nor thinking_budget ("supports" in Langertha::Role::Capabilities) -- clearing those flags is how an engine says it takes no reasoning control, and nothing is sent then. Engines override this only to model wire divergence within a shared format (e.g. DeepSeek's model-gated split). An engine whose endpoint speaks the thinking on/off toggle (MiniMax, MiniMaxAnthropic, Moonshot, MoonshotAnthropic) opts in by defining _reasoning_thinking_toggle as true; see "thinking_toggle" in Langertha::Reasoning.

reasoning_kwargs

my %kwargs = $engine->reasoning_kwargs;

Returns the body kwargs to merge into a chat request for the configured reasoning_effort and/or "thinking_budget", serialized for "reasoning_wire_format" via Langertha::Reasoning. Empty list when neither is set, or when the value is unsupported on the engine's wire. Delegates to "reasoning_kwargs_for" with no per-request overrides.

SEE ALSO

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.