blib/lib/Langertha/Engine/MiniMax.pm

filter: Statementstmt 100% 28 / 28 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 11 / 11 Podpod 33.3% 1 / 3 totaltotal 91.1% 41 / 45 CC 2 SCAR 1.6
CC
2
Cov
97%
_build_api_key
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Langertha/Engine/TSystems.pm ↑ Summary blib/lib/Langertha/Engine/AKIAnthropic.pm »
1 package Langertha::Engine::MiniMax;
2 # ABSTRACT: MiniMax API (OpenAI-compatible)
3 12 our $VERSION = '0.505';
4 12 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 12 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 12 extends 'Langertha::Engine::OpenAIBase';
8  
9 # StreamUsage: the ChatCompletionReq schema has stream_options.include_usage
10 # (platform.minimax.io text-chat-openai reference, ADR 0038).
11 12 with map { 'Langertha::Role::'.$_ } qw(
12 StaticModels
13 Tools
14 StreamUsage
15 );
16  
17  
18 58 ▶sub _build_supported_operations {[qw(
Subroutine _build_supported_operations: called CC=1 SCAR=0.0
19 createChatCompletion
20 )]}
21  
22 has '+url' => (
23 lazy => 1,
24 34 ▶ default => sub { 'https://api.minimax.io/v1' },
Subroutine __ANON__: called CC=1 SCAR=0.0
25 12 );
26  
27 1 ▶sub _build_api_key {
Subroutine _build_api_key: called CC=2 SCAR=7.2
28 1 my ( $self ) = @_;
29 return $ENV{LANGERTHA_MINIMAX_API_KEY}
30 1 ▶ || croak "".(ref $self)." requires LANGERTHA_MINIMAX_API_KEY or api_key set";
Condition50%1/2
$ENV{'LANGERTHA_MINIMAX_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
l!l
10
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 table50%1/2
A
A= $ENV{'LANGERTHA_MINIMAX_API_KEY'}
Aresult
11
00
31 }
32  
33 46 ▶sub default_model { 'MiniMax-M3' }
Subroutine default_model: called CC=1 SCAR=0.0
Pod documented
34  
35 172 ▶sub default_response_size { 4096 }
Subroutine default_response_size: called CC=1 SCAR=0.0
Pod undocumented
36  
37 1 ▶sub _build_static_models {[
Subroutine _build_static_models: called CC=1 SCAR=0.0
38 1 { id => 'MiniMax-M3' },
39 { id => 'MiniMax-M2.7' },
40 { id => 'MiniMax-M2.5' },
41 { id => 'MiniMax-M2.5-highspeed' },
42 { id => 'MiniMax-M2.1' },
43 { id => 'MiniMax-M2.1-highspeed' },
44 { id => 'MiniMax-M2' },
45 ]}
46  
47 # MiniMax's current /v1/chat/completions schema (platform.minimax.io, verified
48 # 2026-09-01) is narrower than the role inventory promises: `tool_choice`,
49 # `response_format` and `parallel_tool_calls` are absent from the schema
50 # entirely. Function calling (the `tools` array) is supported, so tools_native
51 # stays; the selection, structured-output and parallel knobs are cleared so
52 # chat_f never builds a body around fields the wire drops. reasoning_effort is
53 # per model and lives in model_capability_corrections below.
54 288 ▶around engine_capabilities => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
55 288 my ( $orig, $self, @rest ) = @_;
56 288 my $caps = $self->$orig(@rest);
57 288 delete @{$caps}{ qw(
58 tool_choice_auto tool_choice_any tool_choice_none tool_choice_named
59 response_format_json_object response_format_json_schema
60 parallel_tool_use
61 ) };
62 288 return $caps;
63 12 };
64  
65 # Reasoning is per model (karr k209, openapi-chat-openai.json, advisor
66 # 2026-09-25, docs only). The wire has no effort field, only a binary
67 # thinking:{type: disabled|adaptive} toggle (default adaptive). MiniMax-M3
68 # honors it, so reasoning_effort is re-enabled there and its
69 # Reasoning::Profile row maps none -> disabled and every other level ->
70 # adaptive (all levels give the same depth). M2.x accepts disabled but keeps
71 # thinking on, and unknown ids are unchecked, so every other model keeps the
72 # flag cleared and Role::ReasoningEffort sends nothing (the k204 gate). The
73 # clear is the catch-all first row rather than layer 2, so the M3 row can win
74 # over it (ADR 0019 k209 Update).
75 # image_input follows the same shape (k266, llm-advisor, docs only,
76 # 2026-09-25): MiniMax-M3 takes image input, the M2.x line is text-only.
77 286 ▶sub model_capability_corrections {
Subroutine model_capability_corrections: called CC=1 SCAR=0.0
Pod undocumented
78 return (
79 286 qr/\A/ => { reasoning_effort => 0, image_input => 0 },
80 qr/\AMiniMax-M3(?!\d)/ => { reasoning_effort => 1, image_input => 1 },
81 );
82 }
83  
84 # This endpoint speaks the `thinking` on/off toggle (ADR 0023 k209 Update): the
85 # thinking-toggle Reasoning::Profile rows serialize as the toggle only on an
86 # engine that opts in here; the same model id elsewhere keeps its effort wire.
87 40 ▶sub _reasoning_thinking_toggle { 1 }
Subroutine _reasoning_thinking_toggle: called CC=1 SCAR=0.0
88  
89 12 __PACKAGE__->meta->make_immutable;
90  
91  
92 12 1;
93  
94 __END__
« blib/lib/Langertha/Engine/TSystems.pm ↑ Summary blib/lib/Langertha/Engine/AKIAnthropic.pm »