Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

fix: Add static prompts to the conversation history

Clémence Lesné64605526dc8b
diff --git a/main.py b/main.py
index 2f4d7ee..b4865a4 100644
--- a/main.py
+++ b/main.py
@@ -296,6 +296,9 @@ async def call_event_post(request: Request, call_id: UUID) -> None:
if event_type == "Microsoft.Communication.CallConnected":
_logger.info(f"Call connected ({call.id})")
+ call.messages.append(
+ CallMessageModel(content=HELLO_PROMPT, persona=CallPersona.ASSISTANT)
+ )
await handle_recognize(
call=call,
client=client,
@@ -335,6 +338,9 @@ async def call_event_post(request: Request, call_id: UUID) -> None:
)
if error_code == 8510 and call.recognition_retry < 10:
+ call.messages.append(
+ CallMessageModel(content=TIMEOUT_SILENCE_PROMPT, persona=CallPersona.ASSISTANT)
+ )
await handle_recognize(
call=call,
client=client,