request.py 907 Bytes
Newer Older
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3

4
import msgspec
5
6
7
8

from vllm.adapter_commons.request import AdapterRequest


9
10
11
12
13
class PromptAdapterRequest(
        msgspec.Struct,
        array_like=True,  # type: ignore[call-arg]
        omit_defaults=True,  # type: ignore[call-arg]
        frozen=True):  # type: ignore[call-arg]
14
15
16
    """
    Request for a Prompt adapter.
    """
17
    __metaclass__ = AdapterRequest
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

    prompt_adapter_name: str
    prompt_adapter_id: int
    prompt_adapter_local_path: str
    prompt_adapter_num_virtual_tokens: int

    def __hash__(self):
        return super().__hash__()

    @property
    def adapter_id(self):
        return self.prompt_adapter_id

    @property
    def name(self):
        return self.prompt_adapter_name

    @property
    def local_path(self):
        return self.prompt_adapter_local_path