| 1 | package Langertha::Engine::Scaleway; | ||||||||||||||||||||
| 2 | # ABSTRACT: Scaleway Generative APIs | ||||||||||||||||||||
| 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::Embedding', 'Langertha::Role::Tools'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | has '+url' => ( | ||||||||||||||||||||
| 13 | lazy => 1, | ||||||||||||||||||||
| 14 | 2 | ▶ | default => sub { 'https://api.scaleway.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_SCALEWAY_API_KEY} | ||||||||||||||||||||
| 20 | 1 | ▶ | || croak "".(ref $self)." requires LANGERTHA_SCALEWAY_API_KEY or api_key set"; | ||||||||||||||||||
|
Condition33%1/3
$ENV{'LANGERTHA_SCALEWAY_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_SCALEWAY_API_KEY or api_key set')
MC/DC0%0/2
$ENV{'LANGERTHA_SCALEWAY_API_KEY'} || croak('' . ref($self) . ' requires LANGERTHA_SCALEWAY_API_KEY or api_key set')
$ENV{'LANGERTHA_SCALEWAY_API_KEY'}
croak('' . ref($self) . ' requires LANGERTHA_SCALEWAY_API_KEY or api_key set')
Truth table33%1/3
A || B
A= $ENV{'LANGERTHA_SCALEWAY_API_KEY'}B= croak('' . ref($self) . ' requires LANGERTHA_SCALEWAY_API_KEY or api_key set')
| |||||||||||||||||||||
| 21 | } | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 1 | ▶ | sub default_model { 'llama-3.1-8b-instruct' } | ||||||||||||||||||
|
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 | createEmbedding | ||||||||||||||||||||
| 28 | )]} | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 3 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 3 | 1; | |||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | __END__ | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | =pod | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | =encoding UTF-8 | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | =head1 NAME | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | Langertha::Engine::Scaleway - Scaleway Generative APIs | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | =head1 VERSION | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | version 0.502 | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | =head1 SYNOPSIS | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | use Langertha::Engine::Scaleway; | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | my $scw = Langertha::Engine::Scaleway->new( | ||||||||||||||||||||
| 54 | api_key => $ENV{LANGERTHA_SCALEWAY_API_KEY}, | ||||||||||||||||||||
| 55 | model => 'llama-3.1-8b-instruct', | ||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | print $scw->simple_chat('Hello from Scaleway!'); | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | =head1 DESCRIPTION | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | Provides access to B<Scaleway Generative APIs>, a serverless inference service | ||||||||||||||||||||
| 63 | hosted in European data centers. Composes L<Langertha::Role::OpenAICompatible> | ||||||||||||||||||||
| 64 | with Scaleway's endpoint (C<https://api.scaleway.ai/v1>) and Bearer auth. | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | Scaleway is designed as a drop-in replacement for the OpenAI API and is | ||||||||||||||||||||
| 67 | EU-act compliant. Available chat models include C<llama-3.1-8b-instruct> | ||||||||||||||||||||
| 68 | (default), C<llama-3.3-70b-instruct>, C<mistral-small-3.1-24b-instruct-2503>, | ||||||||||||||||||||
| 69 | C<gemma-3-27b-it> and others. Function calling, structured output and | ||||||||||||||||||||
| 70 | embeddings are supported. | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | If you want to scope requests to a specific Scaleway project, override C<url> | ||||||||||||||||||||
| 73 | with C<https://api.scaleway.ai/E<lt>PROJECT_IDE<gt>/v1>. | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | Generate an API secret key in the Scaleway console | ||||||||||||||||||||
| 76 | (L<https://console.scaleway.com/>) and set C<LANGERTHA_SCALEWAY_API_KEY>. | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | B<THIS API IS WORK IN PROGRESS> | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | =head1 SEE ALSO | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | =over | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | =item * L<https://www.scaleway.com/en/docs/generative-apis/> - Scaleway Generative APIs documentation | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | =item * L<https://www.scaleway.com/en/generative-apis/> - Scaleway Generative APIs product page | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | =item * L<Langertha::Role::OpenAICompatible> - OpenAI API format role | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | =back | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | =head1 SUPPORT | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | =head2 Issues | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | Please report bugs and feature requests on GitHub at | ||||||||||||||||||||
| 97 | L<https://github.com/Getty/langertha/issues>. | ||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | =head2 IRC | ||||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | Join C<#langertha> on C<irc.perl.org> or message Getty directly. | ||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | =head1 CONTRIBUTING | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | =head1 AUTHOR | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | Torsten Raudssus <getty@cpan.org> | ||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>. | ||||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 116 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | =cut | ||||||||||||||||||||