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
zhaoyu6
sglang
Commits
af4ab656
Unverified
Commit
af4ab656
authored
Sep 29, 2025
by
Chang Su
Committed by
GitHub
Sep 29, 2025
Browse files
[router][tool call] Improve normal content extraction and error handling (non-stream) (#11050)
parent
11965b0d
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
sgl-router/tests/tool_parser_wrapper_tokens.rs
sgl-router/tests/tool_parser_wrapper_tokens.rs
+7
-2
No files found.
sgl-router/tests/tool_parser_wrapper_tokens.rs
View file @
af4ab656
...
@@ -118,8 +118,12 @@ async fn test_json_extraction_without_wrapper_tokens() {
...
@@ -118,8 +118,12 @@ async fn test_json_extraction_without_wrapper_tokens() {
And here is some text after.
And here is some text after.
"#
;
"#
;
let
(
_
normal_text
,
tools
)
=
parser
.parse_complete
(
input
)
.await
.unwrap
();
let
(
normal_text
,
tools
)
=
parser
.parse_complete
(
input
)
.await
.unwrap
();
assert_eq!
(
tools
.len
(),
1
);
assert_eq!
(
tools
.len
(),
1
);
assert_eq!
(
normal_text
,
"
\n
Here is some text before the JSON.
\n
\n
And here is some text after.
\n
"
);
assert_eq!
(
tools
[
0
]
.function.name
,
"search"
);
assert_eq!
(
tools
[
0
]
.function.name
,
"search"
);
}
}
...
@@ -143,8 +147,9 @@ async fn test_json_with_multiline_wrapper_content() {
...
@@ -143,8 +147,9 @@ async fn test_json_with_multiline_wrapper_content() {
```
```
Done!"#
;
Done!"#
;
let
(
_
normal_text
,
tools
)
=
parser
.parse_complete
(
input
)
.await
.unwrap
();
let
(
normal_text
,
tools
)
=
parser
.parse_complete
(
input
)
.await
.unwrap
();
assert_eq!
(
tools
.len
(),
1
);
assert_eq!
(
tools
.len
(),
1
);
assert_eq!
(
normal_text
,
""
);
assert_eq!
(
tools
[
0
]
.function.name
,
"format_code"
);
assert_eq!
(
tools
[
0
]
.function.name
,
"format_code"
);
}
}
...
...
Prev
1
2
Next
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