This commit is contained in:
commit
3b93308b71
2 files changed
+5
-1
No files matched your search
@@ -37,7 +37,7 @@ def parse_structured_response(text: str) -> dict[str, Any]:
|
||||
start, end = cleaned.find("{"), cleaned.rfind("}")
|
||||
if start >= 0 and end > start:
|
||||
cleaned = cleaned[start : end + 1]
|
||||
parsed = json.loads(cleaned)
|
||||
parsed = json.loads(cleaned, strict=False)
|
||||
if not isinstance(parsed, dict):
|
||||
raise ValueError("Model response must be a JSON object")
|
||||
parsed.setdefault("summary", "")
|
||||
|
||||
@@ -35,6 +35,10 @@ class OrchestrationWorkerTests(unittest.TestCase):
|
||||
payload = parse_structured_response('```json\n{"summary":"ok","child_tasks":[]}\n```')
|
||||
self.assertEqual(payload["summary"], "ok")
|
||||
|
||||
def test_parse_json_with_raw_control_character(self):
|
||||
payload = parse_structured_response('{"summary":"line one\nline two","child_tasks":[]}')
|
||||
self.assertEqual(payload["summary"], "line one\nline two")
|
||||
|
||||
def test_child_task_codes_are_deterministic_and_include_parent(self):
|
||||
proposal = {
|
||||
"child_tasks": [
|
||||
|
||||
Reference in new issue
Block a user