Skip to content

Commit

Permalink
Escape curly braces in the regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
rlouf committed Aug 16, 2023
1 parent 4c2eb4e commit f317c22
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion outlines/text/json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def match_step_to_regex(step):
"""
match step:
case str() as step:
return step
return step.replace("{", "\\{").replace("}", "\\}")

case {"enum": choices, "type": "string"}:
choices = [f'"{choice}"' for choice in choices]
Expand Down

0 comments on commit f317c22

Please sign in to comment.