mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-07-09 15:37:12 +08:00
Add /health Endpoint for both Servers (#1540)
This commit is contained in:
parent
5687d584fe
commit
7e90a2d117
@ -17,6 +17,12 @@ app = FastAPI()
|
|||||||
engine = None
|
engine = None
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/health")
|
||||||
|
async def health() -> Response:
|
||||||
|
"""Health check."""
|
||||||
|
return Response(status_code=200)
|
||||||
|
|
||||||
|
|
||||||
@app.post("/generate")
|
@app.post("/generate")
|
||||||
async def generate(request: Request) -> Response:
|
async def generate(request: Request) -> Response:
|
||||||
"""Generate completion for the request.
|
"""Generate completion for the request.
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import uvicorn
|
|||||||
from fastapi import Request
|
from fastapi import Request
|
||||||
from fastapi.exceptions import RequestValidationError
|
from fastapi.exceptions import RequestValidationError
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse, Response
|
||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
from vllm.engine.arg_utils import AsyncEngineArgs
|
from vllm.engine.arg_utils import AsyncEngineArgs
|
||||||
@ -145,6 +145,12 @@ async def check_length(
|
|||||||
return input_ids, None
|
return input_ids, None
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/health")
|
||||||
|
async def health() -> Response:
|
||||||
|
"""Health check."""
|
||||||
|
return Response(status_code=200)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/v1/models")
|
@app.get("/v1/models")
|
||||||
async def show_available_models():
|
async def show_available_models():
|
||||||
"""Show available models. Right now we only have one model."""
|
"""Show available models. Right now we only have one model."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user