Diagnose table-padding truncation and complete local-first investigation
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a0cffe-206f-7323-89d3-b20ca4cf4bf9
This commit is contained in:
parent
509e86d9c5
commit
90d1f86b8f
50 changed files with 2197 additions and 13 deletions
|
|
@ -11,9 +11,16 @@ RELATIONS = {'requires', 'enables', 'creates-context-for', 'refines', 'generaliz
|
|||
|
||||
def json_block(text):
|
||||
blocks = re.findall(r'```json\s*\n(.*?)\n```', text, re.S)
|
||||
if len(blocks) != 1:
|
||||
if len(blocks) == 1:
|
||||
return json.loads(blocks[0])
|
||||
if blocks or '```' in text:
|
||||
raise ValueError('exactly one JSON block required')
|
||||
return json.loads(blocks[0])
|
||||
# Accept one unambiguous terminal JSON document without Markdown fences.
|
||||
# Never repair malformed JSON or infer data from prose.
|
||||
starts = list(re.finditer(r'(?m)^[ \t]*(?=[{\[])', text))
|
||||
if len(starts) == 1:
|
||||
return json.loads(text[starts[0].start():].strip())
|
||||
raise ValueError('exactly one JSON block or terminal document required')
|
||||
|
||||
|
||||
def screen(candidates, relations):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue