main
py 69 lines 1.7 KB
Raw
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4 from fastapi import FastAPI
5
6 from vllm.logger import init_logger
7
8 from .exception_handling.error_response import create_error_response
9
10 logger = init_logger(__name__)
11
12 __all__ = [
13 "create_error_response",
14 "register_vllm_serve_api_routers",
15 "register_vllm_dev_api_routers",
16 ]
17
18
19 def register_vllm_serve_api_routers(app: FastAPI):
20 from .instrumentator import register_instrumentator_api_routers
21
22 register_instrumentator_api_routers(app)
23
24 from vllm.entrypoints.serve.lora.api_router import (
25 attach_router as attach_lora_router,
26 )
27
28 attach_lora_router(app)
29
30 from vllm.entrypoints.serve.profile.api_router import (
31 attach_router as attach_profile_router,
32 )
33
34 attach_profile_router(app)
35
36 from vllm.entrypoints.serve.tokenize.api_router import (
37 attach_router as attach_tokenize_router,
38 )
39
40 attach_tokenize_router(app)
41
42
43 def register_vllm_dev_api_routers(app: FastAPI):
44 logger.warning(
45 "SECURITY WARNING: Development endpoints are enabled! "
46 "This should NOT be used in production!"
47 )
48
49 from .dev.cache.api_router import attach_router as attach_cache_router
50
51 attach_cache_router(app)
52
53 from .dev.rlhf.api_router import attach_router as attach_rlhf_router
54
55 attach_rlhf_router(app)
56
57 from .dev.rpc.api_router import attach_router as attach_rpc_router
58
59 attach_rpc_router(app)
60
61 from .dev.server_info.api_router import (
62 attach_router as attach_server_info_router,
63 )
64
65 attach_server_info_router(app)
66
67 from .dev.sleep.api_router import attach_router as attach_sleep_router
68
69 attach_sleep_router(app)