Langertha/Engine/TranscriptionBase.pm

filter: Statementstmt 94.4% 17 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 88.0% 22 / 25 CC 1 SCAR 1.5
CC
1
Cov
94%
default_model
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Langertha/Engine/LlamaCpp.pm ↑ Summary Langertha/UsageRecord.pm »
1 package Langertha::Engine::TranscriptionBase;
2 # ABSTRACT: Base class for OpenAI-compatible transcription-only engines
3 26 our $VERSION = '0.502';
4 26 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 26 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 26 ▶use Module::Runtime qw( use_module );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 26 extends 'Langertha::Engine::Remote';
9  
10 26 with map { 'Langertha::Role::'.$_ } qw(
11 OpenAICompatible
12 OpenAPI
13 Models
14 Transcription
15 Capabilities
16 );
17  
18 sub _build_openapi_operations {
19 1 ▶ return use_module('Langertha::Spec::OpenAI')->data;
Subroutine _build_openapi_operations: called CC=1 SCAR=0.0
20 }
21  
22 1 ▶sub _build_supported_operations {[qw(
Subroutine _build_supported_operations: called CC=1 SCAR=0.0
23 createTranscription
24 createTranslation
25 )]}
26  
27  
28 0 ▶sub default_model { croak "".(ref $_[0])." requires transcription_model to be set" }
Subroutine default_model: not called CC=1 SCAR=6.9
Pod undocumented
29  
30 26 __PACKAGE__->meta->make_immutable;
31  
32  
33 26 1;
34  
35 __END__
36  
37 =pod
38  
39 =encoding UTF-8
40  
41 =head1 NAME
42  
43 Langertha::Engine::TranscriptionBase - Base class for OpenAI-compatible transcription-only engines
44  
45 =head1 VERSION
46  
47 version 0.502
48  
49 =head1 SYNOPSIS
50  
51 package My::TranscriptionEngine;
52 use Moose;
53 extends 'Langertha::Engine::TranscriptionBase';
54  
55 has '+url' => ( default => 'https://api.example.com/v1' );
56  
57 sub _build_api_key { $ENV{MY_API_KEY} || die "MY_API_KEY required" }
58 sub default_model { 'whisper-1' }
59  
60 __PACKAGE__->meta->make_immutable;
61  
62 =head1 DESCRIPTION
63  
64 Slim base class for engines that only do audio transcription via the
65 OpenAI-shape C</audio/transcriptions> + C</audio/translations>
66 endpoints. Unlike L<Langertha::Engine::OpenAIBase>, this does not
67 compose L<Langertha::Role::Chat> / L<Langertha::Role::Tools> /
68 L<Langertha::Role::Embedding> / L<Langertha::Role::ImageGeneration>
69 — callers get a focused object with C<simple_transcription> and
70 nothing else.
71  
72 L<Langertha::Engine::Whisper> is the canonical concrete subclass for
73 self-hosted Whisper servers; L<Langertha::Engine::OpenAI> exposes a
74 C<whisper> attribute that returns a TranscriptionBase configured for
75 the OpenAI cloud (sharing the parent's C<api_key> and C<url>) so
76 chat-side code can grab a transcription handle without re-stating the
77 credentials.
78  
79 =head1 SEE ALSO
80  
81 =over
82  
83 =item * L<Langertha::Engine::Whisper> - Self-hosted Whisper-compatible server
84  
85 =item * L<Langertha::Engine::OpenAI> - Provides a C<whisper> handle reusing its credentials
86  
87 =item * L<Langertha::Role::Transcription> - The role this base composes
88  
89 =back
90  
91 =head1 SUPPORT
92  
93 =head2 Issues
94  
95 Please report bugs and feature requests on GitHub at
96 L<https://github.com/Getty/langertha/issues>.
97  
98 =head2 IRC
99  
100 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
101  
102 =head1 CONTRIBUTING
103  
104 Contributions are welcome! Please fork the repository and submit a pull request.
105  
106 =head1 AUTHOR
107  
108 Torsten Raudssus <getty@cpan.org>
109  
110 =head1 COPYRIGHT AND LICENSE
111  
112 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
113  
114 This is free software; you can redistribute it and/or modify it under
115 the same terms as the Perl 5 programming language system itself.
116  
117 =cut
« Langertha/Engine/LlamaCpp.pm ↑ Summary Langertha/UsageRecord.pm »