Update bot_definitions.py
Browse files- bot_definitions.py +42 -48
bot_definitions.py
CHANGED
@@ -1,55 +1,49 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
from bot_registry import BotRegistry, BotType
|
5 |
-
from bot_runner_helpers import (
|
6 |
-
create_call_transfer_settings,
|
7 |
-
create_simple_dialin_settings,
|
8 |
-
create_simple_dialout_settings,
|
9 |
-
)
|
10 |
|
11 |
-
# Create and configure the bot registry
|
12 |
-
bot_registry = BotRegistry()
|
13 |
-
|
14 |
-
# Register bot types
|
15 |
-
bot_registry.register(
|
16 |
-
BotType(
|
17 |
-
name="call_transfer",
|
18 |
-
settings_creator=create_call_transfer_settings,
|
19 |
-
required_settings=["dialin_settings"],
|
20 |
-
incompatible_with=["simple_dialin", "simple_dialout", "voicemail_detection"],
|
21 |
-
auto_add_settings={"dialin_settings": {}},
|
22 |
-
)
|
23 |
-
)
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
)
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
auto_add_settings={"dialout_settings": [{}]},
|
42 |
-
)
|
43 |
)
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
required_settings=["dialout_settings"],
|
52 |
-
incompatible_with=["call_transfer", "simple_dialin", "simple_dialout"],
|
53 |
-
auto_add_settings={"dialout_settings": [{}]},
|
54 |
-
)
|
55 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dataclasses import dataclass
|
2 |
+
from typing import Dict, Optional, Any
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
@dataclass
|
6 |
+
class BotType:
|
7 |
+
name: str
|
8 |
+
module: str
|
9 |
+
config_key: str
|
10 |
+
environment_variables: list[str]
|
11 |
+
optional_environment_variables: list[str]
|
12 |
+
|
13 |
+
def has_test_mode(self, body: Dict[str, Any]) -> bool:
|
14 |
+
if self.config_key in body:
|
15 |
+
return bool(body[self.config_key].get("testInPrebuilt"))
|
16 |
+
return False
|
17 |
+
|
18 |
+
|
19 |
+
call_transfer = BotType(
|
20 |
+
name="call_transfer",
|
21 |
+
module="call_transfer",
|
22 |
+
config_key="call_transfer",
|
23 |
+
environment_variables=["DAILY_API_KEY", "OPENAI_API_KEY", "CARTESIA_API_KEY"],
|
24 |
+
optional_environment_variables=["DIAL_IN_FROM_NUMBER", "DIAL_OUT_TO_NUMBER", "OPERATOR_NUMBER"],
|
25 |
)
|
26 |
|
27 |
+
simple_dialin = BotType(
|
28 |
+
name="simple_dialin",
|
29 |
+
module="simple_dialin",
|
30 |
+
config_key="simple_dialin",
|
31 |
+
environment_variables=["DAILY_API_KEY", "OPENAI_API_KEY", "CARTESIA_API_KEY"],
|
32 |
+
optional_environment_variables=["DIAL_IN_FROM_NUMBER"],
|
|
|
|
|
33 |
)
|
34 |
|
35 |
+
simple_dialout = BotType(
|
36 |
+
name="simple_dialout",
|
37 |
+
module="simple_dialout",
|
38 |
+
config_key="simple_dialout",
|
39 |
+
environment_variables=["DAILY_API_KEY", "OPENAI_API_KEY", "CARTESIA_API_KEY"],
|
40 |
+
optional_environment_variables=["DIAL_OUT_TO_NUMBER"],
|
|
|
|
|
|
|
|
|
41 |
)
|
42 |
+
|
43 |
+
voicemail_detection = BotType(
|
44 |
+
name="voicemail_detection",
|
45 |
+
module="voicemail_detection",
|
46 |
+
config_key="voicemail_detection",
|
47 |
+
environment_variables=["DAILY_API_KEY", "OPENAI_API_KEY", "DEEPGRAM_API_KEY", "CARTESIA_API_KEY"],
|
48 |
+
optional_environment_variables=["DIAL_OUT_TO_NUMBER"],
|
49 |
+
)
|