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: Documentation to enum constants

Clémence Lesné277a8fb5e24b
diff --git a/app/helpers/call_utils.py b/app/helpers/call_utils.py
index f678b87..6fdbdf0 100644
--- a/app/helpers/call_utils.py
+++ b/app/helpers/call_utils.py
@@ -85,10 +85,14 @@ class ContextEnum(str, Enum):
Used to track the operation context of a call in Azure Communication Services.
"""
- GOODBYE = "goodbye" # Hang up
- IVR_LANG_SELECT = "ivr_lang_select" # IVR language selection
- START_REALTIME = "start_realtime" # Start realtime call
- TRANSFER_FAILED = "transfer_failed" # Transfer failed
+ GOODBYE = "goodbye"
+ """Hang up"""
+ IVR_LANG_SELECT = "ivr_lang_select"
+ """IVR language selection"""
+ START_REALTIME = "start_realtime"
+ """Start realtime call"""
+ TRANSFER_FAILED = "transfer_failed"
+ """Transfer failed"""
def tts_sentence_split(
diff --git a/app/helpers/config_models/cache.py b/app/helpers/config_models/cache.py
index 454349b..44d70cf 100644
--- a/app/helpers/config_models/cache.py
+++ b/app/helpers/config_models/cache.py
@@ -8,7 +8,9 @@ from app.persistence.icache import ICache
class ModeEnum(str, Enum):
MEMORY = "memory"
+ """Use memory cache."""
REDIS = "redis"
+ """Use Redis cache."""
class MemoryModel(BaseModel, frozen=True):
diff --git a/app/helpers/config_models/llm.py b/app/helpers/config_models/llm.py
index a5c6e35..a7ba8ba 100644
--- a/app/helpers/config_models/llm.py
+++ b/app/helpers/config_models/llm.py
@@ -11,7 +11,9 @@ from app.helpers.identity import token
class ModeEnum(str, Enum):
AZURE_OPENAI = "azure_openai"
+ """Use Azure OpenAI."""
OPENAI = "openai"
+ """Use OpenAI."""
class AbstractPlatformModel(BaseModel, frozen=True):
diff --git a/app/helpers/config_models/sms.py b/app/helpers/config_models/sms.py
index 54b2207..c8ba335 100644
--- a/app/helpers/config_models/sms.py
+++ b/app/helpers/config_models/sms.py
@@ -9,7 +9,9 @@ from app.persistence.isms import ISms
class ModeEnum(str, Enum):
COMMUNICATION_SERVICES = "communication_services"
+ """Use Communication Services."""
TWILIO = "twilio"
+ """Use Twilio."""
class CommunicationServiceModel(BaseModel, frozen=True):
diff --git a/app/models/claim.py b/app/models/claim.py
index e0b0eea..6ac5469 100644
--- a/app/models/claim.py
+++ b/app/models/claim.py
@@ -5,9 +5,13 @@ from pydantic import BaseModel
class ClaimTypeEnum(str, Enum):
DATETIME = "datetime"
+ """Parsed to a Python datetime object."""
EMAIL = "email"
+ """Validated as an email address string."""
PHONE_NUMBER = "phone_number"
+ """Validated as a phone number string."""
TEXT = "text"
+ """Validated as a string."""
class ClaimFieldModel(BaseModel):
diff --git a/app/models/message.py b/app/models/message.py
index e1f82d6..f31ea61 100644
--- a/app/models/message.py
+++ b/app/models/message.py
@@ -32,20 +32,27 @@ class StyleEnum(str, Enum):
"""
CHEERFUL = "cheerful"
- NONE = "none" # This is not a valid style, but we use it in the code to indicate no style
+ NONE = "none"
+ """This is not a valid style, but we use it in the code to indicate no style."""
SAD = "sad"
class ActionEnum(str, Enum):
CALL = "call"
+ """User called the assistant."""
HANGUP = "hangup"
+ """User hung up the call."""
SMS = "sms"
+ """User sent an SMS."""
TALK = "talk"
+ """User sent a message."""
class PersonaEnum(str, Enum):
ASSISTANT = "assistant"
+ """Represents an AI assistant."""
HUMAN = "human"
+ """Represents a human user."""
TOOL = "tool"
"""Not used but deprecated, kept for backward compatibility."""
diff --git a/app/models/readiness.py b/app/models/readiness.py
index 4e4c669..b646679 100644
--- a/app/models/readiness.py
+++ b/app/models/readiness.py
@@ -5,7 +5,9 @@ from pydantic import BaseModel
class ReadinessEnum(str, Enum):
FAIL = "fail"
+ """The service is not ready."""
OK = "ok"
+ """The service is ready."""
class ReadinessCheckModel(BaseModel):
diff --git a/app/models/synthesis.py b/app/models/synthesis.py
index 4f2181a..4d9e1a9 100644
--- a/app/models/synthesis.py
+++ b/app/models/synthesis.py
@@ -4,10 +4,14 @@ from pydantic import BaseModel, Field
class SatisfactionEnum(str, Enum):
- TERRIBLE = "terrible" # 1
- LOW = "low" # 2
- PARTIAL = "partial" # 3
- HIGH = "high" # 4
+ TERRIBLE = "terrible"
+ """Satisfaction is very low (1/4)."""
+ LOW = "low"
+ """Satisfaction is low (2/4)."""
+ PARTIAL = "partial"
+ """Satisfaction is partial (3/4)."""
+ HIGH = "high"
+ """Satisfaction is high (4/4)."""
UNKNOW = "unknow"