rasa-pro 3.12.22__py3-none-any.whl → 3.12.24__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.

@@ -898,7 +898,7 @@ class RemoteAction(Action):
898
898
  draft["buttons"].extend(buttons)
899
899
 
900
900
  # Avoid overwriting `draft` values with empty values
901
- response = {k: v for k, v in response.items() if v is not None}
901
+ response = {k: v for k, v in response.items() if v}
902
902
  draft.update(response)
903
903
  bot_messages.append(create_bot_utterance(draft))
904
904
 
@@ -25,7 +25,7 @@ class ActionRepeatBotMessages(Action):
25
25
  """Return the name of the action."""
26
26
  return ACTION_REPEAT_BOT_MESSAGES
27
27
 
28
- def _get_last_bot_events(self, tracker: DialogueStateTracker) -> List[Event]:
28
+ def _get_last_bot_events(self, tracker: DialogueStateTracker) -> List[BotUttered]:
29
29
  """Get the last consecutive bot events before the most recent user message.
30
30
 
31
31
  This function scans the dialogue history in reverse to find the last sequence of
@@ -48,33 +48,21 @@ class ActionRepeatBotMessages(Action):
48
48
  The elif condition doesn't break when it sees User3 event.
49
49
  But it does at User2 event.
50
50
  """
51
- # Skip action if we are in a collect information step whose
52
- # default behavior is to repeat anyways
53
- top_frame = tracker.stack.top(
54
- lambda frame: isinstance(frame, RepeatBotMessagesPatternFlowStackFrame)
55
- or isinstance(frame, UserSilencePatternFlowStackFrame)
56
- )
57
- if isinstance(top_frame, CollectInformationPatternFlowStackFrame):
58
- return []
59
51
  # filter user and bot events
