Unverified Commit 30399cc7 authored by Jee Jee Li's avatar Jee Jee Li Committed by GitHub
Browse files

UX: add vLLM env info in '/server_info' (#31899)


Signed-off-by: default avatarJee Jee Li <pandaleefree@gmail.com>
parent b89443b8
......@@ -19,6 +19,19 @@ router = APIRouter()
PydanticVllmConfig = pydantic.TypeAdapter(VllmConfig)
def _get_vllm_env_vars():
from vllm.config.utils import normalize_value
vllm_envs = {}
for key in dir(envs):
if key.startswith("VLLM_") and "KEY" not in key:
value = getattr(envs, key, None)
if value is not None:
value = normalize_value(value)
vllm_envs[key] = value
return vllm_envs
@router.get("/server_info")
async def show_server_info(
raw_request: Request,
......@@ -26,10 +39,13 @@ async def show_server_info(
):
vllm_config: VllmConfig = raw_request.app.state.vllm_config
server_info = {
"vllm_config": str(vllm_config)
"vllm_config": (
str(vllm_config)
if config_format == "text"
else PydanticVllmConfig.dump_python(vllm_config, mode="json", fallback=str)
),
# fallback=str is needed to handle e.g. torch.dtype
"vllm_env": _get_vllm_env_vars(),
}
return JSONResponse(content=server_info)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment