Langertha/Engine/LlamaCpp.pm

filter: Statementstmt 92.8% 13 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 50.0% 1 / 2 totaltotal 85.7% 18 / 21 CC 1 SCAR 1.8
CC
1
Cov
93%
default_embedding_model
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Langertha/Output.pm ↑ Summary Langertha/Engine/TranscriptionBase.pm »
1 package Langertha::Engine::LlamaCpp;
2 # ABSTRACT: llama.cpp server
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 2 ▶sub default_model { 'default' }
Subroutine default_model: called CC=1 SCAR=0.0
Pod documented
13 0 ▶sub default_embedding_model { 'default' }
Subroutine default_embedding_model: not called CC=1 SCAR=6.9
Pod undocumented
14  
15 2 ▶sub _build_supported_operations {[qw(
Subroutine _build_supported_operations: called CC=1 SCAR=0.0
16 createChatCompletion
17 createEmbedding
18 )]}
19  
20 3 __PACKAGE__->meta->make_immutable;
21  
22  
23 3 1;
24  
25 __END__
26  
27 =pod
28  
29 =encoding UTF-8
30  
31 =head1 NAME
32  
33 Langertha::Engine::LlamaCpp - llama.cpp server
34  
35 =head1 VERSION
36  
37 version 0.502
38  
39 =head1 SYNOPSIS
40  
41 use Langertha::Engine::LlamaCpp;
42  
43 my $llama = Langertha::Engine::LlamaCpp->new(
44 url => 'http://localhost:8080/v1',
45 system_prompt => 'You are a helpful assistant',
46 );
47  
48 print $llama->simple_chat('Hello!');
49  
50 my $embedding = $llama->simple_embedding('Some text');
51  
52 =head1 DESCRIPTION
53  
54 Provides access to llama.cpp's built-in HTTP server, which exposes an
55 OpenAI-compatible API. Composes L<Langertha::Role::OpenAICompatible>.
56  
57 Only C<url> is required. The URL must include the C</v1> path prefix
58 (e.g., C<http://localhost:8080/v1>). Since llama.cpp serves exactly one
59 model (loaded at server startup), no model name or API key is needed.
60  
61 Supports chat, streaming, embeddings, and MCP tool calling.
62  
63 See L<https://github.com/ggml-org/llama.cpp/blob/master/examples/server/README.md>
64 for server setup.
65  
66 B<THIS API IS WORK IN PROGRESS>
67  
68 =head1 SEE ALSO
69  
70 =over
71  
72 =item * L<https://github.com/ggml-org/llama.cpp> - llama.cpp project
73  
74 =item * L<Langertha::Engine::vLLM> - Another self-hosted OpenAI-compatible engine
75  
76 =item * L<Langertha::Engine::OllamaOpenAI> - Ollama's OpenAI-compatible API
77  
78 =back
79  
80 =head1 SUPPORT
81  
82 =head2 Issues
83  
84 Please report bugs and feature requests on GitHub at
85 L<https://github.com/Getty/langertha/issues>.
86  
87 =head2 IRC
88  
89 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
90  
91 =head1 CONTRIBUTING
92  
93 Contributions are welcome! Please fork the repository and submit a pull request.
94  
95 =head1 AUTHOR
96  
97 Torsten Raudssus <getty@cpan.org>
98  
99 =head1 COPYRIGHT AND LICENSE
100  
101 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
102  
103 This is free software; you can redistribute it and/or modify it under
104 the same terms as the Perl 5 programming language system itself.
105  
106 =cut
« Langertha/Output.pm ↑ Summary Langertha/Engine/TranscriptionBase.pm »