Reasoning models (e.g. foundation-sec-8b) emit valid JSON then repeat it inside a markdown fence block. json.loads() fails on the combined text. extract_first_json_array() scans for the first '[' and walks to its matching ']' with proper string/escape/nesting handling, then returns just that slice. Combined with strip_json_fences(), this handles all observed output patterns: - bare JSON array (standard models) - fenced JSON array (fence-wrapping models) - bare array followed by fenced repeat (reasoning models) |
||
|---|---|---|
| .. | ||
| diagnose | ||
| __init__.py | ||
| blocklist.py | ||
| embeddings.py | ||
| incidents.py | ||
| llm.py | ||
| models.py | ||
| pihole.py | ||
| search.py | ||