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 comments

Clémence Lesné9dd3dc09529b
diff --git a/persistence/ai_search.py b/persistence/ai_search.py
index abfe4f5..076c072 100644
--- a/persistence/ai_search.py
+++ b/persistence/ai_search.py
@@ -128,6 +128,9 @@ class AiSearchSearch(ISearch):
@asynccontextmanager
async def _use_db(self) -> AsyncGenerator[SearchClient, None]:
+ """
+ Generate the AI Search client and close it after use.
+ """
db = SearchClient(
credential=AzureKeyCredential(self._config.access_key.get_secret_value()),
endpoint=self._config.endpoint,
diff --git a/persistence/cosmos_db.py b/persistence/cosmos_db.py
index 6323a5b..4612964 100644
--- a/persistence/cosmos_db.py
+++ b/persistence/cosmos_db.py
@@ -139,6 +139,9 @@ class CosmosDbStore(IStore):
@asynccontextmanager
async def _use_db(self) -> AsyncGenerator[ContainerProxy, None]:
+ """
+ Generate the Cosmos DB client and close it after use.
+ """
client = CosmosClient(
# Reliability
connection_timeout=10,
diff --git a/persistence/redis.py b/persistence/redis.py
index 5799739..884aa77 100644
--- a/persistence/redis.py
+++ b/persistence/redis.py
@@ -48,6 +48,9 @@ class RedisCache(ICache):
@asynccontextmanager
async def _use_db(self) -> AsyncGenerator[Redis, None]:
+ """
+ Generate the Redis client and close it after use.
+ """
client = Redis(
# Database location
db=self._config.database,
diff --git a/persistence/sqlite.py b/persistence/sqlite.py
index 09a62f0..8946ec3 100644
--- a/persistence/sqlite.py
+++ b/persistence/sqlite.py
@@ -123,6 +123,9 @@ class SqliteStore(IStore):
@asynccontextmanager
async def _use_db(self) -> AsyncGenerator[SQLiteConnection, None]:
+ """
+ Generate the SQLite client and close it after use.
+ """
# Create folder
db_path = self._config.full_path()
first_run = False