Spaces:
Sleeping
Sleeping
fix: format runbook as readable key-value pairs for model
Browse files- training/prompts.py +19 -1
training/prompts.py
CHANGED
|
@@ -66,7 +66,25 @@ def format_observation(obs, step: int, last_action_result: dict | None = None) -
|
|
| 66 |
ok = result.get("ok", False)
|
| 67 |
if ok:
|
| 68 |
data = result.get("data", "")
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
parts.append(f"\n**Result (success):**\n{data_str}")
|
| 71 |
else:
|
| 72 |
error = result.get("error", "Unknown error")
|
|
|
|
| 66 |
ok = result.get("ok", False)
|
| 67 |
if ok:
|
| 68 |
data = result.get("data", "")
|
| 69 |
+
if isinstance(data, dict) and "org_config" in data:
|
| 70 |
+
org = data["org_config"]
|
| 71 |
+
labels = list(org.get("label_taxonomy", {}).values())
|
| 72 |
+
priorities = org.get("priority_levels", [])
|
| 73 |
+
team_map = org.get("team_map", {})
|
| 74 |
+
channels = org.get("oncall_channels", {})
|
| 75 |
+
noise = org.get("noise_channels", [])
|
| 76 |
+
lines = [
|
| 77 |
+
"=== RUNBOOK ===",
|
| 78 |
+
f"Valid labels : {', '.join(labels)}",
|
| 79 |
+
f"Valid priorities : {', '.join(priorities)}",
|
| 80 |
+
f"Team map : {' | '.join(f'{s} -> {t}' for s, t in team_map.items())}",
|
| 81 |
+
f"Oncall channels : {' | '.join(f'{s} -> {c}' for s, c in channels.items())}",
|
| 82 |
+
f"Noise channels : {', '.join(noise)} <-- NEVER post here",
|
| 83 |
+
"=== END RUNBOOK ===",
|
| 84 |
+
]
|
| 85 |
+
data_str = "\n".join(lines)
|
| 86 |
+
else:
|
| 87 |
+
data_str = str(data)[:2000]
|
| 88 |
parts.append(f"\n**Result (success):**\n{data_str}")
|
| 89 |
else:
|
| 90 |
error = result.get("error", "Unknown error")
|