From f317c22080f89efe5e32d14eb3c5b9fd274cb280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Louf?= Date: Thu, 17 Aug 2023 00:32:35 +0200 Subject: [PATCH] Escape curly braces in the regexes --- outlines/text/json_schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outlines/text/json_schema.py b/outlines/text/json_schema.py index 8b96c9dca..bcfef614f 100644 --- a/outlines/text/json_schema.py +++ b/outlines/text/json_schema.py @@ -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]