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: Code lint

Clémence Lesnébd2b3b81a012
diff --git a/app/helpers/call_llm.py b/app/helpers/call_llm.py
index e329d1e..d597b04 100644
--- a/app/helpers/call_llm.py
+++ b/app/helpers/call_llm.py
@@ -52,7 +52,7 @@ from app.models.message import (
_db = CONFIG.database.instance()
-# TODO: Refacto, this function is too long (and remove PLR0913 ignore)
+# TODO: Refacto, this function is too long
@tracer.start_as_current_span("call_load_llm_chat")
async def load_llm_chat( # noqa: PLR0913
audio_bits_per_sample: int,
@@ -211,7 +211,7 @@ async def load_llm_chat( # noqa: PLR0913
# TODO: Refacto, this function is too long (and remove PLR0912/PLR0915 ignore)
@tracer.start_as_current_span("call_load_out_answer")
-async def _out_answer( # noqa: PLR0915
+async def _out_answer( # noqa: PLR0913, PLR0915
call: CallStateModel,
client: CallAutomationClient,
post_callback: Callable[[CallStateModel], Awaitable[None]],
@@ -385,9 +385,9 @@ async def _out_answer( # noqa: PLR0915
return call
-# TODO: Refacto, this function is too long (and remove PLR0911/PLR0912/PLR0915 ignore)
+# TODO: Refacto, this function is too long
@tracer.start_as_current_span("call_execute_llm_chat")
-async def _execute_llm_chat( # noqa: PLR0911, PLR0912, PLR0915
+async def _execute_llm_chat( # noqa: PLR0913, PLR0911, PLR0912, PLR0915
call: CallStateModel,
client: CallAutomationClient,
post_callback: Callable[[CallStateModel], Awaitable[None]],
diff --git a/app/persistence/redis.py b/app/persistence/redis.py
index 45eec60..a64a922 100644
--- a/app/persistence/redis.py
+++ b/app/persistence/redis.py
@@ -6,7 +6,11 @@ from opentelemetry.instrumentation.redis import RedisInstrumentor
from redis.asyncio import Redis
from redis.asyncio.retry import Retry
from redis.backoff import ExponentialBackoff
-from redis.exceptions import BusyLoadingError, ConnectionError, RedisError
+from redis.exceptions import (
+ BusyLoadingError,
+ ConnectionError as RedisConnectionError,
+ RedisError,
+)
from app.helpers.config_models.cache import RedisModel
from app.helpers.logging import logger
@@ -31,7 +35,7 @@ class RedisCache(ICache):
db=config.database,
# Reliability
health_check_interval=10, # Check the health of the connection every 10 secs
- retry_on_error=[BusyLoadingError, ConnectionError],
+ retry_on_error=[BusyLoadingError, RedisConnectionError],
retry_on_timeout=True,
retry=_retry,
socket_connect_timeout=5, # Give the system sufficient time to connect even under higher CPU conditions