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
xdb4_94051
vllm
Commits
becd7a56
Unverified
Commit
becd7a56
authored
Aug 29, 2023
by
lplcor
Committed by
GitHub
Aug 29, 2023
Browse files
Enable request body OpenAPI spec for OpenAI endpoints (#865)
parent
75471386
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
vllm/entrypoints/openai/api_server.py
vllm/entrypoints/openai/api_server.py
+3
-4
No files found.
vllm/entrypoints/openai/api_server.py
View file @
becd7a56
...
@@ -178,7 +178,8 @@ def create_logprobs(token_ids: List[int],
...
@@ -178,7 +178,8 @@ def create_logprobs(token_ids: List[int],
@
app
.
post
(
"/v1/chat/completions"
)
@
app
.
post
(
"/v1/chat/completions"
)
async
def
create_chat_completion
(
raw_request
:
Request
):
async
def
create_chat_completion
(
request
:
ChatCompletionRequest
,
raw_request
:
Request
):
"""Completion API similar to OpenAI's API.
"""Completion API similar to OpenAI's API.
See https://platform.openai.com/docs/api-reference/chat/create
See https://platform.openai.com/docs/api-reference/chat/create
...
@@ -188,7 +189,6 @@ async def create_chat_completion(raw_request: Request):
...
@@ -188,7 +189,6 @@ async def create_chat_completion(raw_request: Request):
- function_call (Users should implement this by themselves)
- function_call (Users should implement this by themselves)
- logit_bias (to be supported by vLLM engine)
- logit_bias (to be supported by vLLM engine)
"""
"""
request
=
ChatCompletionRequest
(
**
await
raw_request
.
json
())
logger
.
info
(
f
"Received chat completion request:
{
request
}
"
)
logger
.
info
(
f
"Received chat completion request:
{
request
}
"
)
error_check_ret
=
await
check_model
(
request
)
error_check_ret
=
await
check_model
(
request
)
...
@@ -348,7 +348,7 @@ async def create_chat_completion(raw_request: Request):
...
@@ -348,7 +348,7 @@ async def create_chat_completion(raw_request: Request):
@
app
.
post
(
"/v1/completions"
)
@
app
.
post
(
"/v1/completions"
)
async
def
create_completion
(
raw_request
:
Request
):
async
def
create_completion
(
request
:
CompletionRequest
,
raw_request
:
Request
):
"""Completion API similar to OpenAI's API.
"""Completion API similar to OpenAI's API.
See https://platform.openai.com/docs/api-reference/completions/create
See https://platform.openai.com/docs/api-reference/completions/create
...
@@ -361,7 +361,6 @@ async def create_completion(raw_request: Request):
...
@@ -361,7 +361,6 @@ async def create_completion(raw_request: Request):
suffix)
suffix)
- logit_bias (to be supported by vLLM engine)
- logit_bias (to be supported by vLLM engine)
"""
"""
request
=
CompletionRequest
(
**
await
raw_request
.
json
())
logger
.
info
(
f
"Received completion request:
{
request
}
"
)
logger
.
info
(
f
"Received completion request:
{
request
}
"
)
error_check_ret
=
await
check_model
(
request
)
error_check_ret
=
await
check_model
(
request
)
...
...
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