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
72e7b57a
"vscode:/vscode.git/clone" did not exist on "ec17136e6ed7d6be9a60462cc0e3d2d3cba37320"
Unverified
Commit
72e7b57a
authored
Oct 24, 2024
by
zolinthecow
Committed by
GitHub
Oct 24, 2024
Browse files
[Bug] Catch any errors caused by parsing json schema (#1776)
parent
87a7cfa0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
python/sglang/srt/constrained/fsm_cache.py
python/sglang/srt/constrained/fsm_cache.py
+10
-3
No files found.
python/sglang/srt/constrained/fsm_cache.py
View file @
72e7b57a
...
@@ -73,9 +73,16 @@ class FSMCache(BaseToolCache):
...
@@ -73,9 +73,16 @@ class FSMCache(BaseToolCache):
def
init_value
(
self
,
key
):
def
init_value
(
self
,
key
):
key_type
,
key_string
=
key
key_type
,
key_string
=
key
if
key_type
==
"json"
:
if
key_type
==
"json"
:
regex
=
build_regex_from_schema
(
try
:
key_string
,
whitespace_pattern
=
self
.
constrained_json_whitespace_pattern
regex
=
build_regex_from_schema
(
)
key_string
,
whitespace_pattern
=
self
.
constrained_json_whitespace_pattern
,
)
except
NotImplementedError
as
e
:
logger
.
warning
(
f
"skip invalid json schema: json_schema=
{
key_string
}
,
{
e
=
}
"
)
return
None
,
key_string
elif
key_type
==
"regex"
:
elif
key_type
==
"regex"
:
regex
=
key_string
regex
=
key_string
else
:
else
:
...
...
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