60
- filtered = [
52
+ user_and_bot_events = [
61
53
  e for e in tracker.events if isinstance(e, (BotUttered, UserUttered))
62
54
  ]
63
- bot_events: List[Event] = []
55
+ last_bot_events: List[BotUttered] = []
64
56
 
65
57
  # find the last BotUttered events
66
- for e in reversed(filtered):
67
- if isinstance(e, BotUttered):
68
- # insert instead of append because the list is reversed
69
- bot_events.insert(0, e)
70
-
71
- # stop if a UserUttered event is found
72
- # only if we have collected some bot events already
73
- # this condition skips the first N UserUttered events
74
- elif bot_events:
58
+ for e in reversed(user_and_bot_events):
59
+ # stop when seeing a user event after having seen bot events already
60
+ if isinstance(e, UserUttered) and len(last_bot_events) > 0:
75
61
  break
62
+ elif isinstance(e, BotUttered):
63
+ last_bot_events.append(e)
76
64
 
77
- return bot_events
65
+ return list(reversed(last_bot_events))
78
66
 
79
67
  async def run(
80
68
  self,
@@ -85,5 +73,13 @@ class ActionRepeatBotMessages(Action):
85
73
  metadata: Optional[Dict[str, Any]] = None,
86
74
  ) -> List[Event]:
87
75
  """Send the last bot messages to the channel again"""
88
- bot_events = self._get_last_bot_events(tracker)
76
+ top_frame = tracker.stack.top(
77
+ lambda frame: isinstance(frame, RepeatBotMessagesPatternFlowStackFrame)
78
+ or isinstance(frame, UserSilencePatternFlowStackFrame)
79
+ )
80
+
81
+ bot_events: List[Event] = list(self._get_last_bot_events(tracker))
82
+ # drop the last bot event in a collect step as that part will be repeated anyway
83
+ if isinstance(top_frame, CollectInformationPatternFlowStackFrame):
84
+ bot_events = bot_events[:-1]
89
85
  return bot_events
@@ -26,7 +26,7 @@ logger = structlog.get_logger(__name__)
26
26
 
27
27
  @dataclass
28
28
  class ASREngineConfig(MergeableConfig):
29
- pass
29
+ keep_alive_interval: int = 5 # seconds
30
30
 
31
31
 
32
32
  class ASREngine(Generic[T]):
@@ -93,3 +93,7 @@ class ASREngine(Generic[T]):
93
93
  def get_default_config() -> T:
94
94
  """Get the default config for this component."""
95
95
  raise NotImplementedError
96
+
97
+ async def send_keep_alive(self) -> None:
98
+ """Send a keep-alive message to the ASR system if supported."""
99
+ pass
@@ -145,3 +145,8 @@ class DeepgramASR(ASREngine[DeepgramASRConfig]):
145
145
  def concatenate_transcripts(t1: str, t2: str) -> str:
146
146
  """Concatenate two transcripts making sure there is a space between them."""
147
147
  return (t1.strip() + " " + t2.strip()).strip()
148
+
149
+ async def send_keep_alive(self) -> None:
150
+ """Send a keep-alive message to the Deepgram websocket connection."""
151
+ if self.asr_socket is not None:
152
+ await self.asr_socket.send(json.dumps({"type": "KeepAlive"}))
@@ -81,6 +81,12 @@ class AudiocodesVoiceOutputChannel(VoiceOutputChannel):
81
81
  logger.debug("Sending start marker", stream_id=self._get_stream_id())
82
82
  await self.voice_websocket.send(media_message)
83
83
 
84
+ # This should be set when the bot actually starts speaking
85
+ # however, Audiocodes does not have an event to indicate that.
86
+ # This is an approximation, as the bot will be sent the audio chunks next
87
+ # which are played to the user immediately.
88
+ call_state.is_bot_speaking = True # type: ignore[attr-defined]
89
+
84
90
  async def send_intermediate_marker(self, recipient_id: str) -> None:
85
91
  """Audiocodes doesn't need intermediate markers, so do nothing."""
86
92
  pass
@@ -173,21 +179,20 @@ class AudiocodesVoiceInputChannel(VoiceInputChannel):
173
179
  if data["type"] == "activities":
174
180
  activities = data["activities"]
175
181
  for activity in activities:
176
- logger.debug("audiocodes_stream.activity", data=activity)
177
182
  if activity["name"] == "start":
178
- # already handled in collect_call_parameters
183
+ # handled in collect_call_parameters
179
184
  pass
180
185
  elif activity["name"] == "dtmf":
181
- # TODO: handle DTMF input
186
+ logger.info("audiocodes_stream.dtmf_ignored", data=activity)
182
187
  pass
183
188
  elif activity["name"] == "playFinished":
184
189
  logger.debug("audiocodes_stream.playFinished", data=activity)
190
+ call_state.is_bot_speaking = False # type: ignore[attr-defined]
185
191
  if call_state.should_hangup:
186
192
  logger.info("audiocodes_stream.hangup")
187
193
  self._send_hangup(ws, data)
188
194
  # the conversation should continue until
189
195
  # we receive a end message from audiocodes
190
- pass
191
196
  else:
192
197
  logger.warning("audiocodes_stream.unknown_activity", data=activity)
193
198
  elif data["type"] == "userStream.start":
@@ -424,10 +424,17 @@ class VoiceInputChannel(InputChannel):
424
424
  call_parameters,
425
425
  )
426
426
 
427
+ async def asr_keep_alive_task() -> None:
428
+ interval = getattr(asr_engine.config, "keep_alive_interval", 5)
429
+ while True:
430
+ await asyncio.sleep(interval)
431
+ await asr_engine.send_keep_alive()
432
+
427
433
  tasks = [
428
434
  asyncio.create_task(consume_audio_bytes()),
429
435
  asyncio.create_task(receive_asr_events()),
430
436
  asyncio.create_task(handle_asr_events()),
437
+ asyncio.create_task(asr_keep_alive_task()),
431
438
  ]
432
439
  await asyncio.wait(
433
440
  tasks,
@@ -231,16 +231,6 @@ class CorrectSlotsCommand(Command):
231
231
  proposed_slots, all_flows, tracker
232
232
  )
233
233
 
