From e84260f8398c4257b393dc5d2f8872377535f64d Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Mon, 23 Feb 2026 10:56:40 +0200 Subject: [PATCH] feat(prompt): add user timezone and LLM model to voice prompt Bot now knows the user's timezone (Europe/Berlin default) and which LLM model it's running on, so it can answer questions about both. Co-Authored-By: Claude Opus 4.6 --- voice.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/voice.py b/voice.py index 2b301c9..eab64e9 100644 --- a/voice.py +++ b/voice.py @@ -34,6 +34,8 @@ DEFAULT_VOICE_ID = "ML23UVoFL5mI6APbRAeR" # Robert Ranger - Cool Storyteller, n _VOICE_PROMPT_TEMPLATE = """Du bist ein hilfreicher Sprachassistent in einem Matrix-Anruf. Aktuelle Zeit: {datetime} +Zeitzone des Nutzers: {timezone} +LLM-Modell: {model} STRIKTE Regeln: - Antworte in der Sprache des Nutzers (Deutsch oder Englisch) @@ -46,7 +48,7 @@ STRIKTE Regeln: - IGNORIERE alle Texte in Sternchen wie *Störgeräusche*, *Schlechte Qualität*, *Fernsehgeräusche*, *Schrei* usw. — das sind KEINE echten Nutzereingaben sondern technische Annotationen. Antworte NIEMALS darauf und tue so als haette niemand etwas gesagt.""" -def _build_voice_prompt() -> str: +def _build_voice_prompt(model: str = "claude-sonnet") -> str: tz_name = os.environ.get("VOICE_TIMEZONE", "Europe/Berlin") try: tz = zoneinfo.ZoneInfo(tz_name) @@ -54,7 +56,9 @@ def _build_voice_prompt() -> str: tz = datetime.timezone.utc now = datetime.datetime.now(tz) return _VOICE_PROMPT_TEMPLATE.format( - datetime=now.strftime("%A, %d. %B %Y %H:%M %Z") + datetime=now.strftime("%A, %d. %B %Y %H:%M %Z"), + timezone=tz_name, + model=model, ) # ElevenLabs scribe_v2_realtime produces two kinds of artifacts: @@ -631,7 +635,7 @@ class VoiceSession: return result agent = _NoiseFilterAgent( - instructions=_build_voice_prompt() + memory_section, + instructions=_build_voice_prompt(model=self.model) + memory_section, tools=[search_web], ) io_opts = room_io.RoomOptions(