From 7c41fce8b9a986efdeb8b366a75d01ddd2679000 Mon Sep 17 00:00:00 2001 From: amstrongzyf <201840057@smail.nju.edu.cn> Date: Wed, 9 Jul 2025 14:33:24 +0800 Subject: [PATCH] fix: fix a small bug in json_mode (#1041) --- rdagent/oai/backend/base.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rdagent/oai/backend/base.py b/rdagent/oai/backend/base.py index 441130ff..03348754 100644 --- a/rdagent/oai/backend/base.py +++ b/rdagent/oai/backend/base.py @@ -109,14 +109,12 @@ class JSONParser: out.append(tokval) result = "".join(out) - # Validate if the result is valid JSON - json.loads(result) return result except (tokenize.TokenError, json.JSONDecodeError): # If tokenize fails, fallback to regex method for python_val, json_val in replacements.items(): - json_str = re.sub(rf"\\b{python_val}\\b", json_val, json_str) + json_str = re.sub(rf"\b{python_val}\b", json_val, json_str) return json_str @staticmethod