Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
fix: Test run after new VAD algoritm implementation
Clémence Lesné1fa849097c88
diff --git a/tests/llm.py b/tests/llm.pyindex eeeab28..337bcf0 100644--- a/tests/llm.py+++ b/tests/llm.py@@ -3,6 +3,7 @@ import jsonimport refrom datetime import datetime+import aiojobsimport pytestfrom deepeval import assert_testfrom deepeval.metrics import (@@ -23,10 +24,11 @@ from app.helpers.call_events import (on_end_call,on_ivr_recognized,on_play_completed,- on_speech_recognized,)+from app.helpers.call_llm import _out_answerfrom app.helpers.logging import loggerfrom app.models.call import CallStateModel+from app.models.message import MessageModel, PersonaEnum as MessagePersonaEnumfrom app.models.reminder import ReminderModelfrom app.models.training import TrainingModelfrom tests.conftest import CallAutomationClientMock, with_conversations@@ -285,24 +287,33 @@ async def test_llm( # noqa: PLR0913)# Simulate conversation with speech recognition- for speech in speeches:- # Respond- await on_speech_recognized(- call=call,- client=automation_client,- post_callback=_post_callback,- text=speech,- training_callback=_training_callback,- )- # Receip- await on_play_completed(- call=call,- client=automation_client,- contexts=call_client.last_contexts,- post_callback=_post_callback,- )- # Reset contexts- call_client.last_contexts.clear()+ async with aiojobs.Scheduler() as scheduler:+ for speech in speeches:+ # Add message to history+ call.messages.append(+ MessageModel(+ content=speech,+ persona=MessagePersonaEnum.HUMAN,+ )+ )++ # Respond+ await _out_answer(+ call=call,+ client=automation_client,+ post_callback=_post_callback,+ scheduler=scheduler,+ training_callback=_training_callback,+ )+ # Receip+ await on_play_completed(+ call=call,+ client=automation_client,+ contexts=call_client.last_contexts,+ post_callback=_post_callback,+ )+ # Reset contexts+ call_client.last_contexts.clear()# Disconnect callawait on_call_disconnected(