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
change
sglang
Commits
d33955d2
"vscode:/vscode.git/clone" did not exist on "c4eaf67c65e61da98d24238187796cccd455f2e4"
Unverified
Commit
d33955d2
authored
May 01, 2025
by
KCFindstr
Committed by
GitHub
May 01, 2025
Browse files
Properly return error response in vertex_generate HTTP endpoint (#5956)
parent
6fc17596
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
python/sglang/srt/entrypoints/http_server.py
python/sglang/srt/entrypoints/http_server.py
+2
-0
test/srt/test_vertex_endpoint.py
test/srt/test_vertex_endpoint.py
+10
-0
No files found.
python/sglang/srt/entrypoints/http_server.py
View file @
d33955d2
...
@@ -675,6 +675,8 @@ async def vertex_generate(vertex_req: VertexGenerateReqInput, raw_request: Reque
...
@@ -675,6 +675,8 @@ async def vertex_generate(vertex_req: VertexGenerateReqInput, raw_request: Reque
**
(
vertex_req
.
parameters
or
{}),
**
(
vertex_req
.
parameters
or
{}),
)
)
ret
=
await
generate_request
(
req
,
raw_request
)
ret
=
await
generate_request
(
req
,
raw_request
)
if
isinstance
(
ret
,
Response
):
return
ret
return
ORJSONResponse
({
"predictions"
:
ret
})
return
ORJSONResponse
({
"predictions"
:
ret
})
...
...
test/srt/test_vertex_endpoint.py
View file @
d33955d2
...
@@ -3,6 +3,7 @@ python3 -m unittest test_vertex_endpoint.TestVertexEndpoint.test_vertex_generate
...
@@ -3,6 +3,7 @@ python3 -m unittest test_vertex_endpoint.TestVertexEndpoint.test_vertex_generate
"""
"""
import
unittest
import
unittest
from
http
import
HTTPStatus
import
requests
import
requests
...
@@ -49,6 +50,15 @@ class TestVertexEndpoint(CustomTestCase):
...
@@ -49,6 +50,15 @@ class TestVertexEndpoint(CustomTestCase):
for
parameters
in
[
None
,
{
"sampling_params"
:
{
"max_new_tokens"
:
4
}}]:
for
parameters
in
[
None
,
{
"sampling_params"
:
{
"max_new_tokens"
:
4
}}]:
self
.
run_generate
(
parameters
)
self
.
run_generate
(
parameters
)
def
test_vertex_generate_fail
(
self
):
data
=
{
"instances"
:
[
{
"prompt"
:
"The capital of France is"
},
],
}
response
=
requests
.
post
(
self
.
base_url
+
"/vertex_generate"
,
json
=
data
)
assert
response
.
status_code
==
HTTPStatus
.
BAD_REQUEST
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
unittest
.
main
()
unittest
.
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