blib/lib/Langertha/Engine/vLLM.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 66.6% 2 / 3 totaltotal 97.2% 35 / 36 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
_build_knob_wire_format
1.0
CRAP 1.0
« blib/lib/Langertha/Cost.pm ↑ Summary blib/lib/Langertha/Engine/Mock.pm »
1 package Langertha::Engine::vLLM;
2 # ABSTRACT: vLLM inference server
3 34 our $VERSION = '0.505';
4 34 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 34 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 34 extends 'Langertha::Engine::OpenAIBase';
8  
9 # StreamUsage: ChatCompletionRequest has stream_options.include_usage
10 # (vllm/entrypoints/openai/chat_completion/protocol.py, ADR 0038).
11 34 with 'Langertha::Role::Tools',
12 'Langertha::Role::Embedding',
13 'Langertha::Role::Runtime::MetricsPoll',
14 'Langertha::Role::RuntimeKnobs',
15 'Langertha::Role::StreamUsage';
16  
17 # vLLM's only per-request runtime knob is cache_salt (prefix-cache isolation,
18 # vLLM v1.x+). Speculative decoding is a server-launch flag
19 # (--speculative-config), not a request knob — see Langertha::Runtime::Knobs.
20 3 ▶sub _build_knob_wire_format { 'vllm' }
Subroutine _build_knob_wire_format: called CC=1 SCAR=0.0
21  
22 # prompt_cache_key (OpenAI's cache-routing hint) is not a field of vLLM's
23 # ChatCompletionRequest: the pydantic model accepts extra keys and ignores them
24 # with a debug log (vllm/entrypoints/serve/engine/protocol.py; only the
25 # /v1/responses protocol declares it; checked 2026-09-25, karr #200). The
26 # prefix-cache lever here is cache_salt via RuntimeKnobs, so clear the flag
27 # (ADR 0002 layer 2). VLLMHook inherits this.
28 420 ▶around engine_capabilities => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
29 420 my ( $orig, $self, @rest ) = @_;
30 420 my $caps = $self->$orig(@rest);
31 420 delete $caps->{prompt_cache_key};
32 # image_input (k266, ADR 0019): self-hosted: the served model is launch state the client cannot see, so no claim.
33 420 delete $caps->{image_input};
34 420 return $caps;
35 34 };
36  
37  
38 34 has '+url' => (
39 required => 1,
40 );
41  
42 65 ▶sub default_model { 'default' }
Subroutine default_model: called CC=1 SCAR=0.0
Pod documented
43 # No fixed embedding model: the caller's model, else no model field (k297).
44 14 ▶sub default_embedding_model { undef }
Subroutine default_embedding_model: called CC=1 SCAR=0.0
Pod undocumented
45  
46 # LANGERTHA_VLLM_API_KEY is derived from the class name; a local server needs
47 # no key, a --api-key-protected `vllm serve` does.
48 8 ▶sub api_key_required { 0 }
Subroutine api_key_required: called CC=1 SCAR=0.0
Pod documented
49  
50 38 ▶sub _build_api_key {
Subroutine _build_api_key: called CC=1 SCAR=0.0
51 38 return $ENV{LANGERTHA_VLLM_API_KEY};
52 }
53  
54 105 ▶sub _build_supported_operations {[qw(
Subroutine _build_supported_operations: called CC=1 SCAR=0.0
55 createChatCompletion
56 createCompletion
57 createEmbedding
58 )]}
59  
60 34 __PACKAGE__->meta->make_immutable;
61  
62  
63  
64 34 1;
65  
66 __END__
« blib/lib/Langertha/Cost.pm ↑ Summary blib/lib/Langertha/Engine/Mock.pm »