Skip to content

Commit fea0e96

Browse files
authored
fix(grammar): decode JSON Pointer escapes in schema references
1 parent d736646 commit fea0e96

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎llama_cpp/llama_grammar.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ def visit(n: dict):
475475
raise ValueError(f"Unsupported ref {ref}")
476476

477477
for sel in ref.split("#")[-1].split("/")[1:]:
478+
sel = sel.replace("~1", "/").replace("~0", "~")
478479
assert target is not None and sel in target, (
479480
f"Error resolving ref {ref}: {sel} not in {target}"
480481
)

0 commit comments

Comments
 (0)