Langertha/Engine/MiniMaxAnthropic.pm

filter: Statementstmt 83.3% 15 / 18 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 2 totaltotal 62.5% 20 / 32 CC 2 SCAR 8.6
CC
2
Cov
71%
_build_api_key
6.0
_build_static_models
2.0
BEGIN
1.0
CRAP 2.4
« Langertha/Role/Models.pm ↑ Summary Langertha/Role/HermesTools.pm »
1 package Langertha::Engine::MiniMaxAnthropic;
2 # ABSTRACT: MiniMax API via Anthropic-compatible endpoint (legacy)
3 2 our $VERSION = '0.502';
4 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 extends 'Langertha::Engine::AnthropicBase';
8  
9 2 with 'Langertha::Role::StaticModels';
10  
11  
12 has '+url' => (
13 lazy => 1,
14 1 ▶ default => sub { 'https://api.minimax.io/anthropic/v1' },
Subroutine __ANON__: called CC=1 SCAR=0.0
15 2 );
16  
17 sub _build_api_key {
18 0 ▶ my ( $self ) = @_;
Subroutine _build_api_key: not called CC=2 SCAR=17.9
19 return $ENV{LANGERTHA_MINIMAX_API_KEY}
20 0 ▶ || croak "".(ref $self)." requires LANGERTHA_MINIMAX_API_KEY or api_key set";
Condition0%0/3
$ENV{'LANGERTHA_MINIMAX_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{'LANGERTHA_MINIMAX_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
$ENV{'LANGERTHA_MINIMAX_API_KEY'} croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
Truth table0%0/3
A || B
A= $ENV{'LANGERTHA_MINIMAX_API_KEY'}B= croak('' . ref($self) . ' requires LANGERTHA_MINIMAX_API_KEY or api_key set')
ABresult
1X1
011
000
21 }
22  
23 2 ▶sub default_model { 'MiniMax-M2.7' }
Subroutine default_model: called CC=1 SCAR=0.0
Pod undocumented
24  
25 1 ▶sub default_response_size { 4096 }
Subroutine default_response_size: called CC=1 SCAR=0.0
Pod undocumented
26  
27 sub _build_static_models {[
28 0 ▶ { id => 'MiniMax-M2.7' },
Subroutine _build_static_models: not called CC=1 SCAR=6.9
29 { id => 'MiniMax-M2.5' },
30 { id => 'MiniMax-M2.5-highspeed' },
31 { id => 'MiniMax-M2.1' },
32 { id => 'MiniMax-M2.1-highspeed' },
33 { id => 'MiniMax-M2' },
34 ]}
35  
36 2 __PACKAGE__->meta->make_immutable;
37  
38  
39 2 1;
40  
41 __END__
42  
43 =pod
44  
45 =encoding UTF-8
46  
47 =head1 NAME
48  
49 Langertha::Engine::MiniMaxAnthropic - MiniMax API via Anthropic-compatible endpoint (legacy)
50  
51 =head1 VERSION
52  
53 version 0.502
54  
55 =head1 SYNOPSIS
56  
57 use Langertha::Engine::MiniMaxAnthropic;
58  
59 my $minimax = Langertha::Engine::MiniMaxAnthropic->new(
60 api_key => $ENV{MINIMAX_API_KEY},
61 model => 'MiniMax-M2.7',
62 );
63  
64 print $minimax->simple_chat('Hello from Perl!');
65  
66 =head1 DESCRIPTION
67  
68 Provides access to L<MiniMax|https://www.minimax.io/> models via their
69 Anthropic-compatible endpoint at C<https://api.minimax.io/anthropic/v1>.
70  
71 B<Historical note:> Until version 0.402 this was the default behavior of
72 L<Langertha::Engine::MiniMax>. MiniMax's C</anthropic> endpoint is a shim
73 over their native OpenAI-compatible API — it does not always re-parse
74 stringified tool-call arguments, which causes intermittent tool-calling
75 failures where the Anthropic SDK sees a wrapper object whose key rotates
76 between C<result>, C<arguments>, and the tool name. For new code prefer
77 L<Langertha::Engine::MiniMax>, which talks to MiniMax's native OpenAI
78 endpoint and avoids the shim. This class is retained for anyone who needs
79 the Anthropic wire format specifically.
80  
81 See L<Langertha::Engine::MiniMax> for the available models list.
82  
83 Get your API key at L<https://platform.minimax.io/> and set
84 C<LANGERTHA_MINIMAX_API_KEY> in your environment.
85  
86 =head1 SEE ALSO
87  
88 =over
89  
90 =item * L<Langertha::Engine::MiniMax> - Recommended MiniMax engine (OpenAI-compatible endpoint)
91  
92 =item * L<https://platform.minimax.io/docs/api-reference/text-anthropic-api> - MiniMax Anthropic API docs
93  
94 =item * L<Langertha::Engine::AnthropicBase> - Anthropic-compatible base class
95  
96 =back
97  
98 =head1 SUPPORT
99  
100 =head2 Issues
101  
102 Please report bugs and feature requests on GitHub at
103 L<https://github.com/Getty/langertha/issues>.
104  
105 =head2 IRC
106  
107 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
108  
109 =head1 CONTRIBUTING
110  
111 Contributions are welcome! Please fork the repository and submit a pull request.
112  
113 =head1 AUTHOR
114  
115 Torsten Raudssus <getty@cpan.org>
116  
117 =head1 COPYRIGHT AND LICENSE
118  
119 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
120  
121 This is free software; you can redistribute it and/or modify it under
122 the same terms as the Perl 5 programming language system itself.
123  
124 =cut
« Langertha/Role/Models.pm ↑ Summary Langertha/Role/HermesTools.pm »