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
a79a5d70
Unverified
Commit
a79a5d70
authored
Jul 30, 2025
by
Chang Su
Committed by
GitHub
Jul 30, 2025
Browse files
Revert "Fix the input tools format and history tool_calls in OpenAI API (#6556)" (#8584)
parent
ec5f9442
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
21 deletions
+2
-21
python/sglang/srt/entrypoints/openai/serving_chat.py
python/sglang/srt/entrypoints/openai/serving_chat.py
+2
-21
No files found.
python/sglang/srt/entrypoints/openai/serving_chat.py
View file @
a79a5d70
...
...
@@ -127,12 +127,12 @@ class OpenAIServingChat(OpenAIServingBase):
request
.
skip_special_tokens
=
False
if
not
isinstance
(
request
.
tool_choice
,
str
):
tools
=
[
item
.
model_dump
()
item
.
function
.
model_dump
()
for
item
in
request
.
tools
if
item
.
function
.
name
==
request
.
tool_choice
.
function
.
name
]
else
:
tools
=
[
item
.
model_dump
()
for
item
in
request
.
tools
]
tools
=
[
item
.
function
.
model_dump
()
for
item
in
request
.
tools
]
tool_call_parser
=
self
.
tokenizer_manager
.
server_args
.
tool_call_parser
parser
=
FunctionCallParser
(
request
.
tools
,
tool_call_parser
)
...
...
@@ -178,25 +178,6 @@ class OpenAIServingChat(OpenAIServingBase):
audio_data
,
modalities
,
)
if
"tool_calls"
in
processed_msg
and
isinstance
(
processed_msg
.
get
(
"tool_calls"
),
list
):
for
call
in
processed_msg
[
"tool_calls"
]:
try
:
if
"arguments"
in
call
[
"function"
]
and
isinstance
(
call
[
"function"
][
"arguments"
],
str
):
call
[
"function"
][
"arguments"
]
=
json
.
loads
(
call
[
"function"
][
"arguments"
]
)
except
json
.
JSONDecodeError
as
e
:
# Log a warning or error if JSON parsing fails for arguments
logger
.
warning
(
f
"Failed to parse tool call arguments as JSON:
{
e
}
"
)
# Decide whether to continue or raise the exception based on desired behavior
continue
# Or raise e if strict parsing is required
openai_compatible_messages
.
append
(
processed_msg
)
# Handle assistant prefix for continue_final_message
...
...
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