| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 3 | |
| 4 | from typing import Any |
| 5 | |
| 6 | import msgspec |
| 7 | |
| 8 | |
| 9 | class KvHintAction(msgspec.Struct, frozen=True): # type: ignore[call-arg] |
| 10 | """A versioned orchestrator-provided KV hint action.""" |
| 11 | |
| 12 | action_id: str |
| 13 | action_type: str |
| 14 | action_version: str |
| 15 | # `payload` must contain JSON-compatible values. Action-specific schemas are |
| 16 | # validated by the component implementing the action. |
| 17 | payload: dict[str, Any] |
| 18 | |
| 19 | |
| 20 | class KvHintsEnvelope(msgspec.Struct, frozen=True): # type: ignore[call-arg] |
| 21 | """Orchestrator-provided KV hints optionally attached to one inference request. |
| 22 | A KV hint envelope is a collection of KV hint action(s).""" |
| 23 | |
| 24 | protocol_version: str |
| 25 | message_id: str |
| 26 | actions: list[KvHintAction] |