rasa-pro 3.11.10__py3-none-any.whl → 3.11.11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rasa-pro might be problematic. Click here for more details.

@@ -6,7 +6,18 @@ import uuid
6
6
  from collections import defaultdict
7
7
  from dataclasses import asdict
8
8
  from datetime import datetime, timedelta, timezone
9
- from typing import Any, Awaitable, Callable, Dict, List, Optional, Set, Text, Union
9
+ from typing import (
10
+ Any,
11
+ Awaitable,
12
+ Callable,
13
+ Dict,
14
+ List,
15
+ Optional,
16
+ Set,
17
+ Text,
18
+ Union,
19
+ Tuple,
20
+ )
10
21
 
11
22
  import structlog
12
23
  from jsonschema import ValidationError, validate
@@ -48,8 +59,8 @@ def map_call_params(parameters: Dict[Text, Any]) -> CallParameters:
48
59
  """Map the Audiocodes parameters to the CallParameters dataclass."""
49
60
  return CallParameters(
50
61
  call_id=parameters.get("vaigConversationId"),
51
- user_phone=parameters.get("callee"),
52
- bot_phone=parameters.get("caller"),
62
+ user_phone=parameters.get("caller"),
63
+ bot_phone=parameters.get("callee"),
53
64
  user_name=parameters.get("callerDisplayName"),
54
65
  user_host=parameters.get("callerHost"),
55
66
  bot_host=parameters.get("calleeHost"),
@@ -76,35 +87,45 @@ class Conversation:
76
87
 
77
88
  @staticmethod
78
89
  def get_metadata(activity: Dict[Text, Any]) -> Optional[Dict[Text, Any]]:
79
- """Get metadata from the activity."""
80
- return asdict(map_call_params(activity["parameters"]))
90
+ """Get metadata from the activity.
91
+
92
+ ONLY used for activities NOT for events (see _handle_event)."""
93
+ return activity.get("parameters")
81
94
 
82
95
  @staticmethod
83
- def _handle_event(event: Dict[Text, Any]) -> Text:
84
- """Handle start and DTMF event and return the corresponding text."""
96
+ def _handle_event(event: Dict[Text, Any]) -> Tuple[Text, Dict[Text, Any]]:
97
+ """Handle events and return a tuple of text and metadata.
98
+
99
+ Args:
100
+ event: The event to handle.
101
+
102
+ Returns:
103
+ Tuple of text and metadata.
104
+ text is either /session_start or /vaig_event_<event_name>
105
+ metadata is a dictionary with the event parameters.
106
+ """
85
107
  structlogger.debug("audiocodes.handle.event", event_payload=event)
86
108
  if "name" not in event:
87
109
  structlogger.warning(
88
110
  "audiocodes.handle.event.no_name_key", event_payload=event
89
111
  )
90
- return ""
112
+ return "", {}
91
113
 
92
114
  if event["name"] == EVENT_START:
93
115
  text = f"{INTENT_MESSAGE_PREFIX}{USER_INTENT_SESSION_START}"
116
+ metadata = asdict(map_call_params(event.get("parameters", {})))
94
117
  elif event["name"] == EVENT_DTMF:
95
118
  text = f"{INTENT_MESSAGE_PREFIX}vaig_event_DTMF"
96
- event_params = {"value": event["value"]}
97
- text += json.dumps(event_params)
119
+ metadata = {"value": event["value"]}
98
120
  else:
99
121
  # handle other events described by Audiocodes
100
122
  # https://techdocs.audiocodes.com/voice-ai-connect/#VAIG_Combined/inactivity-detection.htm?TocPath=Bot%2520integration%257CReceiving%2520notifications%257C_____3
101
123
  text = f"{INTENT_MESSAGE_PREFIX}vaig_event_{event['name']}"
102
- event_params = {**event.get("parameters", {})}
124
+ metadata = {**event.get("parameters", {})}
103
125
  if "value" in event:
104
- event_params["value"] = event["value"]
105
- text += json.dumps(event_params)
126
+ metadata["value"] = event["value"]
106
127
 
107
- return text
128
+ return text, metadata
108
129
 
109
130
  def is_active_conversation(self, now: datetime, delta: timedelta) -> bool:
110
131
  """Check if the conversation is active."""
@@ -150,16 +171,18 @@ class Conversation:
150
171
  self.activity_ids.append(activity[ACTIVITY_ID_KEY])
151
172
  if activity["type"] == ACTIVITY_MESSAGE:
152
173
  text = activity["text"]
174
+ metadata = self.get_metadata(activity)
153
175
  elif activity["type"] == ACTIVITY_EVENT:
154
- text = self._handle_event(activity)
176
+ text, metadata = self._handle_event(activity)
155
177
  else:
156
178
  structlogger.warning(
157
179
  "audiocodes.handle.activities.unknown_activity_type",
158
180
  activity=activity,
159
181
  )
182
+ continue
183
+
160
184
  if not text:
161
185
  continue
162
- metadata = self.get_metadata(activity)
163
186
  user_msg = UserMessage(
164
187
  text=text,
165
188
  input_channel=input_channel_name,
rasa/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  # this file will automatically be changed,
2
2
  # do not add anything but the version number here!
3
- __version__ = "3.11.10"
3
+ __version__ = "3.11.11"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rasa-pro
3
- Version: 3.11.10
3
+ Version: 3.11.11
4
4
  Summary: State-of-the-art open-core Conversational AI framework for Enterprises that natively leverages generative AI for effortless assistant development.
5
5
  Keywords: nlp,machine-learning,machine-learning-library,bot,bots,botkit,rasa conversational-agents,conversational-ai,chatbot,chatbot-framework,bot-framework
6
6
  Author: Rasa Technologies GmbH
@@ -265,7 +265,7 @@ rasa/core/channels/telegram.py,sha256=5BrNECFM3qe9XjNpDb8Q9fbqCT5aKr5L6IH21W8sum
265
265
  rasa/core/channels/twilio.py,sha256=GsdjfplZdBj0fRB60bSggPF1DXFZ_x18V_dlcDy5VFs,5943
266
266
  rasa/core/channels/vier_cvg.py,sha256=PfvSluQqgJbP0JzZPFUvum3z7H55JPPeobcD-z5zCkw,13544
267
267
  rasa/core/channels/voice_ready/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
268
- rasa/core/channels/voice_ready/audiocodes.py,sha256=jJmLkqI2RciTvB7cAsvRJi_EL70dRyiwNwPWzVPSUj0,21888
268
+ rasa/core/channels/voice_ready/audiocodes.py,sha256=T1Tx2z4HvDhNiehsRynQ9xaJkgP9wbpILCzI_SYyD78,22289
269
269
  rasa/core/channels/voice_ready/jambonz.py,sha256=S7yjdj7nYwQWMalqcGv8eomZGj0c2Dza-51tiNHEpVM,4784
270
270
  rasa/core/channels/voice_ready/jambonz_protocol.py,sha256=OzW-6YMU2SIc88Mur_wktbiE46igHR8vH17DCfRijIU,13139
271
271
  rasa/core/channels/voice_ready/twilio_voice.py,sha256=z2pdausxQnXQP9htGh8AL2q9AvcMIx70Y5tErWpssV4,16224
@@ -779,9 +779,9 @@ rasa/utils/train_utils.py,sha256=f1NWpp5y6al0dzoQyyio4hc4Nf73DRoRSHDzEK6-C4E,212
779
779
  rasa/utils/url_tools.py,sha256=JQcHL2aLqLHu82k7_d9imUoETCm2bmlHaDpOJ-dKqBc,1218
780
780
  rasa/utils/yaml.py,sha256=KjbZq5C94ZP7Jdsw8bYYF7HASI6K4-C_kdHfrnPLpSI,2000
781
781
  rasa/validator.py,sha256=O1wjCeV7ITJ0luvb3GCWy8x1fGgzWVbClEMlPnLBowQ,67265
782
- rasa/version.py,sha256=pyAPlQXkP-rQmG_UV6VI6hvQcb20q31MmlJ3pMgkNik,118
783
- rasa_pro-3.11.10.dist-info/METADATA,sha256=qWOhRdBx8QpPqHsZGkp2NQaj5blpEUsPyd6VX50_32A,10729
784
- rasa_pro-3.11.10.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
785
- rasa_pro-3.11.10.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
786
- rasa_pro-3.11.10.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
787
- rasa_pro-3.11.10.dist-info/RECORD,,
782
+ rasa/version.py,sha256=_ZBgTfcNiibsOC-yzALLSC5ZIpzax2a9zTS3lVn3J3s,118
783
+ rasa_pro-3.11.11.dist-info/METADATA,sha256=rZj6MixMKB8347G-ug6_VB0ArvBxd2HI-s0_EHHrSMU,10729
784
+ rasa_pro-3.11.11.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
785
+ rasa_pro-3.11.11.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
786
+ rasa_pro-3.11.11.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
787
+ rasa_pro-3.11.11.dist-info/RECORD,,