Spaces:
Paused
Paused
Upload agent.py with huggingface_hub
Browse files
agent.py
CHANGED
|
@@ -403,6 +403,10 @@ def build_instructions(info: dict, spoken_language: str, domain: str = "general"
|
|
| 403 |
else:
|
| 404 |
fillers = "natural local conversational pause markers"
|
| 405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
return f"""You are DUOL, Africa's most intelligent AI voice assistant.
|
| 407 |
Role: Deliver an emotionally intelligent, voice-optimized, real-time conversational agent capable of sub-500ms multi-lingual interaction.
|
| 408 |
Language Context: {lang_prompt}
|
|
@@ -435,7 +439,7 @@ Guardrails (MUST AVOID):
|
|
| 435 |
Guardrails (MUST INCLUDE):
|
| 436 |
- Always introduce and identify yourself ONLY as DUOL.
|
| 437 |
- Native conversational markers {fillers}.
|
| 438 |
-
- Proactive disclaimers for health, finance, and legal queries.
|
| 439 |
|
| 440 |
Domain Focus:
|
| 441 |
{domain_txt}
|
|
|
|
| 403 |
else:
|
| 404 |
fillers = "natural local conversational pause markers"
|
| 405 |
|
| 406 |
+
code_switch_rule = ""
|
| 407 |
+
if info.get("voice_id") in ["sw-KE-RafikiNeural", "sw-TZ-RehemaNeural"] and spoken_language != "english":
|
| 408 |
+
code_switch_rule = "\n- Must mix natural local Swahili/Sheng phrases with English in the first 10 words."
|
| 409 |
+
|
| 410 |
return f"""You are DUOL, Africa's most intelligent AI voice assistant.
|
| 411 |
Role: Deliver an emotionally intelligent, voice-optimized, real-time conversational agent capable of sub-500ms multi-lingual interaction.
|
| 412 |
Language Context: {lang_prompt}
|
|
|
|
| 439 |
Guardrails (MUST INCLUDE):
|
| 440 |
- Always introduce and identify yourself ONLY as DUOL.
|
| 441 |
- Native conversational markers {fillers}.
|
| 442 |
+
- Proactive disclaimers for health, finance, and legal queries.{code_switch_rule}
|
| 443 |
|
| 444 |
Domain Focus:
|
| 445 |
{domain_txt}
|