Langertha/Engine/Anthropic.pm

filter: Statementstmt 86.6% 13 / 15 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 65.3% 17 / 26 CC 2 SCAR 9.8
CC
2
Cov
72%
_build_api_key
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« Langertha/Embedder.pm ↑ Summary Langertha/Pricing.pm »
1 package Langertha::Engine::Anthropic;
2 # ABSTRACT: Anthropic API
3 15 our $VERSION = '0.502';
4 15 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 15 extends 'Langertha::Engine::AnthropicBase';
8  
9  
10 has '+url' => (
11 lazy => 1,
12 6 ▶ default => sub { 'https://api.anthropic.com' },
Subroutine __ANON__: called CC=1 SCAR=0.0
13 15 );
14  
15 sub _build_api_key {
16 0 ▶ my ( $self ) = @_;
Subroutine _build_api_key: not called CC=2 SCAR=17.9
17 return $ENV{LANGERTHA_ANTHROPIC_API_KEY}
18 0 ▶ || croak "".(ref $self)." requires LANGERTHA_ANTHROPIC_API_KEY or api_key set";
Condition0%0/3
$ENV{'LANGERTHA_ANTHROPIC_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_ANTHROPIC_API_KEY or api_key set')
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{'LANGERTHA_ANTHROPIC_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_ANTHROPIC_API_KEY or api_key set')
$ENV{'LANGERTHA_ANTHROPIC_API_KEY'} croak('' . ref($self) . ' requires LANGERTHA_ANTHROPIC_API_KEY or api_key set')
Truth table0%0/3
A || B
A= $ENV{'LANGERTHA_ANTHROPIC_API_KEY'}B= croak('' . ref($self) . ' requires LANGERTHA_ANTHROPIC_API_KEY or api_key set')
ABresult
1X1
011
000
19 }
20  
21 2 ▶sub default_model { 'claude-sonnet-4-6' }
Subroutine default_model: called CC=1 SCAR=0.0
Pod undocumented
22  
23 15 __PACKAGE__->meta->make_immutable;
24  
25  
26 15 1;
27  
28 __END__
29  
30 =pod
31  
32 =encoding UTF-8
33  
34 =head1 NAME
35  
36 Langertha::Engine::Anthropic - Anthropic API
37  
38 =head1 VERSION
39  
40 version 0.502
41  
42 =head1 SYNOPSIS
43  
44 use Langertha::Engine::Anthropic;
45  
46 my $claude = Langertha::Engine::Anthropic->new(
47 api_key => $ENV{ANTHROPIC_API_KEY},
48 model => 'claude-sonnet-4-6',
49 );
50  
51 print $claude->simple_chat('Generate Perl Moose classes for GeoJSON');
52  
53 =head1 DESCRIPTION
54  
55 Concrete Anthropic engine for Claude models. Inherits shared
56 Anthropic-compatible behavior from L<Langertha::Engine::AnthropicBase> and
57 provides Anthropic cloud defaults (URL, API key env var, default model).
58  
59 B<THIS API IS WORK IN PROGRESS>
60  
61 =head1 SEE ALSO
62  
63 =over
64  
65 =item * L<Langertha::Engine::AnthropicBase> - Shared Anthropic-compatible implementation
66  
67 =item * L<Langertha::Engine::MiniMax> - Anthropic-compatible MiniMax engine
68  
69 =item * L<Langertha::Engine::LMStudioAnthropic> - Anthropic-compatible LM Studio engine
70  
71 =back
72  
73 =head1 SUPPORT
74  
75 =head2 Issues
76  
77 Please report bugs and feature requests on GitHub at
78 L<https://github.com/Getty/langertha/issues>.
79  
80 =head2 IRC
81  
82 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
83  
84 =head1 CONTRIBUTING
85  
86 Contributions are welcome! Please fork the repository and submit a pull request.
87  
88 =head1 AUTHOR
89  
90 Torsten Raudssus <getty@cpan.org>
91  
92 =head1 COPYRIGHT AND LICENSE
93  
94 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
95  
96 This is free software; you can redistribute it and/or modify it under
97 the same terms as the Perl 5 programming language system itself.
98  
99 =cut
« Langertha/Embedder.pm ↑ Summary Langertha/Pricing.pm »