Spaces:
Runtime error
Runtime error
horriblecpp Claude Sonnet 4.6 commited on
Commit ·
ecb29bf
1
Parent(s): 0d7df64
Guard against None utterances in intent classifier prompt builder
Browse files
backend/intent_classifier.py
CHANGED
|
@@ -44,7 +44,7 @@ def _build_system_prompt(taxonomy: dict) -> str:
|
|
| 44 |
for domain, intents in taxonomy.items():
|
| 45 |
for intent, data in intents.items():
|
| 46 |
utterances = data.get("utterances", [])
|
| 47 |
-
examples = "; ".join(utterances[:2])
|
| 48 |
lines.append(f" {domain}.{intent}: \"{examples}\"")
|
| 49 |
lines.append('\nIf nothing matches, return {"domain": "unknown", "intent": "unknown", "confidence": "low"}.')
|
| 50 |
lines.append("Respond with JSON only, no prose.")
|
|
|
|
| 44 |
for domain, intents in taxonomy.items():
|
| 45 |
for intent, data in intents.items():
|
| 46 |
utterances = data.get("utterances", [])
|
| 47 |
+
examples = "; ".join(u for u in utterances[:2] if u)
|
| 48 |
lines.append(f" {domain}.{intent}: \"{examples}\"")
|
| 49 |
lines.append('\nIf nothing matches, return {"domain": "unknown", "intent": "unknown", "confidence": "low"}.')
|
| 50 |
lines.append("Respond with JSON only, no prose.")
|