Skip to content

Commit 1c8d8d0

Browse files
committed
Fix Black Belt natural-language question transport
1 parent e035a34 commit 1c8d8d0

1 file changed

Lines changed: 24 additions & 9 deletions

File tree

bin/blackbelt-engine.sh

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,30 @@ system_prompt = pathlib.Path(prompt_path).read_text(encoding="utf-8")
4343
4444
try:
4545
parsed = json.loads(raw_input)
46+
json_mode = True
4647
except json.JSONDecodeError:
47-
parsed = {"question": raw_input.strip()}
48-
49-
request = {
50-
"model": model,
51-
"system": system_prompt,
52-
"prompt": json.dumps(parsed, ensure_ascii=False, separators=(",", ":")),
53-
"stream": False,
54-
"format": "json"
55-
}
48+
parsed = raw_input.strip()
49+
json_mode = False
50+
51+
if json_mode:
52+
request = {
53+
"model": model,
54+
"system": system_prompt,
55+
"prompt": json.dumps(parsed, ensure_ascii=False, separators=(",", ":")),
56+
"stream": False,
57+
"format": "json"
58+
}
59+
else:
60+
# Natural-language questions are intentionally not sent through Ollama's
61+
# JSON-output constraint. The CLI advertises question mode, so the model
62+
# should receive the question as ordinary text and answer it directly.
63+
question_system = system_prompt + "\n\nQUESTION MODE\nThe user has entered a natural-language question rather than a structured audit object. Answer the question directly and concisely. Do not manufacture an audit report or JSON object unless the user explicitly asks for one."
64+
request = {
65+
"model": model,
66+
"system": question_system,
67+
"prompt": parsed,
68+
"stream": False
69+
}
70+
5671
print(json.dumps(request, ensure_ascii=False))
5772
PY

0 commit comments

Comments
 (0)