feat:意图识别优化

This commit is contained in:
2026-09-30 08:57:39 -07:00
parent 4d7c91cc41
commit 3e88b339a0
21 changed files with 443 additions and 88 deletions
+8 -2
View File
@@ -164,6 +164,7 @@ def _run_output(state: dict[str, Any]) -> dict[str, Any]:
"outcome": outcome,
"intent": state.get("intent"),
"answer": state.get("answer"),
"offer": state.get("offer"),
"clarification": [item.value for item in pending] if pending else None,
"actions": state.get("actions"),
"validation_passed": state.get("validation_passed"),
@@ -185,8 +186,13 @@ def observe_decision(request: Any) -> Iterator[Any]:
return
model = request.model or settings.typesafe_model
# 意图判断用固定名字,方便以后按名字做评测。别的决策题不要都叫 classify-intent
name = "classify-intent" if set(request.decisions) == {"intent"} else "run-decision"
# 意图判断可能附带对上一轮提议的回应判断,仍属于同一次意图识别
name = (
"classify-intent"
if set(request.decisions) <= {"intent", "offer_response"}
and "intent" in request.decisions
else "run-decision"
)
# 复用本应用已经选定的客户端
with client.start_as_current_observation(
as_type="generation",