feat: Voice prompt with model transparency, datetime, auto language
- Bot tells which model it uses when asked - Injects current UTC datetime into prompt - Responds in users language instead of always German Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
voice.py
13
voice.py
@@ -26,11 +26,14 @@ LK_API_SECRET = os.environ.get("LIVEKIT_API_SECRET", "")
|
|||||||
ELEVENLABS_KEY = os.environ.get("ELEVENLABS_API_KEY", "")
|
ELEVENLABS_KEY = os.environ.get("ELEVENLABS_API_KEY", "")
|
||||||
DEFAULT_VOICE_ID = "JBFqnCBsd6RMkjVDRZzb" # George - warm, captivating, British male
|
DEFAULT_VOICE_ID = "JBFqnCBsd6RMkjVDRZzb" # George - warm, captivating, British male
|
||||||
|
|
||||||
VOICE_PROMPT = """Du bist ein hilfreicher Sprachassistent von Agiliton in einem Matrix-Anruf.
|
VOICE_PROMPT_TEMPLATE = """Du bist ein hilfreicher Sprachassistent von Agiliton in einem Matrix-Anruf.
|
||||||
Du heisst "Agiliton Assistant". Sage NIEMALS du seist Claude, Sonnet, oder ein anderes Modell.
|
Du heisst "Agiliton Assistant". Du basierst auf dem Modell {model}.
|
||||||
|
Wenn jemand fragt welches Modell du bist, sei transparent und sage es.
|
||||||
|
|
||||||
|
Aktuelle Zeit: {datetime}
|
||||||
|
|
||||||
STRIKTE Regeln:
|
STRIKTE Regeln:
|
||||||
- Antworte IMMER auf Deutsch
|
- Antworte in der Sprache in der der Nutzer spricht
|
||||||
- Halte JEDE Antwort auf MAXIMAL 1-2 kurze Saetze
|
- Halte JEDE Antwort auf MAXIMAL 1-2 kurze Saetze
|
||||||
- Sei direkt und praezise, keine Fuellwoerter
|
- Sei direkt und praezise, keine Fuellwoerter
|
||||||
- Erfinde NICHTS - keine Geschichten, keine Musik, keine Fantasie
|
- Erfinde NICHTS - keine Geschichten, keine Musik, keine Fantasie
|
||||||
@@ -312,7 +315,9 @@ class VoiceSession:
|
|||||||
def _on_agent_speech(msg):
|
def _on_agent_speech(msg):
|
||||||
logger.info("AGENT_SPEECH: %s", msg.text_content)
|
logger.info("AGENT_SPEECH: %s", msg.text_content)
|
||||||
|
|
||||||
agent = Agent(instructions=VOICE_PROMPT)
|
now = datetime.datetime.now(datetime.timezone.utc).strftime("%A, %B %d, %Y %H:%M UTC")
|
||||||
|
prompt = VOICE_PROMPT_TEMPLATE.format(model=self.model, datetime=now)
|
||||||
|
agent = Agent(instructions=prompt)
|
||||||
io_opts = room_io.RoomOptions(
|
io_opts = room_io.RoomOptions(
|
||||||
participant_identity=remote_identity,
|
participant_identity=remote_identity,
|
||||||
) if remote_identity else room_io.RoomOptions()
|
) if remote_identity else room_io.RoomOptions()
|
||||||
|
|||||||
Reference in New Issue
Block a user