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
3affa9dc
Unverified
Commit
3affa9dc
authored
Aug 25, 2025
by
Binyao Jiang
Committed by
GitHub
Aug 25, 2025
Browse files
Fix GLM45 tool call multi-turn bug (#9500)
parent
ea0696b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
python/sglang/srt/entrypoints/openai/serving_chat.py
python/sglang/srt/entrypoints/openai/serving_chat.py
+19
-0
No files found.
python/sglang/srt/entrypoints/openai/serving_chat.py
View file @
3affa9dc
...
@@ -207,6 +207,25 @@ class OpenAIServingChat(OpenAIServingBase):
...
@@ -207,6 +207,25 @@ class OpenAIServingChat(OpenAIServingBase):
audio_data
,
audio_data
,
modalities
,
modalities
,
)
)
# per the Transformers docs & maintainers, tool call arguments in
# assistant-role messages with tool_calls need to be dicts not JSON str -
# this is how tool-use chat templates will expect them moving forwards
# so, for messages that have tool_calls, parse the string (which we get
# from openAI format) to dict
if
(
processed_msg
[
"role"
]
==
"assistant"
and
"tool_calls"
in
processed_msg
and
isinstance
(
processed_msg
[
"tool_calls"
],
list
)
):
for
item
in
processed_msg
[
"tool_calls"
]:
if
"arguments"
in
item
[
"function"
]
and
isinstance
(
item
[
"function"
][
"arguments"
],
str
):
item
[
"function"
][
"arguments"
]
=
json
.
loads
(
item
[
"function"
][
"arguments"
]
)
openai_compatible_messages
.
append
(
processed_msg
)
openai_compatible_messages
.
append
(
processed_msg
)
# Handle assistant prefix for continue_final_message
# 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