Ideal UX:
@pytest.mark.asyncio
async def test_agent_handles_profanity():
async with VAPICall(
phone_number="+15551234567",
api_key="your-bland-key",
background_noise=BackgroundNoise.TRAFFIC,
noise_level=0.4,
speaking_style=SpeakingStyle(
accent="american",
speed=1.4, # Speaking fast when angry
),
) as call:
await call.listen() # Greeting
await call.say(
"This is bullshit, I want to speak to a manager!",
emotion="angry",
)
response = await call.listen()
# Agent should remain professional and de-escalate
await expect(response).to_satisfy(
"remains calm and professional",
"does not mirror the profanity",
"offers to escalate or resolve the issue",
llm=judge
)
expect(response.audio).to_not_have_emotion("angry")
expect(response.latency).to_be_less_than(2.5)