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
be54f8e5
Unverified
Commit
be54f8e5
authored
Jul 06, 2023
by
Nicolas Frenay
Committed by
GitHub
Jul 06, 2023
Browse files
[Fix] Change /generate response-type to json for non-streaming (#374)
parent
b396cb49
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
vllm/entrypoints/api_server.py
vllm/entrypoints/api_server.py
+2
-2
No files found.
vllm/entrypoints/api_server.py
View file @
be54f8e5
...
@@ -3,7 +3,7 @@ import json
...
@@ -3,7 +3,7 @@ import json
from
typing
import
AsyncGenerator
from
typing
import
AsyncGenerator
from
fastapi
import
BackgroundTasks
,
FastAPI
,
Request
from
fastapi
import
BackgroundTasks
,
FastAPI
,
Request
from
fastapi.responses
import
Response
,
StreamingResponse
from
fastapi.responses
import
JSONResponse
,
Response
,
StreamingResponse
import
uvicorn
import
uvicorn
from
vllm.engine.arg_utils
import
AsyncEngineArgs
from
vllm.engine.arg_utils
import
AsyncEngineArgs
...
@@ -64,7 +64,7 @@ async def generate(request: Request) -> Response:
...
@@ -64,7 +64,7 @@ async def generate(request: Request) -> Response:
prompt
=
final_output
.
prompt
prompt
=
final_output
.
prompt
text_outputs
=
[
prompt
+
output
.
text
for
output
in
final_output
.
outputs
]
text_outputs
=
[
prompt
+
output
.
text
for
output
in
final_output
.
outputs
]
ret
=
{
"text"
:
text_outputs
}
ret
=
{
"text"
:
text_outputs
}
return
Response
(
content
=
json
.
dumps
(
ret
)
)
return
JSON
Response
(
ret
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
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