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é275569135514
diff --git a/helpers/identity.py b/helpers/identity.pyindex ecd3d58..80893f7 100644--- a/helpers/identity.py+++ b/helpers/identity.py@@ -8,7 +8,7 @@ _client: DefaultAzureCredential | None = Noneasync def credential() -> DefaultAzureCredential:- global _client+ global _client # noqa: PLW0603if not _client:_client = DefaultAzureCredential(# Performancediff --git a/helpers/llm_tools.py b/helpers/llm_tools.pyindex 3f8f238..65d316c 100644--- a/helpers/llm_tools.py+++ b/helpers/llm_tools.py@@ -2,12 +2,11 @@ import asynciofrom collections.abc import Awaitable, Callablefrom html import escapefrom inspect import getmembers, isfunction-from typing import Annotated, Literal+from typing import Annotated, Literal, TypedDictfrom azure.communication.callautomation.aio import CallAutomationClientfrom openai.types.chat import ChatCompletionToolParamfrom pydantic import ValidationError-from typing_extensions import TypedDictfrom helpers.call_utils import ContextEnum as CallContextEnum, handle_play_textfrom helpers.config import CONFIGdiff --git a/main.py b/main.pyindex b7434a5..9778233 100644--- a/main.py+++ b/main.py@@ -105,7 +105,7 @@ logger.info("Using call event URL %s", _COMMUNICATIONSERVICES_CALLABACK_TPL)@asynccontextmanager-async def lifespan(app: FastAPI):+async def lifespan(app: FastAPI): # noqa: ARG001call_task = asyncio.create_task(_call_queue.trigger(arg="call",@@ -843,7 +843,7 @@ async def twilio_sms_post(@api.exception_handler(StarletteHTTPException)-async def http_exception_handler(request: Request, exc: StarletteHTTPException):+async def http_exception_handler(request: Request, exc: StarletteHTTPException): # noqa: ARG001"""Handle HTTP exceptions and return the error in a standard format."""@@ -854,7 +854,7 @@ async def http_exception_handler(request: Request, exc: StarletteHTTPException):@api.exception_handler(RequestValidationError)-async def validation_exception_handler(request: Request, exc: RequestValidationError):+async def validation_exception_handler(request: Request, exc: RequestValidationError): # noqa: ARG001"""Handle validation exceptions and return the error in a standard format."""diff --git a/tests/cache.py b/tests/cache.pyindex 86c86dd..31f5813 100644--- a/tests/cache.py+++ b/tests/cache.py@@ -1,5 +1,5 @@import pytest-from pytest import assume+from pytest_assume.plugin import assumefrom helpers.config import CONFIGfrom helpers.config_models.cache import ModeEnum as CacheModeEnumdiff --git a/tests/llm.py b/tests/llm.pyindex c9aca40..287e56e 100644--- a/tests/llm.py+++ b/tests/llm.py@@ -15,7 +15,7 @@ from deepeval.metrics import (from deepeval.models.gpt_model import GPTModelfrom deepeval.test_case import LLMTestCasefrom pydantic import TypeAdapter-from pytest import assume+from pytest_assume.plugin import assumefrom helpers.call_events import (on_call_connected,@@ -274,6 +274,9 @@ async def test_llm( # noqa: PLR0913await on_call_connected(call=call,client=automation_client,+ post_callback=_post_callback,+ server_call_id="dummy",+ training_callback=_training_callback,)# First IVRdiff --git a/tests/local.py b/tests/local.pyindex 098885b..803de29 100644--- a/tests/local.py+++ b/tests/local.py@@ -56,6 +56,9 @@ async def main() -> None:await on_call_connected(call=call,client=automation_client,+ post_callback=_post_callback,+ server_call_id="dummy",+ training_callback=_training_callback,)# First IVRdiff --git a/tests/search.py b/tests/search.pyindex 9d01836..86a253c 100644--- a/tests/search.py+++ b/tests/search.py@@ -7,7 +7,7 @@ from deepeval.metrics import BaseMetricfrom deepeval.models.gpt_model import GPTModelfrom deepeval.test_case import LLMTestCasefrom pydantic import TypeAdapter-from pytest import assume+from pytest_assume.plugin import assumefrom helpers.config import CONFIGfrom helpers.logging import loggerdiff --git a/tests/store.py b/tests/store.pyindex dd17113..7ad5f85 100644--- a/tests/store.py+++ b/tests/store.py@@ -1,5 +1,5 @@import pytest-from pytest import assume+from pytest_assume.plugin import assumefrom helpers.config import CONFIGfrom helpers.config_models.database import ModeEnum as DatabaseModeEnum