Langertha/Engine/Cerebras.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 86.2% 25 / 29 CC 2 SCAR 3.1
CC
2
Cov
90%
_build_api_key
2.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Langertha/Engine/AKIOpenAI.pm ↑ Summary Langertha/Engine/DeepSeek.pm »
1 package Langertha::Engine::Cerebras;
2 # ABSTRACT: Cerebras Inference API
3 3 our $VERSION = '0.502';
4 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 extends 'Langertha::Engine::OpenAIBase';
8  
9 3 with 'Langertha::Role::Tools';
10  
11  
12 has '+url' => (
13 lazy => 1,
14 2 ▶ default => sub { 'https://api.cerebras.ai/v1' },
Subroutine __ANON__: called CC=1 SCAR=0.0
15 3 );
16  
17 sub _build_api_key {
18 1 ▶ my ( $self ) = @_;
Subroutine _build_api_key: called CC=2 SCAR=8.1
19 return $ENV{LANGERTHA_CEREBRAS_API_KEY}
20 1 ▶ || croak "".(ref $self)." requires LANGERTHA_CEREBRAS_API_KEY or api_key set";
Condition33%1/3
$ENV{'LANGERTHA_CEREBRAS_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_CEREBRAS_API_KEY or api_key set')
l!l&&r!l&&!r
100
MC/DC0%0/2
$ENV{'LANGERTHA_CEREBRAS_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_CEREBRAS_API_KEY or api_key set')
$ENV{'LANGERTHA_CEREBRAS_API_KEY'} croak('' . ref($self) . ' requires LANGERTHA_CEREBRAS_API_KEY or api_key set')
Truth table33%1/3
A || B
A= $ENV{'LANGERTHA_CEREBRAS_API_KEY'}B= croak('' . ref($self) . ' requires LANGERTHA_CEREBRAS_API_KEY or api_key set')
ABresult
1X1
011
000
21 }
22  
23 1 ▶sub default_model { 'llama3.1-8b' }
Subroutine default_model: called CC=1 SCAR=0.0
Pod documented
24  
25 1 ▶sub _build_supported_operations {[qw(
Subroutine _build_supported_operations: called CC=1 SCAR=0.0
26 createChatCompletion
27 )]}
28  
29 3 __PACKAGE__->meta->make_immutable;
30  
31  
32 3 1;
33  
34 __END__
35  
36 =pod
37  
38 =encoding UTF-8
39  
40 =head1 NAME
41  
42 Langertha::Engine::Cerebras - Cerebras Inference API
43  
44 =head1 VERSION
45  
46 version 0.502
47  
48 =head1 SYNOPSIS
49  
50 use Langertha::Engine::Cerebras;
51  
52 my $cerebras = Langertha::Engine::Cerebras->new(
53 api_key => $ENV{CEREBRAS_API_KEY},
54 model => 'llama-3.3-70b',
55 );
56  
57 print $cerebras->simple_chat('Hello from Perl!');
58  
59 =head1 DESCRIPTION
60  
61 Provides access to Cerebras Inference, the fastest AI inference platform.
62 Composes L<Langertha::Role::OpenAICompatible> with Cerebras's endpoint
63 (C<https://api.cerebras.ai/v1>) and API key handling.
64  
65 Cerebras uses custom wafer-scale chips to deliver extremely fast inference
66 speeds. Available models include C<llama3.1-8b> (default), C<qwen-3-235b-a22b-instruct-2507>,
67 and C<gpt-oss-120b>.
68  
69 Supports chat, streaming, and MCP tool calling. Embeddings and transcription
70 are not supported.
71  
72 Get your API key at L<https://cloud.cerebras.ai/> and set
73 C<LANGERTHA_CEREBRAS_API_KEY> in your environment.
74  
75 B<THIS API IS WORK IN PROGRESS>
76  
77 =head1 SEE ALSO
78  
79 =over
80  
81 =item * L<https://status.cerebras.ai/> - Cerebras service status
82  
83 =item * L<https://inference-docs.cerebras.ai/> - Cerebras Inference documentation
84  
85 =item * L<Langertha::Role::OpenAICompatible> - OpenAI API format role
86  
87 =back
88  
89 =head1 SUPPORT
90  
91 =head2 Issues
92  
93 Please report bugs and feature requests on GitHub at
94 L<https://github.com/Getty/langertha/issues>.
95  
96 =head2 IRC
97  
98 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
99  
100 =head1 CONTRIBUTING
101  
102 Contributions are welcome! Please fork the repository and submit a pull request.
103  
104 =head1 AUTHOR
105  
106 Torsten Raudssus <getty@cpan.org>
107  
108 =head1 COPYRIGHT AND LICENSE
109  
110 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
111  
112 This is free software; you can redistribute it and/or modify it under
113 the same terms as the Perl 5 programming language system itself.
114  
115 =cut
« Langertha/Engine/AKIOpenAI.pm ↑ Summary Langertha/Engine/DeepSeek.pm »