Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
norm
vllm
Commits
7e90a2d1
Unverified
Commit
7e90a2d1
authored
Nov 01, 2023
by
Fluder-Paradyne
Committed by
GitHub
Nov 01, 2023
Browse files
Add `/health` Endpoint for both Servers (#1540)
parent
5687d584
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
vllm/entrypoints/api_server.py
vllm/entrypoints/api_server.py
+6
-0
vllm/entrypoints/openai/api_server.py
vllm/entrypoints/openai/api_server.py
+7
-1
No files found.
vllm/entrypoints/api_server.py
View file @
7e90a2d1
...
@@ -17,6 +17,12 @@ app = FastAPI()
...
@@ -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.
...
...
vllm/entrypoints/openai/api_server.py
View file @
7e90a2d1
...
@@ -13,7 +13,7 @@ import uvicorn
...
@@ -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(
...
@@ -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."""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment