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
7ad6b766
Unverified
Commit
7ad6b766
authored
Jul 24, 2025
by
Ying Wang
Committed by
GitHub
Jul 24, 2025
Browse files
fix: Fix failed functional tests
https://github.com/meta-llama/llama-stack-evals
(#8266)
parent
c0fb25e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
python/sglang/srt/entrypoints/openai/serving_chat.py
python/sglang/srt/entrypoints/openai/serving_chat.py
+14
-0
python/sglang/srt/utils.py
python/sglang/srt/utils.py
+7
-3
No files found.
python/sglang/srt/entrypoints/openai/serving_chat.py
View file @
7ad6b766
...
@@ -55,6 +55,20 @@ class OpenAIServingChat(OpenAIServingBase):
...
@@ -55,6 +55,20 @@ class OpenAIServingChat(OpenAIServingBase):
def
_request_id_prefix
(
self
)
->
str
:
def
_request_id_prefix
(
self
)
->
str
:
return
"chatcmpl-"
return
"chatcmpl-"
def
_validate_request
(
self
,
request
:
ChatCompletionRequest
)
->
Optional
[
str
]:
"""Validate that the input is valid."""
if
not
request
.
messages
:
return
"Messages cannot be empty."
if
(
isinstance
(
request
.
tool_choice
,
str
)
and
request
.
tool_choice
.
lower
()
==
"required"
and
not
request
.
tools
):
return
"Tools cannot be empty if tool choice is set to required."
return
None
def
_convert_to_internal_request
(
def
_convert_to_internal_request
(
self
,
self
,
request
:
ChatCompletionRequest
,
request
:
ChatCompletionRequest
,
...
...
python/sglang/srt/utils.py
View file @
7ad6b766
...
@@ -744,9 +744,13 @@ def load_image(
...
@@ -744,9 +744,13 @@ def load_image(
image
=
Image
.
open
(
BytesIO
(
image_file
))
image
=
Image
.
open
(
BytesIO
(
image_file
))
elif
image_file
.
startswith
(
"http://"
)
or
image_file
.
startswith
(
"https://"
):
elif
image_file
.
startswith
(
"http://"
)
or
image_file
.
startswith
(
"https://"
):
timeout
=
int
(
os
.
getenv
(
"REQUEST_TIMEOUT"
,
"3"
))
timeout
=
int
(
os
.
getenv
(
"REQUEST_TIMEOUT"
,
"3"
))
response
=
requests
.
get
(
image_file
,
stream
=
True
,
timeout
=
timeout
).
raw
response
=
requests
.
get
(
image_file
,
stream
=
True
,
timeout
=
timeout
)
image
=
Image
.
open
(
response
)
try
:
response
.
close
()
response
.
raise_for_status
()
image
=
Image
.
open
(
response
.
raw
)
image
.
load
()
# Force loading to avoid issues after closing the stream
finally
:
response
.
close
()
elif
image_file
.
lower
().
endswith
((
"png"
,
"jpg"
,
"jpeg"
,
"webp"
,
"gif"
)):
elif
image_file
.
lower
().
endswith
((
"png"
,
"jpg"
,
"jpeg"
,
"webp"
,
"gif"
)):
image
=
Image
.
open
(
image_file
)
image
=
Image
.
open
(
image_file
)
elif
image_file
.
startswith
(
"data:"
):
elif
image_file
.
startswith
(
"data:"
):
...
...
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