blib/lib/Langertha/Engine/MiniMaxAnthropic.pm

filter: Statementstmt 72.7% 24 / 33 Branchbran 25.0% 1 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 83.3% 10 / 12 Podpod 50.0% 2 / 4 totaltotal 66.0% 37 / 56 CC 4 SCAR 9.6
CC
4
Cov
64%
_build_api_key
6.0
__ANON__
5.4
_build_static_models
2.0
CRAP 2.6
« blib/lib/Langertha/Engine/Remote.pm ↑ Summary blib/lib/Langertha/Role/CachedContent.pm »
1 package Langertha::Engine::MiniMaxAnthropic;
2 # ABSTRACT: MiniMax API via Anthropic-compatible endpoint (legacy)
3 13 our $VERSION = '0.505';
4 13 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 13 extends 'Langertha::Engine::AnthropicBase';
8  
9 13 with 'Langertha::Role::StaticModels';
10  
11  
12 # AnthropicBase->chat_request appends '/v1/messages' to url; the default must
13 # therefore stop at '/anthropic' so the composed endpoint is a single
14 # '/anthropic/v1/messages' (a '/anthropic/v1' default double-stacks to
15 # '/anthropic/v1/v1/messages' -> HTTP 404 on every model).
16 has '+url' => (
17 lazy => 1,
18 19 ▶ default => sub { 'https://api.minimax.io/anthropic' },
Subroutine __ANON__: called CC=1 SCAR=0.0
19 13 );
20  
21 0 ▶sub _build_api_key {
Subroutine _build_api_key: not called CC=2 SCAR=17.9
22 0 my ( $self ) = @_;
23 return $ENV{LANGERTHA_MINIMAX_API_KEY}
24 0 ▶ || croak "".(ref $self)." requires LANGERTHA_MINIMAX_API_KEY or api_key set";
Condition0%0/2
$ENV{'LANGERTHA_MINIMAX_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
l!l
00
MC/DC0%0/1
$ENV{'LANGERTHA_MINIMAX_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
$ENV{'LANGERTHA_MINIMAX_API_KEY'}
Truth table0%0/2
A
A= $ENV{'LANGERTHA_MINIMAX_API_KEY'}
Aresult
11
00
25 }
26  
27 19 ▶sub default_model { 'MiniMax-M3' }
Subroutine default_model: called CC=1 SCAR=0.0
Pod documented
28  
29 1 ▶sub api_key_env { 'LANGERTHA_MINIMAX_API_KEY' }
Subroutine api_key_env: called CC=1 SCAR=0.0
Pod documented
30  
31 63 ▶sub default_response_size { 4096 }
Subroutine default_response_size: called CC=1 SCAR=0.0
Pod undocumented
32  
33 0 ▶sub _build_static_models {[
Subroutine _build_static_models: not called CC=1 SCAR=6.9
34 0 { id => 'MiniMax-M3' },
35 { id => 'MiniMax-M2.7' },
36 { id => 'MiniMax-M2.5' },
37 { id => 'MiniMax-M2.5-highspeed' },
38 { id => 'MiniMax-M2.1' },
39 { id => 'MiniMax-M2.1-highspeed' },
40 { id => 'MiniMax-M2' },
41 ]}
42  
43 # MiniMax's /anthropic CreateMessageReq has a `thinking` object (default
44 # disabled on M3) but no `output_config` (openapi-chat-anthropic.json, advisor
45 # 2026-09-25, docs only; karr k209). That holds for every model on this
46 # endpoint, so the effort is stripped here rather than in a per-model
47 # Reasoning::Profile row; thinking:{type:adaptive} stays, since it is how an
48 # effort turns thinking on (ADR 0009 k209 update).
49 71 ▶around reasoning_kwargs_for => sub {
Subroutine __ANON__: called CC=3 SCAR=16.8
50 71 my ( $orig, $self, @args ) = @_;
51 71 my %kwargs = $self->$orig(@args);
52 63 ▶ if ( ref $kwargs{output_config} eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $kwargs{"output_config"} eq "HASH") 0 63 63
53 0 my %output_config = %{ $kwargs{output_config} };
54 0 delete $output_config{effort};
55 0 ▶ if (%output_config) { $kwargs{output_config} = \%output_config }
Branch: 1 branch
BranchTrueFalseTotal
if (%output_config) { } 0 0 0
56 0 else { delete $kwargs{output_config} }
57 }
58 63 return %kwargs;
59 13 };
60  
61 # This endpoint speaks the `thinking` on/off toggle (ADR 0023 k209 Update): the
62 # thinking-toggle Reasoning::Profile rows serialize as the toggle only on an
63 # engine that opts in here; the same model id elsewhere keeps its effort wire.
64 66 ▶sub _reasoning_thinking_toggle { 1 }
Subroutine _reasoning_thinking_toggle: called CC=1 SCAR=0.0
65  
66 # image_input (k266, ADR 0019 k266 Update): MiniMax-M3 takes image input, the
67 # M2.x line is text-only (llm-advisor, docs only, 2026-09-25) -- the same rows
68 # as Engine::MiniMax, the OpenAI face of the same service.
69 167 ▶sub model_capability_corrections {
Subroutine model_capability_corrections: called CC=1 SCAR=0.0
Pod undocumented
70 return (
71 167 qr/\A/ => { image_input => 0 },
72 qr/\AMiniMax-M3(?!\d)/ => { image_input => 1 },
73 );
74 }
75  
76 # Source blocks in a tool_result (karr k364, k371): deliberately 1, the
77 # Role::Tools default, stated here so nobody flips it to 0 as "undocumented".
78 # MiniMax's docs do not know `document` (RequestContentBlock.type enum is
79 # text | image | video | tool_use | tool_result | thinking | mid_conv_system;
80 # tool_result.content is "string or array of text/image", docs only), but a
81 # live probe 2026-09-30 (tool_use -> tool_result[text, document{base64
82 # application/pdf}], 1-page PDF reading a codeword) got HTTP 200 and the
83 # correct codeword from both MiniMax-M2.7 (text-only, 244 input tokens: text
84 # extracted without vision) and MiniMax-M3 (3159 input tokens: page seen as
85 # well). Gating on image_input would turn working PDF reading on M2.x into the
86 # placeholder. Only a PDF/base64 document was probed; a text-source document
87 # and search_result were NOT.
88 174 ▶sub _tool_result_source_blocks_on_wire { 1 }
Subroutine _tool_result_source_blocks_on_wire: called CC=1 SCAR=0.0
89  
90 13 __PACKAGE__->meta->make_immutable;
91  
92  
93 13 1;
94  
95 __END__
« blib/lib/Langertha/Engine/Remote.pm ↑ Summary blib/lib/Langertha/Role/CachedContent.pm »