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