[Minor] Improve code style (#2422)
This commit is contained in:
@@ -117,7 +117,10 @@ class XGrammarGrammarBackend(BaseGrammarBackend):
|
||||
key_type, key_string = key
|
||||
if key_type == "json":
|
||||
try:
|
||||
ctx = self.grammar_compiler.compile_json_schema(schema=key_string)
|
||||
if key_string == "$$ANY$$":
|
||||
ctx = self.grammar_compiler.compile_builtin_json_grammar()
|
||||
else:
|
||||
ctx = self.grammar_compiler.compile_json_schema(schema=key_string)
|
||||
except RuntimeError as e:
|
||||
logging.warning(
|
||||
f"Skip invalid json_schema: json_schema={key_string}, {e=}"
|
||||
|
||||
Reference in New Issue
Block a user