blib/lib/Langertha/Reasoning/Profile.pm

filter: Statementstmt 99.1% 117 / 118 Branchbran 80.5% 29 / 36 Conditioncond 62.5% 10 / 16 MC/DCmcdc 33.3% 3 / 9 Subroutinesub 100% 20 / 20 Podpod 100% 7 / 7 totaltotal 90.2% 186 / 206 CC 27 SCAR 16.3
CC
27
Cov
92%
_match
14.9
gemini_level_for
6.0
_clamp_gemini_level
5.0
CRAP 5.1
« blib/lib/Langertha/Engine/OpenAI.pm ↑ Summary blib/lib/Langertha/Role/Transcription.pm »
1 package Langertha::Reasoning::Profile;
2 # ABSTRACT: Typed per-model reasoning wire-truth (accepted vocabulary + numeric bounds)
3 181 our $VERSION = '0.503';
4 181 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 181 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 181 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 # The normalized ascending reasoning vocabulary, defined ONCE and reused. A
10 # namespaced type name so it cannot collide with any other 'ReasoningLevel'
11 # registered in the process (Moose croaks on enum-name redefinition).
12 181 enum 'Langertha::Reasoning::Level'
13 => [qw( none minimal low medium high xhigh max )];
14 181 enum 'Langertha::Reasoning::Control'
15 => [qw( effort budget boolean none )];
16 181 enum 'Langertha::Reasoning::DisableForm'
17 => [qw( absent explicit_none think_false budget_zero thinking_disabled )];
18 181 enum 'Langertha::Reasoning::ThinkingOn'
19 => [qw( adaptive enabled )];
20 181 enum 'Langertha::Reasoning::Wire'
21 => [qw( openai responses anthropic gemini ollama )];
22  
23 # The full Anthropic Messages-API output_config.effort vocabulary (the
24 # normalized none/minimal have no Anthropic equivalent and drop). The default
25 # the generic-claude, Fable/Mythos and provider-default profiles reuse — but NOT
26 # uniform across every Claude model: Claude 4.6 (opus/sonnet) drops xhigh, so
27 # anthropic_effort_ok checks the resolved profile's own `levels` rather than this
28 # module-level set (karr k177).
29 181 my @ANTHROPIC_EFFORT_LEVELS = qw( low medium high xhigh max );
30  
31 # Normalized effort -> Gemini 3 thinkingLevel base vocabulary
32 # (minimal|low|medium|high); then clamped down to the family's accepted subset.
33 181 my %GEMINI_BASE = (
34 none => 'minimal',
35 minimal => 'minimal',
36 low => 'low',
37 medium => 'medium',
38 high => 'high',
39 xhigh => 'high',
40 max => 'high',
41 );
42 181 my %GEMINI_ORDER = ( minimal => 0, low => 1, medium => 2, high => 3 );
43  
44 # Normalized effort -> GPT-OSS Ollama options.think level (low|medium|high|max).
45 # GPT-OSS always reasons — there is no "off" — so 'none' (and 'minimal') map to
46 # the floor 'low' (live-probed 2026-09-17 via ollama.com gpt-oss:20b, k175).
47 181 my %OLLAMA_LEVEL = (
48 none => 'low',
49 minimal => 'low',
50 low => 'low',
51 medium => 'medium',
52 high => 'high',
53 xhigh => 'max',
54 max => 'max',
55 );
56  
57 181 has model_match => (
58 is => 'ro',
59 isa => 'Str | RegexpRef',
60 );
61  
62  
63 181 has control => (
64 is => 'ro',
65 isa => 'Langertha::Reasoning::Control',
66 required => 1,
67 );
68  
69  
70 has levels => (
71 is => 'ro',
72 isa => 'ArrayRef[Langertha::Reasoning::Level]',
73 108 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
74 181 );
75  
76  
77 has levels_by_wire => (
78 is => 'ro',
79 isa => 'HashRef[ArrayRef[Langertha::Reasoning::Level]]',
80 566 ▶ default => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
81 181 );
82  
83  
84 181 has ollama_levels => (
85 is => 'ro',
86 isa => 'ArrayRef[Langertha::Reasoning::Level]',
87 predicate => 'has_ollama_levels',
88 );
89  
90  
91 181 has can_disable => (
92 is => 'ro',
93 isa => 'Bool',
94 default => 1,
95 );
96  
97  
98 181 has default_reasoning_off => (
99 is => 'ro',
100 isa => 'Bool',
101 default => 0,
102 );
103  
104  
105 181 has is_reasoning_model => (
106 is => 'ro',
107 isa => 'Bool',
108 default => 0,
109 );
110  
111  
112 181 has disable_form => (
113 is => 'ro',
114 isa => 'Langertha::Reasoning::DisableForm',
115 default => 'absent',
116 );
117  
118  
119 181 has thinking_on => (
120 is => 'ro',
121 isa => 'Langertha::Reasoning::ThinkingOn',
122 predicate => 'has_thinking_on',
123 );
124  
125  
126 181 has wire_format => (
127 is => 'ro',
128 isa => 'Langertha::Reasoning::Wire',
129 required => 1,
130 );
131  
132  
133 181 has is_gemini3 => (
134 is => 'ro',
135 isa => 'Bool',
136 default => 0,
137 );
138  
139  
140 181 for my $bound (qw( budget_min budget_max off_value dynamic_value )) {
141 724 has $bound => (
142 is => 'ro',
143 isa => 'Int',
144 predicate => 'has_' . $bound,
145 );
146 }
147  
148  
149  
150  
151 181 has source => (
152 is => 'ro',
153 isa => 'Str',
154 default => '',
155 );
156  
157  
158  
159 1755 ▶sub fable_class { return $_[0]->can_disable ? 0 : 1 }
Subroutine fable_class: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->can_disable ? : 1683 72 1755
160  
161  
162 202 ▶sub thinking_toggle_for {
Subroutine thinking_toggle_for: called CC=4 SCAR=13.9
Pod documented
163 202 my ( $self, $effort ) = @_;
164 202 ▶ return unless $self->has_thinking_on;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_thinking_on 0 202 202
165 202 ▶ if ( $effort eq 'none' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($effort eq "none") 28 174 202
166 28 ▶ return unless $self->disable_form eq 'thinking_disabled';
Branch: 1 branch
BranchTrueFalseTotal
unless $self->disable_form eq "thinking_disabled" 10 18 28
167 18 return { type => 'disabled' };
168 }
169 174 return { type => $self->thinking_on };
170 }
171  
172  
173 3948 ▶sub effort_accepted_on {
Subroutine effort_accepted_on: called CC=3 SCAR=11.0
Pod documented
174 3948 my ( $self, $wire, $effort ) = @_;
175 3948 my $set = $self->levels_by_wire->{$wire};
176 3948 ▶ return 1 unless defined $set;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $set 2663 1285 3948
177 1285 ▶ return ( grep { $_ eq $effort } @$set ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
grep({$_ eq $effort;} @$set) ? : 859 426 1285
178 }
179  
180  
181 1732 ▶sub anthropic_effort_ok {
Subroutine anthropic_effort_ok: called CC=2 SCAR=6.9
Pod documented
182 1732 my ( $self, $effort ) = @_;
183 1732 ▶ return ( grep { $_ eq $effort } @{ $self->levels } ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
grep({$_ eq $effort;} @{$self->levels;}) ? : 1214 518 1732
184 }
185  
186  
187 1631 ▶sub gemini_level_for {
Subroutine gemini_level_for: called CC=6 SCAR=17.9
Pod documented
188 1631 my ( $self, $effort ) = @_;
189 1631 ▶ unless ( $self->is_gemini3 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->is_gemini3) 1500 131 1631
190 1500 ▶ return ( $effort eq 'high' || $effort eq 'xhigh' || $effort eq 'max' )
Branch: 1 branch
BranchTrueFalseTotal
$effort eq 'high' || $effort eq 'xhigh' || $effort eq 'max' ? : 645 855 1500
Condition100%6/6
$effort eq "high" or $effort eq "xhigh" or $effort eq "max"
l!l&&r!l&&!r
430215855
$effort eq "high" or $effort eq "xhigh"
l!l&&r!l&&!r
2172131070
MC/DC100%3/3
$effort eq "high" or $effort eq "xhigh" or $effort eq "max"
$effort eq "high" $effort eq "xhigh" $effort eq "max"
Truth table100%4/4
A or B or C
A= $effort eq "high"B= $effort eq "xhigh"C= $effort eq "max"
ABCresult
1XX1
01X1
0011
0000
191 ? 'high' : 'low';
192 }
193 131 ▶ my $level = $GEMINI_BASE{$effort} // 'low';
Condition50%1/2
$GEMINI_BASE{$effort} // "low"
l!l
1310
MC/DC0%0/1
$GEMINI_BASE{$effort} // "low"
$GEMINI_BASE{$effort}
Truth table50%1/2
A
A= $GEMINI_BASE{$effort}
Aresult
11
00
194 131 return $self->_clamp_gemini_level($level);
195 }
196  
197 # Clamp a base Gemini level down to the profile's accepted set: keep it if
198 # accepted, else drop to the highest accepted level below it, or rise to the
199 # lowest accepted level when it sits below the family's floor. The accepted sets
200 # are contiguous ranges, so this reproduces the family clamps exactly.
201 131 ▶sub _clamp_gemini_level {
Subroutine _clamp_gemini_level: called CC=5 SCAR=16.1
202 131 my ( $self, $level ) = @_;
203 131 my %ok = map { $_ => 1 } @{ $self->levels };
204 131 ▶ return $level if $ok{$level};
Branch: 1 branch
BranchTrueFalseTotal
if $ok{$level} 100 31 131
205 59 my @sorted = sort { $GEMINI_ORDER{$a} <=> $GEMINI_ORDER{$b} }
206 31 grep { defined $GEMINI_ORDER{$_} } @{ $self->levels };
207 31 my $target = $GEMINI_ORDER{$level};
208 31 my $result;
209 31 for my $lvl (@sorted) {
210 76 ▶ $result = $lvl if $GEMINI_ORDER{$lvl} < $target;
Branch: 1 branch
BranchTrueFalseTotal
if $GEMINI_ORDER{$lvl} < $target 6 70 76
211 }
212 31 ▶ return defined $result ? $result : $sorted[0];
Branch: 1 branch
BranchTrueFalseTotal
defined $result ? : 6 25 31
213 }
214  
215  
216 31 ▶sub ollama_level_for {
Subroutine ollama_level_for: called CC=2 SCAR=7.2
Pod documented
217 31 my ( $self, $effort ) = @_;
218 31 ▶ return $OLLAMA_LEVEL{$effort} // 'low';
Condition50%1/2
$OLLAMA_LEVEL{$effort} // "low"
l!l
310
MC/DC0%0/1
$OLLAMA_LEVEL{$effort} // "low"
$OLLAMA_LEVEL{$effort}
Truth table50%1/2
A
A= $OLLAMA_LEVEL{$effort}
Aresult
11
00
219 }
220  
221 # ---------------------------------------------------------------------------
222 # The registry — one ordered, most-specific-first table. Built lazily so the
223 # class is fully defined (and immutable) before any profile is constructed.
224 # ---------------------------------------------------------------------------
225 181 my @REGISTRY;
226 my $DEFAULT;
227  
228 # developers.openai.com/api/docs/guides/reasoning + per-model pages,
229 # advisor-verified 2026-09-01 (karr k140); gpt-6-astra 2026-09-14 (karr k151).
230 181 my $OPENAI_SRC = 'developers.openai.com/api/docs/guides/reasoning; k140 2026-09-01, gpt-6 k151 2026-09-14';
231 # ai.google.dev/gemini-api/docs/thinking level table, verified 2026-09-01
232 # (karr k140); gemini-3.8-flash 2026-09-14 (karr k153).
233 181 my $GEMINI3_SRC = 'ai.google.dev/gemini-api/docs/thinking; k140 2026-09-01, 3.8-flash k153 2026-09-14';
234 # ai.google.dev/gemini-api/docs/thinking budget table (2.5), advisor-verified
235 # 2026-09-16 (karr k173).
236 181 my $GEMINI25_SRC = 'ai.google.dev/gemini-api/docs/thinking budget table; k173 2026-09-16';
237 # Self-hosted Qwen3.x reasoning family: the loaded model's chat template — NOT
238 # the vLLM/SGLang/llama.cpp server — fixes the accepted reasoning_effort
239 # vocabulary. Live-probed 2026-09-17 on a cortex vLLM server (karr k79/k180):
240 # Qwen/Qwen3.8-27B-FP8 400s on reasoning_effort=high ("Unexpected reasoning
241 # effort high. Supported types are xhigh (default), medium, and low."), accepting
242 # only none/low/medium/xhigh.
243 181 my $QWEN_SELFHOSTED_SRC = 'live-probed 2026-09-17 cortex vLLM Qwen/Qwen3.8-27B-FP8: reasoning_effort high->400, accepts none/low/medium/xhigh (k79/k180)';
244  
245 # karr k176: 'max' is Responses-only for the gpt-6 and gpt-5.6 generations. The
246 # gpt-5.6 split is live-confirmed (2026-09-16 on gpt-5.6-terra): Chat Completions
247 # reasoning_effort=max -> HTTP 400 ("Supported values are: 'none', 'low',
248 # 'medium', 'high', and 'xhigh'."), Responses reasoning.effort=max -> HTTP 200.
249 # The gpt-6 split is doc-sourced (advisor Azure mirror, same Responses-only-max
250 # pattern) — not live-probed.
251 181 my $OPENAI_K176_LIVE = "$OPENAI_SRC; k176 2026-09-16 live gpt-5.6-terra: chat reasoning_effort=max->400, responses reasoning.effort=max->200";
252 181 my $OPENAI_K176_DOC = "$OPENAI_SRC; k176 gpt-6 max Responses-only (advisor Azure mirror, doc-sourced, not live-probed)";
253 # karr k174: gpt-5.1 is gated (Azure Foundry reasoning table, advisor-verified
254 # 2026-09-16 — doc-sourced, NOT live-probed). Base gpt-5.1 drops minimal/xhigh/max
255 # (none|low|medium|high); gpt-5.1-codex-max re-adds xhigh (still no max). Both
256 # wires identical (xhigh is not Responses-only), so no openai_levels split.
257 181 my $OPENAI_K174_DOC = "$OPENAI_SRC; k174 gpt-5.1 gate (Azure Foundry reasoning table, advisor-verified 2026-09-16, doc-sourced not live)";
258 # karr k177: Claude 4.6 (opus/sonnet) accepts low|medium|high|max but NOT xhigh
259 # — Anthropic's effort doc lists 4.6 under `max` yet not under `xhigh`; 4.7+/5
260 # take the full set. Advisor-verified 2026-09-16 (doc-sourced, NOT live-probed).
261 181 my $ANTHROPIC_K177_DOC = 'platform.claude.com output_config.effort doc; k177 2026-09-16 claude-4.6 no xhigh (advisor-verified, doc-sourced not live)';
262 # karr k208: xAI reasoning page (updated 2026-09-21), advisor-verified
263 # 2026-09-25 — doc-sourced, NOT live-probed (the reply to an off-enum value,
264 # 400 or ignored, is unverified).
265 181 my $XAI_K208_DOC = 'docs.x.ai/developers/model-capabilities/text/reasoning; k208 2026-09-25 (advisor-verified, doc-sourced not live)';
266  
267 # karr k209: MiniMax chat/completions + /anthropic request schemas, advisor
268 # 2026-09-25 — doc-sourced, NOT live-probed.
269 181 my $MINIMAX_K209_DOC = 'platform.minimax.io openapi-chat-openai.json + openapi-chat-anthropic.json; k209 2026-09-25 (advisor-verified, doc-sourced not live)';
270 # karr k215: Kimi Messages API + Claude Code guide, advisor 2026-09-25 —
271 # doc-sourced, NOT live-probed (budget_tokens on `enabled` unverified).
272 181 my $KIMI_K215_DOC = 'platform.kimi.ai docs/api/messages.md + docs/guide/claude-code-kimi.md; k215 2026-09-25 (advisor-verified, doc-sourced not live; budget_tokens unverified)';
273 # $levels is the superset a family accepts on the `responses` (Responses API)
274 # wire; $extra{openai_levels} is the narrower Chat Completions set, defaulting to
275 # $levels when the two wires agree. The k176 per-wire max split is exactly this
276 # openai_levels-vs-levels divergence for the gpt-6 / gpt-5.6 generations.
277 243 ▶sub _openai_profile {
Subroutine _openai_profile: called CC=2 SCAR=7.0
278 243 my ( $match, $levels, %extra ) = @_;
279 243 ▶ my $openai_levels = delete $extra{openai_levels} // $levels;
Condition66%2/3
delete $extra{"openai_levels"} // $levels
l!l&&r!l&&!r
541890
MC/DC0%0/2
delete $extra{"openai_levels"} // $levels
delete $extra{"openai_levels"} $levels
Truth table66%2/3
A // B
A= delete $extra{"openai_levels"}B= $levels
ABresult
1X1
011
000
280 243 return __PACKAGE__->new(
281 model_match => $match,
282 control => 'effort',
283 wire_format => 'openai',
284 levels => $levels,
285 levels_by_wire => { openai => $openai_levels, responses => $levels },
286 source => $OPENAI_SRC,
287 %extra,
288 );
289 }
290  
291 # An OpenAI line whose effort ladder is uncurated: the unlisted-id passthrough
292 # serialization (full normalized enum, no per-wire restriction) with an explicit
293 # reasoning classification (karr k186).
294 81 ▶sub _openai_passthrough {
Subroutine _openai_passthrough: called CC=1 SCAR=0.0
295 81 my ( $match, $is_reasoning, $source ) = @_;
296 81 return __PACKAGE__->new(
297 model_match => $match,
298 control => 'effort',
299 wire_format => 'openai',
300 levels => [@ANTHROPIC_EFFORT_LEVELS],
301 is_reasoning_model => $is_reasoning,
302 source => $source,
303 );
304 }
305  
306 # A non-reasoning chat carve-out that serializes exactly like the reasoning
307 # family it sits in ($like is that family's resolved profile): only the
308 # classification differs, so the carve-out changes nothing on the reasoning wire
309 # (karr k186).
310 286 ▶sub _non_reasoning_like {
Subroutine _non_reasoning_like: called CC=1 SCAR=0.0
311 286 my ( $match, $like ) = @_;
312 286 return $like->meta->clone_object( $like,
313 model_match => $match,
314 is_reasoning_model => 0,
315 source => $like->source . "; k186 non-reasoning chat carve-out",
316 );
317 }
318  
319 108 ▶sub _gemini3_profile {
Subroutine _gemini3_profile: called CC=1 SCAR=0.0
320 108 my ( $match, $levels ) = @_;
321 108 return __PACKAGE__->new(
322 model_match => $match,
323 control => 'effort',
324 wire_format => 'gemini',
325 is_gemini3 => 1,
326 levels => $levels,
327 source => $GEMINI3_SRC,
328 );
329 }
330  
331 10213 ▶sub _ensure_registry {
Subroutine _ensure_registry: called CC=2 SCAR=6.9
332 10213 ▶ return if @REGISTRY;
Branch: 1 branch
BranchTrueFalseTotal
if @REGISTRY 10187 26 10213
333  
334 # Provider default: an unrecognized id keeps the full normalized enum on the
335 # openai wire (no per-wire restriction), takes the fixed set on anthropic, and
336 # the binary collapse on gemini. Shared by every OpenAI-compatible provider
337 # (and no model at all). Never a reasoning model (is_reasoning_model 0). Built
338 # first: a chat carve-out whose family id matches no row copies the default,
339 # so the registry must not depend on a passthrough row existing (karr k196).
340 26 $DEFAULT = __PACKAGE__->new(
341 model_match => '',
342 control => 'effort',
343 wire_format => 'openai',
344 levels => [@ANTHROPIC_EFFORT_LEVELS],
345 is_reasoning_model => 0,
346 source => 'normalized OpenAI superset passthrough (unlisted id)',
347 );
348  
349 26 my @families = _family_profiles();
350  
351 # Non-reasoning chat carve-outs (karr k186): gpt-5-chat and every dotted
352 # gpt-5.N-chat id (gpt-5.1-chat-latest, gpt-5.2-chat-latest, ...) are
353 # non-reasoning chat models inside reasoning families. Listed first so they
354 # win over the family patterns. Generated per digit (karr k196): each copies
355 # the profile of its own family id (gpt-5.N-chat -> gpt-5.N), so a newly
356 # curated gpt-5.N family is picked up without a hand-kept mapping. The
357 # literal "-chat" after the digit already rejects a second digit.
358 my @carve_outs = map {
359 286 my ( $match, $like_id ) = @$_;
360 286 _non_reasoning_like( $match, _match( $like_id, @families ) );
361 } (
362 [ qr/\Agpt-5-chat/, 'gpt-5' ],
363 26 map { my $digit = $_; [ qr/\Agpt-5\.${digit}-chat/, "gpt-5.$digit" ] } 0 .. 9,
364 );
365  
366 26 @REGISTRY = ( @carve_outs, @families );
367 26 return;
368 }
369  
370 # The family rows, most-specific-first (everything except the chat carve-outs
371 # and the provider default).
372 27 ▶sub _family_profiles {
Subroutine _family_profiles: called CC=1 SCAR=0.0
373 return (
374 # Anthropic always-on Fable/Mythos: matched before the generic claude
375 # family. Case-insensitive substring, mirroring the legacy _is_fable_class.
376 27 __PACKAGE__->new(
377 model_match => qr/fable|mythos/i,
378 control => 'effort',
379 wire_format => 'anthropic',
380 levels => [@ANTHROPIC_EFFORT_LEVELS],
381 can_disable => 0,
382 disable_form => 'absent',
383 source => 'Anthropic Messages API; Fable/Mythos always-on thinking, k173 2026-09-16',
384 ),
385  
386 # OpenAI generation ladders. gpt-6 (astra): no none/minimal. gpt-5.6 /
387 # gpt-5.5: none but no minimal. gpt-5.1: gated (karr k174), with a codex-max
388 # carve-out matched first. Legacy gpt-5: minimal but no none/xhigh/max — the
389 # gpt-5(?![.\d]) negative-lookahead keeps it off gpt-5.5/5.6/5.1.
390 # gpt-6 and gpt-5.6 carry a per-wire split (karr k176): 'max' is
391 # Responses-only, so their openai (Chat Completions) set drops max while the
392 # responses set (== levels) keeps it. gpt-5.6 live-confirmed, gpt-6 doc-sourced.
393 # The gpt-6 row also covers its single-digit point releases (gpt-6.1, karr
394 # k201): they keep this doc-sourced ladder rather than an uncurated
395 # passthrough (which would send none/minimal and chat 'max'), so no separate
396 # gpt-6.N row exists. (?!\.\d\d) is the multi-digit guard after the dot:
397 # gpt-6.10 is an unknown id, not gpt-6.
398 _openai_profile( qr/\Agpt-6(?!\d)(?!\.\d\d)/,
399 [qw( low medium high xhigh max )],
400 openai_levels => [qw( low medium high xhigh )],
401 source => $OPENAI_K176_DOC,
402 disable_form => 'absent', can_disable => 1, is_reasoning_model => 1 ),
403 _openai_profile( qr/\Agpt-5\.6(?!\d)/,
404 [qw( none low medium high xhigh max )],
405 openai_levels => [qw( none low medium high xhigh )],
406 source => $OPENAI_K176_LIVE,
407 disable_form => 'explicit_none', is_reasoning_model => 1 ),
408 _openai_profile( qr/\Agpt-5\.5(?!\d)/,
409 [qw( none low medium high xhigh )], disable_form => 'explicit_none',
410 is_reasoning_model => 1 ),
411 # gpt-5.1 (karr k174), most-specific-first: codex-max re-adds xhigh, base
412 # drops minimal/xhigh/max. Both wires identical (xhigh is not Responses-only).
413 # default_reasoning_off: the 5.1 line's no-effort server-side default is
414 # reasoning-OFF (k185 2026-09-19 live) — a bare request does not reason.
415 _openai_profile( qr/\Agpt-5\.1-codex-max/,
416 [qw( none low medium high xhigh )],
417 source => $OPENAI_K174_DOC, disable_form => 'explicit_none',
418 default_reasoning_off => 1, is_reasoning_model => 1 ),
419 _openai_profile( qr/\Agpt-5\.1(?!\d)/,
420 [qw( none low medium high )],
421 source => $OPENAI_K174_DOC, disable_form => 'explicit_none',
422 default_reasoning_off => 1, is_reasoning_model => 1 ),
423 # gpt-5.2 / gpt-5.4: same no-effort-default-off generation as gpt-5.1
424 # (reasoning_tokens=0 with no effort, a non-default temperature honored --
425 # k185 2026-09-19 live). Their accepted effort ladder is not yet live-curated,
426 # so they keep the unlisted-id passthrough (full enum, no per-wire restriction)
427 # rather than an invented gate — only the default-reasoning-off signal is
428 # sourced. gpt-5.3, if it appears, falls through to the reasoning-on default.
429 __PACKAGE__->new(
430 model_match => qr/\Agpt-5\.[24](?!\d)/,
431 control => 'effort',
432 wire_format => 'openai',
433 levels => [@ANTHROPIC_EFFORT_LEVELS],
434 default_reasoning_off => 1,
435 is_reasoning_model => 1,
436 source => 'k185 2026-09-19 live: gpt-5.2/5.4 no-effort default reasoning off; effort ladder uncurated (passthrough)',
437 ),
438 _openai_profile( qr/\Agpt-5(?![.\d])/,
439 [qw( minimal low medium high )], disable_form => 'absent',
440 is_reasoning_model => 1 ),
441 # Uncurated OpenAI reasoning lines (karr k186): any other gpt-5.N (5.3, 5.7,
442 # ...) and the o-series are reasoning models, but their effort ladder is not
443 # curated, so they keep the unlisted-id passthrough serialization — only the
444 # reasoning classification is added. Matched after the curated gpt-5.N
445 # families above. Every dotted family pattern ends in (?!\d) (karr k196):
446 # gpt-5.10 is not gpt-5.1, and a multi-digit id matches no gpt-5.N row at
447 # all, so it is an unknown id (non-reasoning, temperature kept). The undotted
448 # gpt-6 and o-series rows carry the same guard (gpt-60, o10 are unknown).
449 _openai_passthrough( qr/\Agpt-5\.\d(?!\d)/, 1,
450 'k186: uncurated gpt-5.N reasoning line; effort ladder passthrough' ),
451 _openai_passthrough( qr/\Ao\d(?!\d)/, 1,
452 'k186: OpenAI o-series reasoning models; effort ladder passthrough' ),
453 # Non-reasoning OpenAI chat models (karr k186), marked explicitly so the
454 # classification never falls out of the default: gpt-4o / gpt-4.1 (and the
455 # rest of gpt-4*). Same passthrough serialization as the unlisted default.
456 _openai_passthrough( qr/\Agpt-4/, 0,
457 'k186: non-reasoning gpt-4 line (gpt-4o, gpt-4.1); effort ladder passthrough' ),
458  
459 # xAI grok (karr k208): grok-4.6 / grok-4.7 (and later single-digit 4.N)
460 # accept low|medium|high|xhigh, grok-4.5 low|medium|high; reasoning cannot
461 # be disabled (default high), so none/minimal/max drop and the server
462 # default applies. Same set on chat and responses. The (?!\d) guard keeps
463 # grok-4.20-multi-agent (effort = agent count) an unknown id.
464 _openai_profile( qr/\Agrok-4\.[6-9](?!\d)/,
465 [qw( low medium high xhigh )],
466 source => $XAI_K208_DOC, can_disable => 0, disable_form => 'absent' ),
467 _openai_profile( qr/\Agrok-4\.5(?!\d)/,
468 [qw( low medium high )],
469 source => $XAI_K208_DOC, can_disable => 0, disable_form => 'absent' ),
470  
471 # Moonshot kimi-k3 (karr k207): top-level reasoning_effort on
472 # chat/completions and output_config.effort on the Messages API, both
473 # low|high|max (server default max); always reasons, and the Messages API
474 # has no thinking request field, so can_disable 0 keeps to_anthropic from
475 # sending one. \A-anchored on Moonshot's own ids: OpenRouter's
476 # moonshotai/kimi-k3 is deliberately not matched (what an aggregator
477 # forwards was not checked). K2.x takes no effort (cleared per model on
478 # Engine::Moonshot only). (?!\d): kimi-k30 is an unknown id (k196 guard).
479 _openai_profile( qr/\Akimi-k3(?!\d)/,
480 [qw( low high max )],
481 source => 'platform.kimi.ai use-reasoning-effort + api/chat + api/messages; k207 2026-09-25 (advisor-verified, doc-sourced not live)',
482 can_disable => 0, disable_form => 'absent' ),
483  
484 # Thinking-toggle families (karr k209, k215): the wire takes a `thinking`
485 # object with an on/off type and no effort level, so Langertha::Reasoning
486 # maps none -> off and every other level -> on (the ladder collapses).
487 # \A-anchored on the providers' own ids; aggregator ids are not matched.
488 #
489 # MiniMax (platform.minimax.io openapi-chat-openai.json /
490 # openapi-chat-anthropic.json, advisor 2026-09-25, doc-sourced not live):
491 # thinking {type: disabled|adaptive}, no effort, no budget. M3 honors
492 # disabled; M2.x accepts it but keeps thinking on, so it cannot disable.
493 # MiniMax's own /v1/responses maps effort the same way (none -> off, any
494 # level -> adaptive).
495 __PACKAGE__->new(
496 model_match => qr/\AMiniMax-M3(?!\d)/,
497 control => 'boolean',
498 wire_format => 'openai',
499 can_disable => 1,
500 disable_form => 'thinking_disabled',
501 thinking_on => 'adaptive',
502 source => $MINIMAX_K209_DOC,
503 ),
504 __PACKAGE__->new(
505 model_match => qr/\AMiniMax-M2(?!\d)/,
506 control => 'boolean',
507 wire_format => 'openai',
508 can_disable => 0,
509 disable_form => 'absent',
510 thinking_on => 'adaptive',
511 source => $MINIMAX_K209_DOC,
512 ),
513 # Kimi K2.x (karr k215; platform.kimi.ai api/messages + guide/claude-code-kimi,
514 # advisor 2026-09-25, doc-sourced not live): thinking {type: enabled|disabled},
515 # no effort (output_config.effort is K3-only). kimi-k2.7-code(-highspeed) is
516 # forced on ("only type=enabled is allowed"), kimi-k2.6 can disable. Whether
517 # `enabled` needs budget_tokens on the Messages face is UNVERIFIED; none is
518 # sent. \z-anchored to Kimi's documented ids: AKI.IO's hosted
519 # kimi-k2.7-code-1100b is a different API and is not matched. Reached on
520 # MoonshotAnthropic (both rows) and on Engine::Moonshot's chat/completions
521 # (kimi-k2.6 only, karr k219: the same toggle as a top-level `thinking`;
522 # wire_format is descriptive, to_openai serializes it). Engine::Moonshot
523 # keeps reasoning_effort cleared on kimi-k2.7-code, where the chat face
524 # must not be sent thinking at all.
525 __PACKAGE__->new(
526 model_match => qr/\Akimi-k2\.7-code(?:-highspeed)?\z/,
527 control => 'boolean',
528 wire_format => 'anthropic',
529 can_disable => 0,
530 disable_form => 'absent',
531 thinking_on => 'enabled',
532 source => $KIMI_K215_DOC,
533 ),
534 __PACKAGE__->new(
535 model_match => qr/\Akimi-k2\.6\z/,
536 control => 'boolean',
537 wire_format => 'anthropic',
538 can_disable => 1,
539 disable_form => 'thinking_disabled',
540 thinking_on => 'enabled',
541 source => $KIMI_K215_DOC,
542 ),
543 # Self-hosted Qwen3.x reasoning family (vLLM / SGLang / llama.cpp), matched
544 # with or without its HuggingFace org prefix (served ids look like
545 # "Qwen/Qwen3.8-27B-FP8"). The loaded chat template — not the server —
546 # dictates the vocabulary: this family accepts none|low|medium|xhigh and
547 # REJECTS high|minimal (live-probed, k79/k180). Only the openai (Chat
548 # Completions) wire is restricted — the sole wire these engines speak — so the
549 # two rejected efforts drop before they can 400 the server. Unknown
550 # self-hosted models are deliberately NOT listed: they fall through to the
551 # passthrough default and keep going raw (correct for an unknown chat
552 # template, k180).
553 __PACKAGE__->new(
554 model_match => qr{(?:\A|/)qwen3\.\d(?!\d)}i,
555 control => 'effort',
556 wire_format => 'openai',
557 levels => [qw( none low medium xhigh )],
558 levels_by_wire => { openai => [qw( none low medium xhigh )] },
559 disable_form => 'explicit_none',
560 source => $QWEN_SELFHOSTED_SRC,
561 ),
562  
563 # Gemini 2.5: integer thinkingBudget (no level vocabulary). Category (b)
564 # bounds carried but not enforced in Phase 1 (the value passes through).
565 __PACKAGE__->new(
566 model_match => qr/\Agemini-2\.5-flash-lite/,
567 control => 'budget', wire_format => 'gemini', levels => [],
568 budget_min => 512, budget_max => 24576, off_value => 0, dynamic_value => -1,
569 disable_form => 'budget_zero', source => $GEMINI25_SRC,
570 ),
571 __PACKAGE__->new(
572 model_match => qr/\Agemini-2\.5-flash/,
573 control => 'budget', wire_format => 'gemini', levels => [],
574 budget_min => 0, budget_max => 24576, off_value => 0, dynamic_value => -1,
575 disable_form => 'budget_zero', source => $GEMINI25_SRC,
576 ),
577 __PACKAGE__->new(
578 model_match => qr/\Agemini-2\.5-pro/,
579 control => 'budget', wire_format => 'gemini', levels => [],
580 budget_min => 128, budget_max => 32768, dynamic_value => -1, can_disable => 0,
581 disable_form => 'absent', source => $GEMINI25_SRC,
582 ),
583 __PACKAGE__->new(
584 model_match => qr/\Agemini-2\.5(?!\d)/,
585 control => 'budget', wire_format => 'gemini', levels => [],
586 budget_min => 0, budget_max => 24576, off_value => 0, dynamic_value => -1,
587 disable_form => 'budget_zero', source => $GEMINI25_SRC,
588 ),
589  
590 # Gemini 3 thinkingLevel families, most-specific-first: 3.7/3.8-flash and
591 # 3.1-pro drop minimal (low|medium|high); 3-pro is binary (low|high); every
592 # other gemini-3 keeps the full minimal..high set.
593 _gemini3_profile( qr/\Agemini-3\.[78]-flash/, [qw( low medium high )] ),
594 _gemini3_profile( qr/\Agemini-3\.1-pro/, [qw( low medium high )] ),
595 _gemini3_profile( qr/\Agemini-3-pro/, [qw( low high )] ),
596 _gemini3_profile( qr/\Agemini-3/, [qw( minimal low medium high )] ),
597  
598 # Claude 4.6 (opus/sonnet): accepts low|medium|high|max but NOT xhigh —
599 # Anthropic's effort doc lists 4.6 under `max`, not under `xhigh`. Matched
600 # before the generic claude family. karr k177, doc-sourced (not live).
601 __PACKAGE__->new(
602 model_match => qr/\Aclaude-(opus|sonnet)-4-6/,
603 control => 'effort',
604 wire_format => 'anthropic',
605 levels => [qw( low medium high max )],
606 source => $ANTHROPIC_K177_DOC,
607 ),
608  
609 # Generic Claude family (adaptive thinking, can disable).
610 __PACKAGE__->new(
611 model_match => qr/\Aclaude/,
612 control => 'effort',
613 wire_format => 'anthropic',
614 levels => [@ANTHROPIC_EFFORT_LEVELS],
615 source => 'Anthropic Messages API output_config.effort; k173 2026-09-16',
616 ),
617  
618 # GPT-OSS on Ollama: the one family that takes graded level STRINGS on the
619 # options.think knob (low<medium<high<max) instead of the model-agnostic
620 # boolean, and ALWAYS reasons — there is no "off" (think:false is ignored,
621 # so 'none' -> floor 'low'). Its other wires stay unrestricted so nothing
622 # regresses off the ollama path: no levels_by_wire (openai passes the full
623 # enum through), and levels keeps the generic anthropic set. Live-probed
624 # 2026-09-17 via ollama.com gpt-oss:20b (k175).
625 __PACKAGE__->new(
626 model_match => qr/\Agpt-oss/,
627 control => 'effort',
628 wire_format => 'ollama',
629 levels => [@ANTHROPIC_EFFORT_LEVELS],
630 ollama_levels => [qw( low medium high max )],
631 source => 'live-probed 2026-09-17 via ollama.com gpt-oss:20b (k175)',
632 ),
633 );
634 }
635  
636  
637 10213 ▶sub for_model {
Subroutine for_model: called CC=1 SCAR=0.0
Pod documented
638 10213 my ( $class, $id ) = @_;
639 10213 _ensure_registry();
640 10213 return _match( $id, @REGISTRY );
641 }
642  
643 # First profile in @profiles (most-specific-first) whose model_match matches
644 # $id, else the provider default.
645 10499 ▶sub _match {
Subroutine _match: called CC=8 SCAR=27.0
646 10499 my ( $id, @profiles ) = @_;
647 10499 ▶ $id = '' unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 10499 10499
648 10499 for my $profile (@profiles) {
649 253796 my $match = $profile->model_match;
650 253796 ▶ if ( ref $match eq 'Regexp' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $match eq 'Regexp') { } 253796 0 253796
elsif (defined $match and length $match) { } 0 0 0
651 253796 ▶ return $profile if $id =~ $match;
Branch: 1 branch
BranchTrueFalseTotal
if $id =~ /$match/ 7608 246188 253796
652 }
653 ▶ elsif ( defined $match && length $match ) {
Condition0%0/3
defined $match and length $match
!ll&&!rl&&r
000
MC/DC0%0/2
defined $match and length $match
defined $match length $match
Truth table0%0/3
A and B
A= defined $matchB= length $match
ABresult
0X0
100
111
654 0 ▶ return $profile if $id eq $match;
Branch: 1 branch
BranchTrueFalseTotal
if $id eq $match 0 0 0
655 }
656 }
657 2891 return $DEFAULT;
658 }
659  
660 181 __PACKAGE__->meta->make_immutable;
661  
662  
663 181 1;
664  
665 __END__
666  
667 =pod
668  
669 =encoding UTF-8
670  
671 =head1 NAME
672  
673 Langertha::Reasoning::Profile - Typed per-model reasoning wire-truth (accepted vocabulary + numeric bounds)
674  
675 =head1 VERSION
676  
677 version 0.503
678  
679 =head1 SYNOPSIS
680  
681 my $profile = Langertha::Reasoning::Profile->for_model('gpt-5.6-terra');
682 $profile->control; # 'effort'
683 $profile->effort_accepted_on('openai', 'max'); # 1
684  
685 =head1 DESCRIPTION
686  
687 Immutable value object holding what a reasoning model's wire literally accepts —
688 the linchpin datatype behind L<Langertha::Reasoning>. It carries the two
689 non-overridable categories from karr k173's three-category taxonomy: the
690 B<accepted vocabulary + native control type> (which levels the wire takes,
691 effort/budget/boolean) and the B<provider-enforced numeric bounds & magic
692 values> (Gemini 2.5's budget floor/ceiling, C<0>=off, C<-1>=dynamic). The
693 invented level-to-token interpolation (category c) is deliberately absent — it
694 lives in L<Langertha::Reasoning::BudgetPolicy>, clamped to this object's bounds.
695  
696 L</for_model> resolves an id to its profile most-specific-first (exact id →
697 family regex → provider default), replacing the scattered per-model hashes and
698 regexes that used to live inline in L<Langertha::Reasoning>. Each profile
699 carries a C<source> receipt (doc URL + verification date) so curating a new
700 family is a single declarative add.
701  
702 =head2 model_match
703  
704 The id or family pattern this profile matches — an exact C<Str> id or a
705 C<RegexpRef> family pattern. Descriptive; L</for_model> tests the registry's
706 matchers in order.
707  
708 =head2 control
709  
710 The wire's native reasoning control type: C<effort> (a level string),
711 C<budget> (an integer token budget, Gemini 2.5), C<boolean> (Ollama's
712 C<options.think>, or a C<thinking> on/off toggle — see L</thinking_on>) or
713 C<none>.
714  
715 =head2 levels
716  
717 The on-spectrum vocabulary the wire literally accepts, ascending. Empty for
718 C<budget>/C<boolean> controls (quantization anchors are not wire-truth). For a
719 Gemini 3 family it is the accepted C<thinkingLevel> subset.
720  
721 =head2 levels_by_wire
722  
723 Per-wire refinement of L</levels> for a family whose accepted set differs
724 between the wires it speaks (the OpenAI C<openai> vs C<responses> axis, karr
725 k176). The gpt-6 and gpt-5.6 generations drop C<max> on the C<openai> (Chat
726 Completions) wire while keeping it on C<responses> — C<max> is Responses-only
727 (live-confirmed 2026-09-16, karr k176). A family whose wires agree populates
728 both keys with the same set; the unlisted-id default leaves it empty (no
729 per-wire restriction).
730  
731 =head2 ollama_levels
732  
733 The graded level strings this model accepts on Ollama's C<options.think> knob,
734 in place of the model-agnostic boolean. Set only on the GPT-OSS family, which
735 ignores C<think:true>/C<think:false> and instead takes C<low|medium|high|max>
736 (live-probed 2026-09-17 via ollama.com gpt-oss:20b, k175). L</has_ollama_levels>
737 gates L<Langertha::Reasoning/to_ollama> between the level-string and boolean
738 serializations; unset for every other model (they take the boolean).
739  
740 =head2 can_disable
741  
742 Whether reasoning can be turned off on this model. C<0> marks the always-on
743 "Fable-class" Anthropic models, where C<thinking:{type:disabled}> 400s and no
744 C<thinking> field may be sent.
745  
746 =head2 default_reasoning_off
747  
748 Whether the model's server-side default effort (the one that applies when no
749 C<reasoning_effort> is sent) leaves reasoning OFF. C<0> — the common case —
750 means the model reasons by default: a bare request already triggers reasoning.
751 C<1> marks the models whose no-effort default is non-reasoning (the gpt-5.1 /
752 gpt-5.2 / gpt-5.4 line: C<reasoning_tokens=0> with no effort, live-verified
753 2026-09-19), so a control-on-control gate can tell "reasoning is active on the
754 default path" apart from "an effort was set". Consumed read-only by
755 L<Langertha::Engine::OpenAI/_temperature_rejected_by_reasoning>; distinct from
756 L</can_disable> (whether an explicit C<none> effort turns reasoning off at all).
757  
758 =head2 is_reasoning_model
759  
760 Whether the model is a curated OpenAI reasoning model — one that can reject a
761 non-default C<temperature> while reasoning is active. C<1> is set explicitly on
762 the o-series, the gpt-5 line (non-chat), the single-digit gpt-5.N lines
763 (non-chat) and gpt-6 (with its single-digit gpt-6.N point releases). A
764 multi-digit id such as C<gpt-5.10> or C<gpt-6.10> matches no family and is an
765 unknown id (karr k196, k201).
766 The explicit non-reasoning entries (gpt-4o / gpt-4.1 and every C<gpt-5-chat> /
767 C<gpt-5.N-chat> id) carry C<0>, and so does the unlisted-id default: an unknown
768 model never classifies as reasoning, because wrongly dropping a caller's
769 temperature is the worse error (karr k186). Only the OpenAI families are
770 curated; a C<0> on another family (Claude, Gemini, Qwen, GPT-OSS) means "not
771 classified", not "known non-reasoning". Consumed read-only by
772 L<Langertha::Engine::OpenAI/_temperature_rejected_by_reasoning>.
773  
774 =head2 disable_form
775  
776 How "off" is expressed on the wire: C<absent> (omit the field),
777 C<explicit_none> (the literal C<none> level), C<think_false> (Ollama),
778 C<budget_zero> (Gemini flash C<thinkingBudget=0>) or C<thinking_disabled>
779 (C<< thinking =E<gt> { type =E<gt> 'disabled' } >>, the thinking-toggle rows;
780 read by L</thinking_toggle_for>).
781  
782 =head2 thinking_on
783  
784 Set only on a B<thinking-toggle> model: one whose wire takes a C<thinking>
785 object with an on/off C<type> and no effort level (MiniMax-M3 / M2.x, Kimi
786 K2.x; karr k209, k215). Its value is the "on" type the model takes:
787 C<adaptive> (MiniMax) or C<enabled> (Kimi). When set, L<Langertha::Reasoning>
788 serializes the effort onto that toggle on the C<openai> and C<anthropic> wires
789 instead of an effort field (see L</thinking_toggle_for>); the level ladder
790 collapses to on/off. Unset everywhere else.
791  
792 =head2 wire_format
793  
794 The reasoning dialect this model's family primarily speaks. Descriptive: the
795 serialization is still selected by the caller's C<reasoning_wire_format> (an
796 OpenAI-compatible engine may run a non-gpt model on the C<openai> wire), so it
797 is a curation hint, not the dispatch key.
798  
799 =head2 is_gemini3
800  
801 Selects the Gemini serialization branch: true for the Gemini 3 family (map onto
802 C<thinkingLevel> then clamp to L</levels>), false for everything else (the
803 universally-accepted binary C<low>|C<high> collapse a non-Gemini-3 model takes).
804  
805 =head2 budget_min
806  
807 =head2 budget_max
808  
809 Provider-enforced integer C<thinkingBudget> bounds for a C<budget>-control
810 family (Gemini 2.5). Category (b) wire-truth: a later BudgetPolicy may only emit
811 values inside them. Carried but not enforced in Phase 1 (the value passes
812 through verbatim, as today).
813  
814 =head2 off_value
815  
816 The magic C<thinkingBudget> that disables thinking (Gemini flash / flash-lite:
817 C<0>); C<undef> where the family cannot disable (Gemini 2.5 pro).
818  
819 =head2 dynamic_value
820  
821 The magic C<thinkingBudget> that hands budget selection to the model (Gemini:
822 C<-1>).
823  
824 =head2 source
825  
826 The curation receipt — provider doc URL plus verification date — for the
827 accepted vocabulary and numeric bounds this profile encodes.
828  
829 =head2 fable_class
830  
831 True for the always-on Anthropic "Fable-class" models (the inverse of
832 L</can_disable>): they carry an effort but never a C<thinking> block.
833  
834 =head2 thinking_toggle_for
835  
836 $profile->thinking_toggle_for('none') # { type => 'disabled' } on MiniMax-M3
837 $profile->thinking_toggle_for('high') # { type => 'adaptive' }
838  
839 The C<thinking> object a thinking-toggle model (L</has_thinking_on>) takes for
840 a normalized effort: C<none> gives C<< { type =E<gt> 'disabled' } >> when
841 L</disable_form> is C<thinking_disabled>, and nothing (C<undef>) on a model
842 that cannot turn thinking off — the field is omitted and the server default
843 applies, as on every always-on model; any other level gives
844 C<< { type =E<gt> L</thinking_on> } >>. C<undef> on a model without a toggle.
845  
846 =head2 effort_accepted_on
847  
848 $profile->effort_accepted_on('openai', 'max')
849  
850 Whether the given effort is accepted on the named OpenAI wire (C<openai> or
851 C<responses>). A family without a per-wire restriction (every non-gpt family and
852 the unlisted-id default) returns true for every effort — the full normalized
853 enum passes through, which is the current OpenAI enum. A restricted gpt family
854 checks membership in its L</levels_by_wire> set for that wire.
855  
856 =head2 anthropic_effort_ok
857  
858 Whether the effort maps onto this model's C<output_config.effort> vocabulary.
859 Per-model, checking membership in the resolved profile's own L</levels> rather
860 than a uniform Anthropic set: Claude 4.6 (opus/sonnet) accepts
861 C<low|medium|high|max> but B<not> C<xhigh>, while Claude 4.7+/5 accept the full
862 C<low|medium|high|xhigh|max> (karr k177). The normalized C<none>/C<minimal> have
863 no Anthropic equivalent and are absent from every Claude profile's C<levels>.
864  
865 =head2 gemini_level_for
866  
867 $profile->gemini_level_for('max') # -> 'high'
868  
869 Maps the normalized effort onto the Gemini C<thinkingLevel> this model accepts.
870 A non-Gemini-3 family (L</is_gemini3> false) collapses to the universally
871 accepted binary C<low>|C<high> at C<high>. A Gemini 3 family maps onto the
872 C<minimal>|C<low>|C<medium>|C<high> base vocabulary then clamps down to its
873 L</levels> subset (never up — an unsupported level 400s), a level below the
874 family's floor rising to that floor.
875  
876 =head2 ollama_level_for
877  
878 $profile->ollama_level_for('xhigh') # -> 'max'
879  
880 Maps the normalized effort onto the GPT-OSS C<options.think> level vocabulary
881 (C<low|medium|high|max>): C<none>/C<minimal>/C<low> become C<low>,
882 C<xhigh>/C<max> become C<max>, C<medium> and C<high> pass through. GPT-OSS
883 always reasons, so C<none> collapses onto the floor C<low> rather than an off
884 state (there is no off — C<think:false> is ignored). Mirrors
885 L</gemini_level_for>; only meaningful when L</has_ollama_levels> is true.
886  
887 =head2 for_model
888  
889 my $profile = Langertha::Reasoning::Profile->for_model('gemini-3-pro-preview');
890  
891 Resolve a model id to its profile, matched most-specific-first: an exact id, a
892 family regex, then the provider default (which every unlisted id and the
893 no-model case falls through to). Never dies.
894  
895 =head1 SEE ALSO
896  
897 =over
898  
899 =item * L<Langertha::Reasoning> - The value object that resolves and consumes profiles
900  
901 =item * L<Langertha::Reasoning::BudgetPolicy> - The category-(c) convention clamped to this object's (b) bounds
902  
903 =item * L<Langertha::Role::ReasoningEffort> - The composed role dispatching to L<Langertha::Reasoning>
904  
905 =back
906  
907 =head1 SUPPORT
908  
909 =head2 Issues
910  
911 Please report bugs and feature requests on GitHub at
912 L<https://github.com/Getty/langertha/issues>.
913  
914 =head2 IRC
915  
916 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
917  
918 =head1 CONTRIBUTING
919  
920 Contributions are welcome! Please fork the repository and submit a pull request.
921  
922 =head1 AUTHOR
923  
924 Torsten Raudssus <getty@cpan.org>
925  
926 =head1 COPYRIGHT AND LICENSE
927  
928 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
929  
930 This is free software; you can redistribute it and/or modify it under
931 the same terms as the Perl 5 programming language system itself.
932  
933 =cut
« blib/lib/Langertha/Engine/OpenAI.pm ↑ Summary blib/lib/Langertha/Role/Transcription.pm »