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: Load trainings in the tests

Clémence Lesné8783fd9117d4
diff --git a/function_app.py b/function_app.py
index a73ef0d..b61dde3 100644
--- a/function_app.py
+++ b/function_app.py
@@ -553,7 +553,7 @@ async def trainings_event(
trace.get_current_span().set_attribute(
SpanAttributes.ENDUSER_ID, call.initiate.phone_number
)
- await call.trainings() # Get trainings by advance to populate cache
+ await call.trainings(cache_only=False) # Get trainings by advance to populate cache
@app.queue_trigger(
diff --git a/models/call.py b/models/call.py
index d3db0c7..e58122a 100644
--- a/models/call.py
+++ b/models/call.py
@@ -105,7 +105,7 @@ class CallStateModel(CallGetModel):
def lang(self, short_code: str) -> None:
self.lang_short_code = short_code
- async def trainings(self, cache_only: bool = False) -> list[TrainingModel]:
+ async def trainings(self, cache_only: bool = True) -> list[TrainingModel]:
"""
Get the trainings from the last messages.
diff --git a/tests/search.py b/tests/search.py
index f6f0dc3..3ad7bc1 100644
--- a/tests/search.py
+++ b/tests/search.py
@@ -139,7 +139,7 @@ async def test_relevancy(
)
# Get trainings
- trainings = await call.trainings()
+ trainings = await call.trainings(cache_only=False)
logger.info(f"Messages: {call.messages}")
logger.info(f"Trainings: {trainings}")