Files
breakpilot-compliance/ai-compliance-sdk/internal/ucca/intent.go
T
Claude 0903e3a8d1
CI / detect-changes (push) Successful in 5s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / secret-scan (push) Has been skipped
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / build-sha-integrity (push) Successful in 5s
CI / validate-canonical-controls (push) Successful in 4s
CI / loc-budget (push) Successful in 18s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 3m0s
CI / test-go (push) Successful in 59s
CI / iace-gt-coverage (push) Successful in 17s
CI / test-python-backend (push) Has been skipped
CI / test-python-document-crawler (push) Has been skipped
CI / test-python-dsms-gateway (push) Has been skipped
perf(ai-sdk): embed query once across router fan-out + fold umlauts in intent/concept matching
Authority Router re-embedded the query per collection (6x); on dev the embed
endpoint (OVH) is remote so that was 6 round-trips = 7-12s per /retrieve. Embed
once, reuse via ctx across the concurrent per-collection searches.
DetectIntent + ConceptNorms now fold ae/oe/ue/ss so ASCII (Pruefe) and umlaut
(Pruefe) inputs both match.
2026-07-01 19:03:11 +02:00

47 lines
2.0 KiB
Go

package ucca
import "strings"
// DetectIntent classifies the INTERACTION INTENT of a query (Advisor Reasoning
// Stack E3). The same norms answer very differently depending on the TASK the user
// wants: "Was ist X?" (definition) vs "Wie schreibe ich X?" (anleitung) vs "Prüfe X"
// (review). The SDK detects the intent deterministically and emits it; the FE picks
// the answer FORM, so the LLM gets a precise assignment ("write an Anleitung over
// this evidence") instead of guessing the format. Returns "" (neutral) when no
// clear task is signalled. First tier of ~20-30 intent types.
func DetectIntent(query string) string {
q := " " + normalizeGerman(query) + " "
has := func(subs ...string) bool {
for _, s := range subs {
if strings.Contains(q, normalizeGerman(s)) {
return true
}
}
return false
}
switch {
case has("prüfe", "prüf mein", "überprüfe", "überprüf", "review", "checke mein",
"ist mein", "ist meine", "ist unser", "ist unsere", "konform", "stimmt mein",
"bewerte mein", "analysiere mein"):
return "review"
case has("checkliste", "was muss ich alles", "was gehört alles", "was gehört in",
"welche punkte muss", "was brauche ich alles"):
return "checkliste"
case has("vergleich", "unterschied", "worin unterscheid", " vs ", " versus ",
"gegenüber", "im gegensatz"):
return "vergleich"
case has("wie schreibe", "wie erstelle", "wie erstell", "wie mache", "wie baue",
"wie setze ich", "wie gehe ich vor", "wie formuliere", "wie richte ich",
"anleitung", "schritt für schritt", "schritt-für-schritt", "erstelle mir",
"erstell mir", "generiere", "was muss ich beachten", "worauf muss ich achten"):
return "anleitung"
case has("welche risiken", "welche gefahren", "risikoanalyse", "welche bedrohungen"):
return "risikoanalyse"
case has("was ist", "was bedeutet", "was versteht man", "was sind", "definition",
"erkläre mir", "erklär mir", "was heißt", "was genau ist"):
return "definition"
default:
return ""
}
}