234
- if not earliest_collect and not is_reset_only:
235
- # if we could not find any step in the flow, where the slots were
236
- # previously set, and we also don't want to reset the slots, do
237
- # not correct the slots.
238
- structlogger.debug(
239
- "command_executor.skip_correction",
240
- is_reset_only=is_reset_only,
241
- )
242
- return None
243
-
244
234
  return CorrectionPatternFlowStackFrame(
245
235
  is_reset_only=is_reset_only,
246
236
  corrected_slots=proposed_slots,
@@ -399,7 +399,12 @@ def clean_up_commands(
399
399
  """
400
400
  domain = domain if domain else Domain.empty()
401
401
 
402
- slots_so_far, active_flow = filled_slots_for_active_flow(tracker, all_flows)
402
+ slots_so_far, _ = filled_slots_for_active_flow(tracker, all_flows)
403
+
404
+ # update the slots so far with the slots that were set in the tracker
405
+ slots_so_far.update(
406
+ {event.key for event in tracker.events if isinstance(event, SlotSet)}
407
+ )
403
408
 
404
409
  clean_commands: List[Command] = []
405
410
 
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.12.22"
3
+ __version__ = "3.12.24"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rasa-pro
3
- Version: 3.12.22
3
+ Version: 3.12.24
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
@@ -92,11 +92,11 @@ rasa/cli/x.py,sha256=C7dLtYXAkD-uj7hNj7Pz5YbOupp2yRcMjQbsEVqXUJ8,6825
92
92
  rasa/constants.py,sha256=5OMUcJ_gjn8qglY37DeUS4g5xe2VZAiLIv8IKwIGWJ0,1364
93
93
  rasa/core/__init__.py,sha256=wTSmsFlgK0Ylvuyq20q9APwpT5xyVJYZfzhs4rrkciM,456
94
94
  rasa/core/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
95
- rasa/core/actions/action.py,sha256=_QfY3ngSF2sf2Y3QDPJo7Nd6F_FA6_zDWgw1OQSLkEk,42676
95
+ rasa/core/actions/action.py,sha256=2mDvSi1pSWipDWhprEFjDXf-X9yoID9DQEvmf0rQcJM,42664
96
96
  rasa/core/actions/action_clean_stack.py,sha256=xUP-2ipPsPAnAiwP17c-ezmHPSrV4JSUZr-eSgPQwIs,2279
97
97
  rasa/core/actions/action_exceptions.py,sha256=hghzXYN6VeHC-O_O7WiPesCNV86ZTkHgG90ZnQcbai8,724
98
98
  rasa/core/actions/action_hangup.py,sha256=o5iklHG-F9IcRgWis5C6AumVXznxzAV3o9zdduhozEM,994
99
- rasa/core/actions/action_repeat_bot_messages.py,sha256=2DZFHPS7SKslz_Pm3Tyn0154xTws3E7lMYKl2ktQPTQ,3522
99
+ rasa/core/actions/action_repeat_bot_messages.py,sha256=T7bJH0fsxFQgbkCZZ5dnPi8v18-2X9QZZLfAHmmn7WI,3466
100
100
  rasa/core/actions/action_run_slot_rejections.py,sha256=Rng5h-h5b63HisUeSFZXQ3FnNi-jPoqSbqnDo8M-jTk,7248
101
101
  rasa/core/actions/action_trigger_chitchat.py,sha256=krOPqCXBihxOskqmm05A4mFEm4lj4ohvzuddy7rELVQ,1084
102
102
  rasa/core/actions/action_trigger_flow.py,sha256=IydYAGafTtoY6XSgCX124xJQhzudUg8JAICstqsV3VA,3487
@@ -275,12 +275,12 @@ rasa/core/channels/voice_ready/twilio_voice.py,sha256=z2pdausxQnXQP9htGh8AL2q9Av
275
275
  rasa/core/channels/voice_ready/utils.py,sha256=Tmq0OOAN2sAvxPP64x298zX1TZYTdszK3iazfGZ5RsI,987
276
276
  rasa/core/channels/voice_stream/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
277
277
  rasa/core/channels/voice_stream/asr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
278
- rasa/core/channels/voice_stream/asr/asr_engine.py,sha256=DpWEhkCHJPM1WDsBI5R3czqwvFiyaRMlgCubBNXO4U4,3237
278
+ rasa/core/channels/voice_stream/asr/asr_engine.py,sha256=34rgUqDtH9YvpAUZYPsS0GuS1pbYaz9ziEI5HyFXUSs,3403
279
279
  rasa/core/channels/voice_stream/asr/asr_event.py,sha256=skPwrkRrcsptmeWXu9q68i4B-ZbvambCFFLtQ0TIgMo,297
280
280
  rasa/core/channels/voice_stream/asr/azure.py,sha256=dUFxtNVVwGM2D1VyqQ5FWeSpKwUQekMXUxWZv6tPJ7w,6114
281
- rasa/core/channels/voice_stream/asr/deepgram.py,sha256=9cIqRuv9gWzOfEKxeDbhijGoT8EPUV7Oo493WXaHlBo,5682
281
+ rasa/core/channels/voice_stream/asr/deepgram.py,sha256=VeVMWg05uL_epGGOZbUHXeIIhoBf0bxiWMp6QwNFe0A,5920
282
282
  rasa/core/channels/voice_stream/audio_bytes.py,sha256=3V0QQplPD-kVfebaaeVcKgV7pwIJyjnTenujVD3y3sY,340
283
- rasa/core/channels/voice_stream/audiocodes.py,sha256=WVAd5ksO97y7a6Wvv6PqQKQVgS1_IdRXeDIjnl6IAkY,12498
283
+ rasa/core/channels/voice_stream/audiocodes.py,sha256=MimjLo31wikfGmsyllRiX-pIZRy-D5JFeKhHJt2vnbU,12856
284
284
  rasa/core/channels/voice_stream/browser_audio.py,sha256=fDwp-yaalik8R92EOJHsgHMuNAg9yoeGWVRGMCH2lJQ,3939
285
285
  rasa/core/channels/voice_stream/call_state.py,sha256=fbwVbT0ddE7AjTYjx-Mq5jBMEGXanbug5wlBwstaews,899
286
286
  rasa/core/channels/voice_stream/genesys.py,sha256=EyZ4G3gfiQ5HXP6jslTjXRBYVEhpyO8nK5r6znQtHtE,16965
@@ -291,7 +291,7 @@ rasa/core/channels/voice_stream/tts/tts_cache.py,sha256=K4S2d8zWX2h2ylYALp7IdqFS
291
291
  rasa/core/channels/voice_stream/tts/tts_engine.py,sha256=JMCWGHxT8QiqKoBeI6F4RX_-Q9EEqG3vUtkgOUnlt-w,1812
292
292
  rasa/core/channels/voice_stream/twilio_media_streams.py,sha256=cM09rwGpbyFD9lCfmWBjHE1XS-F4ufpSbvwJACHpVmI,9094
293
293
  rasa/core/channels/voice_stream/util.py,sha256=d0Tl0tGAnVj3SgGovsUMHx-QL44nrPI29OTYKYleH0U,1987
294
- rasa/core/channels/voice_stream/voice_channel.py,sha256=5XQjDkkWCOaXV3GKmzDBPIIwYVIS0StzzApxXrBKLd4,19611
294
+ rasa/core/channels/voice_stream/voice_channel.py,sha256=Eid_leQr2hHyE9EVTD19iQrO2cuYtPkeXI97jFDQWfk,19914
295
295
  rasa/core/channels/webexteams.py,sha256=z_o_jnc6B7hsHpd6XorImFkF43wB4yx_kiTPKAjPSuo,4805
296
296
  rasa/core/concurrent_lock_store.py,sha256=ycd-aeJJWXIokMRimCdQFHdwuMfl512hZSUHE8oSd2c,7722
297
297
  rasa/core/constants.py,sha256=dEokmEf6XkOFA_xpuwjqwNtlZv-a5Tz5dLMRc7Vu4CU,4070
@@ -375,7 +375,7 @@ rasa/dialogue_understanding/commands/chit_chat_answer_command.py,sha256=PtwNuAHJ
375
375
  rasa/dialogue_understanding/commands/clarify_command.py,sha256=mxdHWdyaQwA4uYdhVUjwAUPfl0HvqtDHU2DWKEeZal4,4290
376
376
  rasa/dialogue_understanding/commands/command.py,sha256=rhxHmllTMwvb4Uq-pDqmUdlKtu-87y8nqN5DRO-KDwE,2529
377
377
  rasa/dialogue_understanding/commands/command_syntax_manager.py,sha256=vO6sOak0g9GucEtiNximJ9bQFbHQwWJ-M5XNF1gGxz4,1893
378
- rasa/dialogue_understanding/commands/correct_slots_command.py,sha256=LlaBtWc3y-DyDPMF-zGG9x_J9uCe78LqiuogHIyoz5Q,10810
378
+ rasa/dialogue_understanding/commands/correct_slots_command.py,sha256=bIApo1i-RbF7JojHb4WiiKkZwRV6GBaUIGkdsn9Scog,10396
379
379
  rasa/dialogue_understanding/commands/error_command.py,sha256=LTEsxkGGGZR6wEEGuTtQ4K4EK_u2UFhNK4eAKyPfyME,2436
380
380
  rasa/dialogue_understanding/commands/free_form_answer_command.py,sha256=XlQrHXrcOemzu1LHZiDhBAluiSlnUQ2V7ET5Z-aG7gc,224
381
381
  rasa/dialogue_understanding/commands/handle_code_change_command.py,sha256=Cp2e1iD0zacXmljJ8vDXHJu9Fp6BwB7cGx8NF748akw,2192
@@ -436,7 +436,7 @@ rasa/dialogue_understanding/patterns/skip_question.py,sha256=fJ1MC0WEEtS-BpnGJEf
436
436
  rasa/dialogue_understanding/patterns/user_silence.py,sha256=xP-QMnd-MsybH5z4g01hBv4OLOHcw6m3rc26LQfe2zo,1140
437
437
  rasa/dialogue_understanding/patterns/validate_slot.py,sha256=hqd5AEGT3M3HLNhMwuI9W9kZNCvgU6GyI-2xc2b4kz8,2085
438
438
  rasa/dialogue_understanding/processor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
439
- rasa/dialogue_understanding/processor/command_processor.py,sha256=dSakuFOQuYwatYafiFCbr3P_g59BnjPAC1iBb2wfSKk,30169
439
+ rasa/dialogue_understanding/processor/command_processor.py,sha256=BRpT28JKwNhKo5i8FwJ785KmmM6jJhln7BuUX087vf0,30343
440
440
  rasa/dialogue_understanding/processor/command_processor_component.py,sha256=rkErI_Uo7s3LsEojUSGSRbWGyGaX7GtGOYSJn0V-TI4,1650
441
441
  rasa/dialogue_understanding/stack/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
442
442
  rasa/dialogue_understanding/stack/dialogue_stack.py,sha256=cYV6aQeh0EuOJHODDqK3biqXozYTX8baPgLwHhPxFqs,5244
@@ -822,9 +822,9 @@ rasa/utils/train_utils.py,sha256=ClJx-6x3-h3Vt6mskacgkcCUJTMXjFPe3zAcy_DfmaU,212
822
822
  rasa/utils/url_tools.py,sha256=dZ1HGkVdWTJB7zYEdwoDIrEuyX9HE5WsxKKFVsXBLE0,1218
823
823
  rasa/utils/yaml.py,sha256=KjbZq5C94ZP7Jdsw8bYYF7HASI6K4-C_kdHfrnPLpSI,2000
824
824
  rasa/validator.py,sha256=524VlFTYK0B3iXYveVD6BDC3K0j1QfpzJ9O-TAWczmc,83166
825
- rasa/version.py,sha256=80OhkjhQmyLuTctyfSXJq2OHstMtFL5uimFi2fWJg2k,118
826
- rasa_pro-3.12.22.dist-info/METADATA,sha256=7lZW1jvd_K9sKhFNwdlt_kSMxbdklF2NxQBzSjwKv2w,10609
827
- rasa_pro-3.12.22.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
828
- rasa_pro-3.12.22.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
829
- rasa_pro-3.12.22.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
830
- rasa_pro-3.12.22.dist-info/RECORD,,
825
+ rasa/version.py,sha256=AgorMsDr4ANpYxBMDotQd3zGhCemJL6HM2UpERozJ8Y,118
826
+ rasa_pro-3.12.24.dist-info/METADATA,sha256=Aj_ItptHP2vA42whDf6tFx-_2mXwBShYxJQmSaUTNhU,10609
827
+ rasa_pro-3.12.24.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
828
+ rasa_pro-3.12.24.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
829
+ rasa_pro-3.12.24.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
830
+ rasa_pro-3.12.24.dist-info/RECORD,,