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

quality: Code quality

Clémence Lesnédb293193b457
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 456c4fb..01fb9ef 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,4 +1,4 @@
-allure-pytest==2.13.3
+allure-pytest==2.13.3 # Required for pytest
black[jupyter]==24.2.0
deepeval==0.20.89
pur==7.3.1
diff --git a/tests/cache.py b/tests/cache.py
index e25a578..c8e1216 100644
--- a/tests/cache.py
+++ b/tests/cache.py
@@ -19,9 +19,20 @@ _cache = CONFIG.cache.instance()
),
],
)
[email protected] # Allow async functions
@pytest.mark.repeat(10) # Catch multi-threading and concurrency issues
async def test_acid(random_text: str, cache_mode: CacheModeEnum) -> None:
+ """
+ Test ACID properties of the cache backend.
+
+ Steps:
+ 1. Create a mock data
+ 2. Test not exists
+ 3. Insert test data
+ 4. Check it exists
+
+ Test is repeated 10 times to catch multi-threading and concurrency issues.
+ """
# Set cache mode
CONFIG.cache.mode = cache_mode
diff --git a/tests/llm.py b/tests/llm.py
index 9e8ef52..6e19452 100644
--- a/tests/llm.py
+++ b/tests/llm.py
@@ -139,7 +139,7 @@ CONFIG.workflow.lang.default_short_code = "en-US" # Force language to English
),
],
)
[email protected] # Allow async functions
@pytest.mark.repeat(3) # Catch non deterministic issues
async def test_llm(
call_mock: CallModel,
@@ -149,6 +149,15 @@ async def test_llm(
expected_output: str,
inputs: list[str],
) -> None:
+ """
+ Test the LLM with a mocked conversation against the expected output.
+
+ Steps:
+ 1. Run application with mocked inputs
+ 2. Combine all outputs
+ 3. Test claim data exists
+ 4. Test LLM metrics
+ """
actual_output = ""
latency_per_input = 0
diff --git a/tests/search.py b/tests/search.py
index 9fe9ff6..ade6d5c 100644
--- a/tests/search.py
+++ b/tests/search.py
@@ -35,7 +35,7 @@ _search = CONFIG.ai_search.instance()
),
],
)
[email protected] # Allow async functions
@pytest.mark.repeat(10) # Catch multi-threading and concurrency issues
async def test_relevancy(
call_mock: CallModel,
@@ -43,6 +43,16 @@ async def test_relevancy(
user_lang: str,
user_message: str,
) -> None:
+ """
+ Test the relevancy of the user message to the training data.
+
+ Steps:
+ 1. Search for training data
+ 2. Ask the LLM for relevancy score
+ 3. Assert the relevancy score is above 0.5
+
+ Test is repeated 10 times to catch multi-threading and concurrency issues.
+ """
# Configure context
call_mock.lang.short_code = user_lang
diff --git a/tests/store.py b/tests/store.py
index 209e0e0..3981745 100644
--- a/tests/store.py
+++ b/tests/store.py
@@ -20,9 +20,20 @@ _db = CONFIG.database.instance()
),
],
)
[email protected] # Allow async functions
@pytest.mark.repeat(10) # Catch multi-threading and concurrency issues
async def test_acid(call_mock: CallModel, database_mode: DatabaseModeEnum) -> None:
+ """
+ Test ACID properties of the database backend.
+
+ Steps:
+ 1. Create a mock data
+ 2. Test not exists
+ 3. Insert test data
+ 4. Check it exists
+
+ Test is repeated 10 times to catch multi-threading and concurrency issues.
+ """
# Set database mode
CONFIG.database.mode = database_mode