rasa-pro 3.11.3a1.dev2__py3-none-any.whl → 3.11.3a1.dev5__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.
- rasa/core/channels/socketio.py +35 -0
- rasa/tracing/instrumentation/attribute_extractors.py +2 -0
- rasa/version.py +1 -1
- {rasa_pro-3.11.3a1.dev2.dist-info → rasa_pro-3.11.3a1.dev5.dist-info}/METADATA +1 -1
- {rasa_pro-3.11.3a1.dev2.dist-info → rasa_pro-3.11.3a1.dev5.dist-info}/RECORD +8 -8
- {rasa_pro-3.11.3a1.dev2.dist-info → rasa_pro-3.11.3a1.dev5.dist-info}/NOTICE +0 -0
- {rasa_pro-3.11.3a1.dev2.dist-info → rasa_pro-3.11.3a1.dev5.dist-info}/WHEEL +0 -0
- {rasa_pro-3.11.3a1.dev2.dist-info → rasa_pro-3.11.3a1.dev5.dist-info}/entry_points.txt +0 -0
rasa/core/channels/socketio.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
import inspect
|
|
2
3
|
import logging
|
|
3
4
|
import uuid
|
|
@@ -6,6 +7,7 @@ from typing import Any, Awaitable, Callable, Dict, Iterable, List, Optional, Tex
|
|
|
6
7
|
|
|
7
8
|
import rasa.core.channels.channel
|
|
8
9
|
from rasa.core.channels.channel import InputChannel, OutputChannel, UserMessage
|
|
10
|
+
from rasa.shared.core.trackers import EventVerbosity
|
|
9
11
|
import rasa.shared.utils.io
|
|
10
12
|
from sanic import Blueprint, response, Sanic
|
|
11
13
|
from sanic.request import Request
|
|
@@ -188,6 +190,8 @@ class SocketIOInput(InputChannel):
|
|
|
188
190
|
metadata_key: Optional[Text] = "metadata",
|
|
189
191
|
):
|
|
190
192
|
"""Creates a ``SocketIOInput`` object."""
|
|
193
|
+
from rasa.core.agent import Agent
|
|
194
|
+
|
|
191
195
|
self.bot_message_evt = bot_message_evt
|
|
192
196
|
self.session_persistence = session_persistence
|
|
193
197
|
self.user_message_evt = user_message_evt
|
|
@@ -199,6 +203,8 @@ class SocketIOInput(InputChannel):
|
|
|
199
203
|
self.jwt_key = jwt_key
|
|
200
204
|
self.jwt_algorithm = jwt_method
|
|
201
205
|
|
|
206
|
+
self.agent: Optional[Agent] = None
|
|
207
|
+
|
|
202
208
|
def get_output_channel(self) -> Optional["OutputChannel"]:
|
|
203
209
|
"""Creates socket.io output channel object."""
|
|
204
210
|
if self.sio is None:
|
|
@@ -227,6 +233,11 @@ class SocketIOInput(InputChannel):
|
|
|
227
233
|
sio, self.socketio_path, "socketio_webhook", __name__
|
|
228
234
|
)
|
|
229
235
|
|
|
236
|
+
@socketio_webhook.listener("after_server_start") # type: ignore[misc]
|
|
237
|
+
async def after_server_start(app: Sanic, _: asyncio.AbstractEventLoop) -> None:
|
|
238
|
+
"""Prints a message after the server has started with inspect URL."""
|
|
239
|
+
self.agent = app.ctx.agent
|
|
240
|
+
|
|
230
241
|
# make sio object static to use in get_output_channel
|
|
231
242
|
self.sio = sio
|
|
232
243
|
|
|
@@ -272,6 +283,30 @@ class SocketIOInput(InputChannel):
|
|
|
272
283
|
await sio.emit("session_confirm", data["session_id"], room=sid)
|
|
273
284
|
logger.debug(f"User {sid} connected to socketIO endpoint.")
|
|
274
285
|
|
|
286
|
+
@sio.on("tracker", namespace=self.namespace)
|
|
287
|
+
async def handle_tracker(sid: Text, data: Dict) -> None:
|
|
288
|
+
from rasa.shared.core.trackers import DialogueStateTracker
|
|
289
|
+
|
|
290
|
+
if self.agent is None:
|
|
291
|
+
raise ValueError("Agent is not initialized")
|
|
292
|
+
|
|
293
|
+
async with self.agent.lock_store.lock(data["sender_id"]):
|
|
294
|
+
tracker = DialogueStateTracker.from_dict(
|
|
295
|
+
data["sender_id"], data["events"], self.agent.domain.slots
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
# will override an existing tracker with the same id!
|
|
299
|
+
await self.agent.tracker_store.save(tracker)
|
|
300
|
+
|
|
301
|
+
# TODO: rather figure out how to trigger the on_tracker_updated
|
|
302
|
+
# of the development inspector channel
|
|
303
|
+
state = tracker.current_state(EventVerbosity.AFTER_RESTART)
|
|
304
|
+
await sio.emit(
|
|
305
|
+
"tracker",
|
|
306
|
+
json.dumps(state),
|
|
307
|
+
room=sid,
|
|
308
|
+
)
|
|
309
|
+
|
|
275
310
|
@sio.on(self.user_message_evt, namespace=self.namespace)
|
|
276
311
|
async def handle_message(sid: Text, data: Dict) -> None:
|
|
277
312
|
output_channel = SocketIOOutput(sio, self.bot_message_evt)
|
|
@@ -578,6 +578,7 @@ def extract_attrs_for_run_step(
|
|
|
578
578
|
tracker: DialogueStateTracker,
|
|
579
579
|
available_actions: List[str],
|
|
580
580
|
flows: FlowsList,
|
|
581
|
+
previous_step_id: Text,
|
|
581
582
|
) -> Dict[str, Any]:
|
|
582
583
|
current_context = extract_current_context_attribute(stack)
|
|
583
584
|
|
|
@@ -586,6 +587,7 @@ def extract_attrs_for_run_step(
|
|
|
586
587
|
"step_description": step.description if step.description else "None",
|
|
587
588
|
"current_flow_id": flow.id,
|
|
588
589
|
"current_context": json.dumps(current_context),
|
|
590
|
+
"previous_step_id": previous_step_id,
|
|
589
591
|
}
|
|
590
592
|
|
|
591
593
|
|
rasa/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rasa-pro
|
|
3
|
-
Version: 3.11.3a1.
|
|
3
|
+
Version: 3.11.3a1.dev5
|
|
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
|
Home-page: https://rasa.com
|
|
6
6
|
Keywords: nlp,machine-learning,machine-learning-library,bot,bots,botkit,rasa conversational-agents,conversational-ai,chatbot,chatbot-framework,bot-framework
|
|
@@ -254,7 +254,7 @@ rasa/core/channels/rasa_chat.py,sha256=XGZ7QLyQHhB-m7EjetDNEBSjAa2mEFqU-e-FuS9z3
|
|
|
254
254
|
rasa/core/channels/rest.py,sha256=YDBnbdrlvaYL7Efy3cm2LbbSm7cBAFDhmcypojHXbog,7227
|
|
255
255
|
rasa/core/channels/rocketchat.py,sha256=HWOMxXLuwadYEYIMMP-z6RqAJzMGZDLklpgqLOipXF0,5998
|
|
256
256
|
rasa/core/channels/slack.py,sha256=3b8OZQ_gih5XBwhQ1q4BbBUC1SCAPaO9AoJEn2NaoQE,24405
|
|
257
|
-
rasa/core/channels/socketio.py,sha256=
|
|
257
|
+
rasa/core/channels/socketio.py,sha256=qTxwow7BA4XMwzlSKAh2W2amQiBqtL_3WqnUc0rjY_s,13342
|
|
258
258
|
rasa/core/channels/telegram.py,sha256=5BrNECFM3qe9XjNpDb8Q9fbqCT5aKr5L6IH21W8sum8,10651
|
|
259
259
|
rasa/core/channels/twilio.py,sha256=GsdjfplZdBj0fRB60bSggPF1DXFZ_x18V_dlcDy5VFs,5943
|
|
260
260
|
rasa/core/channels/vier_cvg.py,sha256=PfvSluQqgJbP0JzZPFUvum3z7H55JPPeobcD-z5zCkw,13544
|
|
@@ -735,7 +735,7 @@ rasa/tracing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
735
735
|
rasa/tracing/config.py,sha256=kA-xEY2oAc07gw1RzGeMuNnDKd_ZrVXT_B63pxGW-uI,12860
|
|
736
736
|
rasa/tracing/constants.py,sha256=N_MJLStE3IkmPKQCQv42epd3jdBMJ4Ith1dVO65N5ho,2425
|
|
737
737
|
rasa/tracing/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
738
|
-
rasa/tracing/instrumentation/attribute_extractors.py,sha256=
|
|
738
|
+
rasa/tracing/instrumentation/attribute_extractors.py,sha256=YntngMpBuKfuipydmhR6zmeS_1N0_nhiwazeRHFrdTc,26080
|
|
739
739
|
rasa/tracing/instrumentation/instrumentation.py,sha256=5g_Hp9CE7bqIKUVfLcpGan0s2SK3h5rikjumpADs4SY,51103
|
|
740
740
|
rasa/tracing/instrumentation/intentless_policy_instrumentation.py,sha256=8AdMOy_2mlKnlmt-muV8-eoT8jA52GXDzM0avejfg8A,4821
|
|
741
741
|
rasa/tracing/instrumentation/metrics.py,sha256=ByfKshoxNOqjKZwKTulqL71s5b3WugqLfjha3So0OEU,10534
|
|
@@ -776,9 +776,9 @@ rasa/utils/train_utils.py,sha256=f1NWpp5y6al0dzoQyyio4hc4Nf73DRoRSHDzEK6-C4E,212
|
|
|
776
776
|
rasa/utils/url_tools.py,sha256=JQcHL2aLqLHu82k7_d9imUoETCm2bmlHaDpOJ-dKqBc,1218
|
|
777
777
|
rasa/utils/yaml.py,sha256=KjbZq5C94ZP7Jdsw8bYYF7HASI6K4-C_kdHfrnPLpSI,2000
|
|
778
778
|
rasa/validator.py,sha256=wl5IKiyDmk6FlDcGO2Js-H-gHPeqVqUJ6hB4fgN0xjI,66796
|
|
779
|
-
rasa/version.py,sha256=
|
|
780
|
-
rasa_pro-3.11.3a1.
|
|
781
|
-
rasa_pro-3.11.3a1.
|
|
782
|
-
rasa_pro-3.11.3a1.
|
|
783
|
-
rasa_pro-3.11.3a1.
|
|
784
|
-
rasa_pro-3.11.3a1.
|
|
779
|
+
rasa/version.py,sha256=30hhHbpQCDfDXVFyr3PTuEccWoj0mUrtnPGHp39doZ0,124
|
|
780
|
+
rasa_pro-3.11.3a1.dev5.dist-info/METADATA,sha256=m_N49daQs1B-kgsaTa3rRAlRqpG2oNRc1LHIA7Oc6JA,10798
|
|
781
|
+
rasa_pro-3.11.3a1.dev5.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
|
|
782
|
+
rasa_pro-3.11.3a1.dev5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
783
|
+
rasa_pro-3.11.3a1.dev5.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
|
|
784
|
+
rasa_pro-3.11.3a1.dev5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|