Skip to content

Commit

Permalink
Try the indent=2 option in xgrammar
Browse files Browse the repository at this point in the history
  • Loading branch information
merrymercy committed Nov 27, 2024
1 parent a0e5874 commit dd4482e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/sglang/srt/constrained/xgrammar_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ def init_value_impl(self, key: Tuple[str, str]) -> XGrammarGrammar:
key_type, key_string = key
if key_type == "json":
try:
ctx = self.grammar_compiler.compile_json_schema(schema=key_string)
ctx = self.grammar_compiler.compile_json_schema(
schema=key_string, indent=2
)
except RuntimeError as e:
logging.warning(
f"Skip invalid json_schema: json_schema={key_string}, {e=}"
Expand Down

0 comments on commit dd4482e

Please sign in to comment.