Spaces:
Running on Zero
Running on Zero
fix: align model prompts with user workflow
Browse filesCo-authored-by: Codex <noreply@openai.com>
- README.md +1 -1
- hackathon_advisor/lora_dataset.py +4 -4
- hackathon_advisor/model_runtime.py +1 -1
- tests/test_lora_dataset.py +5 -0
- tests/test_model_runtime.py +9 -0
README.md
CHANGED
|
@@ -99,7 +99,7 @@ and inserted into `Plan` and `Rank` build paths, so the app can turn "one evenin
|
|
| 99 |
## LoRA Dataset Artifact
|
| 100 |
|
| 101 |
The `lora_dataset` Gradio API endpoint exports a compact chat JSONL dataset from successful session turns. Each included
|
| 102 |
-
turn yields a tool-call example and an advisor-response example for `openbmb/MiniCPM5-1B`, with the selected
|
| 103 |
parsed XML tool call, tool observations, and score context preserved. This prepares the Well-Tuned path without claiming
|
| 104 |
that the adapter has already been trained or published.
|
| 105 |
|
|
|
|
| 99 |
## LoRA Dataset Artifact
|
| 100 |
|
| 101 |
The `lora_dataset` Gradio API endpoint exports a compact chat JSONL dataset from successful session turns. Each included
|
| 102 |
+
turn yields a tool-call example and an advisor-response example for `openbmb/MiniCPM5-1B`, with the selected goals,
|
| 103 |
parsed XML tool call, tool observations, and score context preserved. This prepares the Well-Tuned path without claiming
|
| 104 |
that the adapter has already been trained or published.
|
| 105 |
|
hackathon_advisor/lora_dataset.py
CHANGED
|
@@ -10,13 +10,13 @@ BASE_MODEL = "openbmb/MiniCPM5-1B"
|
|
| 10 |
ADAPTER_TASK = "hackathon_advisor_tool_call_and_voice"
|
| 11 |
|
| 12 |
TOOL_CALL_SYSTEM_PROMPT = (
|
| 13 |
-
"You are
|
| 14 |
-
"project-advice request. Return only the XML function call."
|
| 15 |
)
|
| 16 |
|
| 17 |
RESPONSE_SYSTEM_PROMPT = (
|
| 18 |
-
"You are
|
| 19 |
-
"observations, cited pages, score, and selected
|
| 20 |
)
|
| 21 |
|
| 22 |
|
|
|
|
| 10 |
ADAPTER_TASK = "hackathon_advisor_tool_call_and_voice"
|
| 11 |
|
| 12 |
TOOL_CALL_SYSTEM_PROMPT = (
|
| 13 |
+
"You are The Unwritten Almanac's originality and build-plan advisor. Choose exactly one validated tool call for "
|
| 14 |
+
"the user's project-advice request. Return only the XML function call."
|
| 15 |
)
|
| 16 |
|
| 17 |
RESPONSE_SYSTEM_PROMPT = (
|
| 18 |
+
"You are The Unwritten Almanac's originality and build-plan advisor. Write concise, evidence-grounded advice from "
|
| 19 |
+
"the tool observations, cited pages, score, and selected goals."
|
| 20 |
)
|
| 21 |
|
| 22 |
|
hackathon_advisor/model_runtime.py
CHANGED
|
@@ -167,7 +167,7 @@ def render_context(message: str, state: dict[str, Any]) -> str:
|
|
| 167 |
|
| 168 |
def system_prompt() -> str:
|
| 169 |
return (
|
| 170 |
-
"You are
|
| 171 |
"Use tools to inspect existing projects, find whitespace, save ideas, score ideas, and make plans. "
|
| 172 |
"Emit exactly one XML tool call."
|
| 173 |
)
|
|
|
|
| 167 |
|
| 168 |
def system_prompt() -> str:
|
| 169 |
return (
|
| 170 |
+
"You are The Unwritten Almanac's originality and build-plan advisor. "
|
| 171 |
"Use tools to inspect existing projects, find whitespace, save ideas, score ideas, and make plans. "
|
| 172 |
"Emit exactly one XML tool call."
|
| 173 |
)
|
tests/test_lora_dataset.py
CHANGED
|
@@ -30,6 +30,11 @@ def test_lora_dataset_exports_tool_call_and_response_examples() -> None:
|
|
| 30 |
assert examples[1]["messages"][1]["content"].startswith("A local-first archive")
|
| 31 |
assert "Tool observations:" in examples[1]["messages"][1]["content"]
|
| 32 |
assert examples[1]["messages"][2]["content"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
def test_empty_lora_dataset_only_exports_manifest() -> None:
|
|
|
|
| 30 |
assert examples[1]["messages"][1]["content"].startswith("A local-first archive")
|
| 31 |
assert "Tool observations:" in examples[1]["messages"][1]["content"]
|
| 32 |
assert examples[1]["messages"][2]["content"]
|
| 33 |
+
system_messages = "\n".join(example["messages"][0]["content"] for example in examples)
|
| 34 |
+
assert "Mothback" not in system_messages
|
| 35 |
+
assert "Build Small" not in system_messages
|
| 36 |
+
assert "prize targets" not in system_messages
|
| 37 |
+
assert "selected goals" in system_messages
|
| 38 |
|
| 39 |
|
| 40 |
def test_empty_lora_dataset_only_exports_manifest() -> None:
|
tests/test_model_runtime.py
CHANGED
|
@@ -6,6 +6,7 @@ from hackathon_advisor.model_runtime import (
|
|
| 6 |
create_tool_planner,
|
| 7 |
render_context,
|
| 8 |
runtime_status,
|
|
|
|
| 9 |
)
|
| 10 |
|
| 11 |
|
|
@@ -77,6 +78,14 @@ def test_render_context_includes_state() -> None:
|
|
| 77 |
assert '<function name="tool_name">' in context
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
def test_create_tool_planner_defaults_to_rules(monkeypatch: pytest.MonkeyPatch) -> None:
|
| 81 |
monkeypatch.delenv("ADVISOR_MODEL_BACKEND", raising=False)
|
| 82 |
|
|
|
|
| 6 |
create_tool_planner,
|
| 7 |
render_context,
|
| 8 |
runtime_status,
|
| 9 |
+
system_prompt,
|
| 10 |
)
|
| 11 |
|
| 12 |
|
|
|
|
| 78 |
assert '<function name="tool_name">' in context
|
| 79 |
|
| 80 |
|
| 81 |
+
def test_system_prompt_keeps_runtime_role_user_facing() -> None:
|
| 82 |
+
prompt = system_prompt()
|
| 83 |
+
|
| 84 |
+
assert "The Unwritten Almanac" in prompt
|
| 85 |
+
assert "Mothback" not in prompt
|
| 86 |
+
assert "Build Small" not in prompt
|
| 87 |
+
|
| 88 |
+
|
| 89 |
def test_create_tool_planner_defaults_to_rules(monkeypatch: pytest.MonkeyPatch) -> None:
|
| 90 |
monkeypatch.delenv("ADVISOR_MODEL_BACKEND", raising=False)
|
| 91 |
|