Langertha/Engine/vLLM.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 19 / 19 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
default_model
1.0
CRAP 1.0
« Langertha/Engine/SGLang.pm ↑ Summary Langertha/Raid/Sequential.pm »
1 package Langertha::Engine::vLLM;
2 # ABSTRACT: vLLM inference server
3 6 our $VERSION = '0.502';
4 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 extends 'Langertha::Engine::OpenAIBase';
8  
9 6 with 'Langertha::Role::Tools';
10  
11  
12 6 has '+url' => (
13 required => 1,
14 );
15  
16 5 ▶sub default_model { 'default' }
Subroutine default_model: called CC=1 SCAR=0.0
Pod documented
17  
18 4 ▶sub _build_supported_operations {[qw(
Subroutine _build_supported_operations: called CC=1 SCAR=0.0
19 createChatCompletion
20 createCompletion
21 )]}
22  
23 6 __PACKAGE__->meta->make_immutable;
24  
25  
26 6 1;
27  
28 __END__
29  
30 =pod
31  
32 =encoding UTF-8
33  
34 =head1 NAME
35  
36 Langertha::Engine::vLLM - vLLM inference server
37  
38 =head1 VERSION
39  
40 version 0.502
41  
42 =head1 SYNOPSIS
43  
44 use Langertha::Engine::vLLM;
45  
46 my $vllm = Langertha::Engine::vLLM->new(
47 url => 'http://localhost:8000/v1',
48 system_prompt => 'You are a helpful assistant',
49 );
50  
51 print $vllm->simple_chat('Say something nice');
52  
53 # MCP tool calling (requires server started with tool-call-parser)
54 use Future::AsyncAwait;
55  
56 my $vllm = Langertha::Engine::vLLM->new(
57 url => 'http://localhost:8000/v1',
58 model => 'Qwen/Qwen2.5-3B-Instruct',
59 mcp_servers => [$mcp],
60 );
61  
62 my $response = await $vllm->chat_with_tools_f('Add 7 and 15');
63  
64 =head1 DESCRIPTION
65  
66 Provides access to vLLM, a high-throughput inference engine for large
67 language models. Composes L<Langertha::Role::OpenAICompatible> since vLLM
68 exposes an OpenAI-compatible API.
69  
70 Only C<url> is required. The URL must include the C</v1> path prefix
71 (e.g., C<http://localhost:8000/v1>). Since vLLM serves exactly one model
72 (configured at server startup), no model name or API key is needed.
73  
74 MCP tool calling requires the vLLM server to be started with
75 C<--enable-auto-tool-choice> and C<--tool-call-parser> matching the model
76 (C<hermes> for Qwen2.5/Hermes, C<llama3> for Llama, C<mistral> for Mistral).
77  
78 See L<https://docs.vllm.ai/> for installation and configuration details.
79  
80 B<THIS API IS WORK IN PROGRESS>
81  
82 =head1 SEE ALSO
83  
84 =over
85  
86 =item * L<https://docs.vllm.ai/> - vLLM documentation
87  
88 =item * L<Langertha::Role::OpenAICompatible> - OpenAI API format role
89  
90 =item * L<Langertha::Role::Tools> - MCP tool calling interface
91  
92 =item * L<Langertha::Engine::OllamaOpenAI> - Another self-hosted OpenAI-compatible engine
93  
94 =back
95  
96 =head1 SUPPORT
97  
98 =head2 Issues
99  
100 Please report bugs and feature requests on GitHub at
101 L<https://github.com/Getty/langertha/issues>.
102  
103 =head2 IRC
104  
105 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
106  
107 =head1 CONTRIBUTING
108  
109 Contributions are welcome! Please fork the repository and submit a pull request.
110  
111 =head1 AUTHOR
112  
113 Torsten Raudssus <getty@cpan.org>
114  
115 =head1 COPYRIGHT AND LICENSE
116  
117 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
118  
119 This is free software; you can redistribute it and/or modify it under
120 the same terms as the Perl 5 programming language system itself.
121  
122 =cut
« Langertha/Engine/SGLang.pm ↑ Summary Langertha/Raid/Sequential.pm »