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
6dbb569b
Unverified
Commit
6dbb569b
authored
Oct 26, 2025
by
Chang Su
Committed by
GitHub
Oct 26, 2025
Browse files
[router][grpc] Fix tool call id in `parse_json_schema_response` (#12152)
parent
5994e6c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
sgl-router/src/routers/grpc/processing.rs
sgl-router/src/routers/grpc/processing.rs
+2
-0
sgl-router/src/routers/grpc/utils.rs
sgl-router/src/routers/grpc/utils.rs
+14
-2
No files found.
sgl-router/src/routers/grpc/processing.rs
View file @
6dbb569b
...
...
@@ -193,6 +193,8 @@ impl ResponseProcessor {
(
tool_calls
,
processed_text
)
=
utils
::
parse_json_schema_response
(
&
processed_text
,
&
original_request
.tool_choice
,
&
original_request
.model
,
history_tool_calls_count
,
);
}
else
if
tool_parser_available
{
(
tool_calls
,
processed_text
)
=
self
...
...
sgl-router/src/routers/grpc/utils.rs
View file @
6dbb569b
...
...
@@ -542,6 +542,8 @@ pub fn create_stop_decoder(
pub
fn
parse_json_schema_response
(
processed_text
:
&
str
,
tool_choice
:
&
Option
<
ToolChoice
>
,
model
:
&
str
,
history_tool_calls_count
:
usize
,
)
->
(
Option
<
Vec
<
ToolCall
>>
,
String
)
{
match
tool_choice
{
Some
(
ToolChoice
::
Function
{
function
,
..
})
=>
{
...
...
@@ -549,7 +551,12 @@ pub fn parse_json_schema_response(
match
serde_json
::
from_str
::
<
Value
>
(
processed_text
)
{
Ok
(
params
)
=>
{
let
tool_call
=
ToolCall
{
id
:
format!
(
"call_{}"
,
Uuid
::
new_v4
()),
id
:
generate_tool_call_id
(
model
,
&
function
.name
,
0
,
history_tool_calls_count
,
),
tool_type
:
"function"
.to_string
(),
function
:
FunctionCallResponse
{
name
:
function
.name
.clone
(),
...
...
@@ -580,7 +587,12 @@ pub fn parse_json_schema_response(
let
parameters
=
obj
.get
(
"parameters"
)
?
;
Some
(
ToolCall
{
id
:
format!
(
"call_{}_{}"
,
i
,
Uuid
::
new_v4
()),
id
:
generate_tool_call_id
(
model
,
&
name
,
i
,
history_tool_calls_count
,
),
tool_type
:
"function"
.to_string
(),
function
:
FunctionCallResponse
{
name
,
...
...
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