Skip to content

Commit b4f0bdb

Browse files
committed
Remove interpret-turn redundant
- single export for slot comitting turn types
1 parent d74a0c2 commit b4f0bdb

8 files changed

Lines changed: 75 additions & 530 deletions

File tree

apps/web/src/lib/server/decide-turn-policy.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
deriveAmbiguity,
23
type CommitPolicyOutput,
34
type ConversationEntity,
45
type TurnAmbiguity,
@@ -33,7 +34,12 @@ type StructuredWriteReadiness =
3334
export function decideTurnPolicy(input: DecideTurnPolicyInput): TurnPolicyDecision {
3435
const { classification, commitResult } = input;
3536
const targetEntityId = classification.resolvedEntityIds[0];
36-
const ambiguity = deriveAmbiguity(classification, commitResult);
37+
const ambiguity = deriveAmbiguity({
38+
classifierConfidence: classification.confidence,
39+
missingSlots: commitResult.missingSlots,
40+
needsClarification: commitResult.needsClarification,
41+
blockingSlots: []
42+
});
3743

3844
switch (classification.turnType) {
3945
case "informational":
@@ -109,17 +115,6 @@ export function decideTurnPolicy(input: DecideTurnPolicyInput): TurnPolicyDecisi
109115
}
110116
}
111117

112-
function deriveAmbiguity(
113-
classification: TurnClassifierOutput,
114-
commitResult: CommitPolicyOutput
115-
): TurnAmbiguity {
116-
if (classification.confidence < 0.6) return "high";
117-
if (commitResult.missingSlots.length > 0) return "high";
118-
if (commitResult.needsClarification.length > 0) return "high";
119-
if (classification.confidence < 0.8) return "low";
120-
return "none";
121-
}
122-
123118
function deriveStructuredWriteReadiness(
124119
input: DecideTurnPolicyInput,
125120
ambiguity: TurnAmbiguity

0 commit comments

Comments
 (0)