__init__.py 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from dataclasses import dataclass
  2. from enum import Enum
  3. from typing import Optional, Union
  4. from aphrodite.common.sampling_params import SamplingParams
  5. from aphrodite.inputs import PromptInputs
  6. from aphrodite.lora.request import LoRARequest
  7. from aphrodite.prompt_adapter.request import PromptAdapterRequest
  8. APHRODITE_RPC_SUCCESS_STR = "SUCCESS"
  9. APHRODITE_RPC_HEALTHY_STR = "HEALTHY"
  10. @dataclass
  11. class RPCGenerateRequest:
  12. inputs: PromptInputs
  13. sampling_params: SamplingParams
  14. request_id: str
  15. lora_request: Optional[LoRARequest] = None
  16. prompt_adapter_request: Optional[PromptAdapterRequest] = None
  17. @dataclass
  18. class RPCAbortRequest:
  19. request_id: str
  20. class RPCUtilityRequest(Enum):
  21. IS_SERVER_READY = 1
  22. GET_MODEL_CONFIG = 2
  23. GET_DECODING_CONFIG = 3
  24. GET_PARALLEL_CONFIG = 4
  25. GET_SCHEDULER_CONFIG = 5
  26. GET_LORA_CONFIG = 6
  27. DO_LOG_STATS = 7
  28. CHECK_HEALTH = 8
  29. RPC_REQUEST_TYPE = Union[RPCGenerateRequest, RPCAbortRequest,
  30. RPCUtilityRequest]