rasa-pro 3.11.4__py3-none-any.whl → 3.11.6__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/actions/action.py +3 -1
- rasa/core/brokers/kafka.py +59 -20
- rasa/core/channels/inspector/dist/assets/Tableau10-1b767f5e.js +1 -0
- rasa/core/channels/inspector/dist/assets/arc-f0f8bd46.js +1 -0
- rasa/core/channels/inspector/dist/assets/blockDiagram-38ab4fdb-7162c77d.js +118 -0
- rasa/core/channels/inspector/dist/assets/c4Diagram-3d4e48cf-b1d0d098.js +10 -0
- rasa/core/channels/inspector/dist/assets/channel-e265ea59.js +1 -0
- rasa/core/channels/inspector/dist/assets/classDiagram-70f12bd4-807a1b27.js +2 -0
- rasa/core/channels/inspector/dist/assets/classDiagram-v2-f2320105-5238dcdb.js +2 -0
- rasa/core/channels/inspector/dist/assets/clone-21f8a43d.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-62fc7601-89c73b31.js → createText-2e5e7dd3-75dfaa67.js} +1 -1
- rasa/core/channels/inspector/dist/assets/edges-e0da2a9e-df20501d.js +4 -0
- rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-907e0440.js → erDiagram-9861fffd-13cf4797.js} +4 -4
- rasa/core/channels/inspector/dist/assets/flowDb-956e92f1-a4991264.js +10 -0
- rasa/core/channels/inspector/dist/assets/flowDiagram-66a62f08-ccecf773.js +4 -0
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-5c8ce12d.js +1 -0
- rasa/core/channels/inspector/dist/assets/flowchart-elk-definition-4a651766-b5801783.js +139 -0
- rasa/core/channels/inspector/dist/assets/ganttDiagram-c361ad54-161e079a.js +257 -0
- rasa/core/channels/inspector/dist/assets/gitGraphDiagram-72cf32ee-f38e86a4.js +70 -0
- rasa/core/channels/inspector/dist/assets/graph-be6ef5d8.js +1 -0
- rasa/core/channels/inspector/dist/assets/index-3862675e-d9ce8994.js +1 -0
- rasa/core/channels/inspector/dist/assets/{index-e793d777.js → index-7794b245.js} +200 -195
- rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-8ceba4db.js → infoDiagram-f8f76790-5000a3dc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-960d3809.js → journeyDiagram-49397b02-8ef0a17a.js} +4 -4
- rasa/core/channels/inspector/dist/assets/katex-498eb57e.js +261 -0
- rasa/core/channels/inspector/dist/assets/layout-d649bc98.js +1 -0
- rasa/core/channels/inspector/dist/assets/{line-eeccc4e2.js → line-95add810.js} +1 -1
- rasa/core/channels/inspector/dist/assets/linear-f6025094.js +1 -0
- rasa/core/channels/inspector/dist/assets/mindmap-definition-fc14e90a-2e8531c4.js +312 -0
- rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-dc9b5e1b.js → pieDiagram-8a3498a8-918adfdb.js} +7 -7
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-a08cba6d.js → quadrantDiagram-120e2f19-cbd01797.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-87242b9e.js → requirementDiagram-deff3bca-6a8b877b.js} +2 -2
- rasa/core/channels/inspector/dist/assets/sankeyDiagram-04a897e0-c377c3fe.js +8 -0
- rasa/core/channels/inspector/dist/assets/sequenceDiagram-704730f1-ab9e9b7f.js +122 -0
- rasa/core/channels/inspector/dist/assets/stateDiagram-587899a1-5e6ae67d.js +1 -0
- rasa/core/channels/inspector/dist/assets/stateDiagram-v2-d93cdb3a-40643476.js +1 -0
- rasa/core/channels/inspector/dist/assets/{styles-9c745c82-cef936a6.js → styles-6aaf32cf-afb8d108.js} +1 -1
- rasa/core/channels/inspector/dist/assets/styles-9a916d00-7edc9423.js +160 -0
- rasa/core/channels/inspector/dist/assets/styles-c10674c1-c1d8f7e9.js +116 -0
- rasa/core/channels/inspector/dist/assets/svgDrawCommon-08f97a94-f494b2ef.js +1 -0
- rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-0d39bdb2.js → timeline-definition-85554ec2-11c7cdd0.js} +3 -3
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-a03fa445.js → xychartDiagram-e933f94c-3f191ec1.js} +3 -3
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/package.json +10 -3
- rasa/core/channels/inspector/yarn.lock +89 -99
- rasa/core/channels/voice_ready/audiocodes.py +42 -23
- rasa/core/channels/voice_stream/asr/deepgram.py +57 -16
- rasa/core/channels/voice_stream/browser_audio.py +4 -1
- rasa/core/channels/voice_stream/tts/cartesia.py +11 -2
- rasa/core/policies/enterprise_search_prompt_with_citation_template.jinja2 +1 -1
- rasa/keys +1 -0
- rasa/llm_fine_tuning/conversations.py +1 -1
- rasa/server.py +3 -1
- rasa/shared/constants.py +1 -0
- rasa/shared/core/constants.py +2 -0
- rasa/shared/core/events.py +67 -0
- rasa/shared/providers/llm/default_litellm_llm_client.py +6 -1
- rasa/shared/utils/schemas/events.py +2 -2
- rasa/version.py +1 -1
- {rasa_pro-3.11.4.dist-info → rasa_pro-3.11.6.dist-info}/METADATA +7 -8
- {rasa_pro-3.11.4.dist-info → rasa_pro-3.11.6.dist-info}/RECORD +64 -57
- rasa/core/channels/inspector/dist/assets/arc-632a63ec.js +0 -1
- rasa/core/channels/inspector/dist/assets/c4Diagram-d0fbc5ce-081e0df4.js +0 -10
- rasa/core/channels/inspector/dist/assets/classDiagram-936ed81e-3df0afc2.js +0 -2
- rasa/core/channels/inspector/dist/assets/classDiagram-v2-c3cb15f1-8c5ed31e.js +0 -2
- rasa/core/channels/inspector/dist/assets/edges-f2ad444c-4fc48c3e.js +0 -4
- rasa/core/channels/inspector/dist/assets/flowDb-1972c806-9ec53a3c.js +0 -6
- rasa/core/channels/inspector/dist/assets/flowDiagram-7ea5b25a-41da787a.js +0 -4
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-8bea338b.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowchart-elk-definition-abe16c3d-ce370633.js +0 -139
- rasa/core/channels/inspector/dist/assets/ganttDiagram-9b5ea136-90a36523.js +0 -266
- rasa/core/channels/inspector/dist/assets/gitGraphDiagram-99d0ae7c-41e1aa3f.js +0 -70
- rasa/core/channels/inspector/dist/assets/index-2c4b9a3b-e6f2af62.js +0 -1
- rasa/core/channels/inspector/dist/assets/layout-498807d8.js +0 -1
- rasa/core/channels/inspector/dist/assets/linear-8a078617.js +0 -1
- rasa/core/channels/inspector/dist/assets/mindmap-definition-beec6740-396d17dd.js +0 -109
- rasa/core/channels/inspector/dist/assets/sankeyDiagram-8f13d901-53f6f391.js +0 -8
- rasa/core/channels/inspector/dist/assets/sequenceDiagram-b655622a-715c9c20.js +0 -122
- rasa/core/channels/inspector/dist/assets/stateDiagram-59f0c015-2e8fb31f.js +0 -1
- rasa/core/channels/inspector/dist/assets/stateDiagram-v2-2b26beab-7e2d2aa0.js +0 -1
- rasa/core/channels/inspector/dist/assets/styles-080da4f6-4420cea6.js +0 -110
- rasa/core/channels/inspector/dist/assets/styles-3dcbcfbf-28676cf4.js +0 -159
- rasa/core/channels/inspector/dist/assets/svgDrawCommon-4835440b-151251e9.js +0 -1
- {rasa_pro-3.11.4.dist-info → rasa_pro-3.11.6.dist-info}/NOTICE +0 -0
- {rasa_pro-3.11.4.dist-info → rasa_pro-3.11.6.dist-info}/WHEEL +0 -0
- {rasa_pro-3.11.4.dist-info → rasa_pro-3.11.6.dist-info}/entry_points.txt +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
import copy
|
|
2
3
|
from datetime import datetime, timezone, timedelta
|
|
3
4
|
import json
|
|
4
5
|
import uuid
|
|
5
|
-
from
|
|
6
|
+
from collections import defaultdict
|
|
6
7
|
from dataclasses import asdict
|
|
8
|
+
from typing import Any, Awaitable, Callable, Dict, List, Optional, Set, Text, Union
|
|
7
9
|
|
|
8
10
|
import structlog
|
|
9
11
|
from jsonschema import ValidationError, validate
|
|
@@ -223,6 +225,16 @@ class AudiocodesInput(InputChannel):
|
|
|
223
225
|
self.scheduler_job = None
|
|
224
226
|
self.keep_alive = keep_alive
|
|
225
227
|
self.keep_alive_expiration_factor = keep_alive_expiration_factor
|
|
228
|
+
self.background_tasks: Dict[Text, Set[asyncio.Task]] = defaultdict(set)
|
|
229
|
+
|
|
230
|
+
def _create_task(self, conversation_id: Text, coro: Awaitable[Any]) -> asyncio.Task:
|
|
231
|
+
"""Create and track an asyncio task for a conversation."""
|
|
232
|
+
task: asyncio.Task = asyncio.create_task(coro)
|
|
233
|
+
self.background_tasks[conversation_id].add(task)
|
|
234
|
+
task.add_done_callback(
|
|
235
|
+
lambda t: self.background_tasks[conversation_id].discard(t)
|
|
236
|
+
)
|
|
237
|
+
return task
|
|
226
238
|
|
|
227
239
|
async def _set_scheduler_job(self) -> None:
|
|
228
240
|
if self.scheduler_job:
|
|
@@ -251,11 +263,20 @@ class AudiocodesInput(InputChannel):
|
|
|
251
263
|
)
|
|
252
264
|
now = datetime.now(timezone.utc)
|
|
253
265
|
delta = timedelta(seconds=self.keep_alive * self.keep_alive_expiration_factor)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
266
|
+
|
|
267
|
+
# clean up conversations
|
|
268
|
+
inactive = [
|
|
269
|
+
conv_id
|
|
270
|
+
for conv_id, conv in self.conversations.items()
|
|
271
|
+
if not conv.is_active_conversation(now, delta)
|
|
272
|
+
]
|
|
273
|
+
|
|
274
|
+
# cancel tasks and remove conversations
|
|
275
|
+
for conv_id in inactive:
|
|
276
|
+
for task in self.background_tasks[conv_id]:
|
|
277
|
+
task.cancel()
|
|
278
|
+
self.background_tasks.pop(conv_id, None)
|
|
279
|
+
self.conversations.pop(conv_id, None)
|
|
259
280
|
|
|
260
281
|
def handle_start_conversation(self, body: Dict[Text, Any]) -> Dict[Text, Any]:
|
|
261
282
|
conversation_id = body["conversation"]
|
|
@@ -347,31 +368,29 @@ class AudiocodesInput(InputChannel):
|
|
|
347
368
|
structlogger.debug("audiocodes.on_activities", conversation=conversation_id)
|
|
348
369
|
conversation = self._get_conversation(request.token, conversation_id)
|
|
349
370
|
if conversation is None:
|
|
371
|
+
structlogger.warning(
|
|
372
|
+
"audiocodes.on_activities.no_conversation", request=request.json
|
|
373
|
+
)
|
|
350
374
|
return response.json({})
|
|
351
375
|
elif conversation.ws:
|
|
352
376
|
ac_output: Union[WebsocketOutput, AudiocodesOutput] = WebsocketOutput(
|
|
353
377
|
conversation.ws, conversation_id
|
|
354
378
|
)
|
|
355
|
-
|
|
356
|
-
request.json,
|
|
357
|
-
output_channel=ac_output,
|
|
358
|
-
on_new_message=on_new_message,
|
|
359
|
-
)
|
|
360
|
-
return response.json({})
|
|
379
|
+
response_json = {}
|
|
361
380
|
else:
|
|
362
381
|
# handle non websocket case where messages get returned in json
|
|
363
382
|
ac_output = AudiocodesOutput()
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
383
|
+
response_json = {
|
|
384
|
+
"conversation": conversation_id,
|
|
385
|
+
"activities": ac_output.messages,
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
# start a background task to handle activities
|
|
389
|
+
self._create_task(
|
|
390
|
+
conversation_id,
|
|
391
|
+
conversation.handle_activities(request.json, ac_output, on_new_message),
|
|
392
|
+
)
|
|
393
|
+
return response.json(response_json)
|
|
375
394
|
|
|
376
395
|
@ac_webhook.route(
|
|
377
396
|
"/conversation/<conversation_id>/disconnect", methods=["POST"]
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
from typing import Any, Dict, Optional
|
|
3
1
|
import json
|
|
4
2
|
import os
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Any, Dict, Optional
|
|
5
|
+
from urllib.parse import urlencode
|
|
5
6
|
|
|
6
7
|
import websockets
|
|
7
8
|
from websockets.legacy.client import WebSocketClientProtocol
|
|
@@ -19,11 +20,14 @@ from rasa.shared.constants import DEEPGRAM_API_KEY_ENV_VAR
|
|
|
19
20
|
@dataclass
|
|
20
21
|
class DeepgramASRConfig(ASREngineConfig):
|
|
21
22
|
endpoint: Optional[str] = None
|
|
22
|
-
# number of
|
|
23
|
+
# number of milliseconds of silence to determine end of speech
|
|
23
24
|
endpointing: Optional[int] = None
|
|
24
25
|
language: Optional[str] = None
|
|
25
26
|
model: Optional[str] = None
|
|
26
27
|
smart_format: Optional[bool] = None
|
|
28
|
+
# number of milliseconds of no new transcript to determine end of speech
|
|
29
|
+
# should be at least 1000 according to docs
|
|
30
|
+
utterance_end_ms: Optional[int] = None
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
class DeepgramASR(ASREngine[DeepgramASRConfig]):
|
|
@@ -37,22 +41,35 @@ class DeepgramASR(ASREngine[DeepgramASRConfig]):
|
|
|
37
41
|
"""Connect to the ASR system."""
|
|
38
42
|
deepgram_api_key = os.environ[DEEPGRAM_API_KEY_ENV_VAR]
|
|
39
43
|
extra_headers = {"Authorization": f"Token {deepgram_api_key}"}
|
|
40
|
-
api_url = self._get_api_url()
|
|
41
|
-
query_params = self._get_query_params()
|
|
42
44
|
return await websockets.connect( # type: ignore
|
|
43
|
-
|
|
45
|
+
self._get_api_url_with_query_params(),
|
|
44
46
|
extra_headers=extra_headers,
|
|
45
47
|
)
|
|
46
48
|
|
|
49
|
+
def _get_api_url_with_query_params(self) -> str:
|
|
50
|
+
"""Combine api url and query params."""
|
|
51
|
+
return self._get_api_url() + self._get_query_params()
|
|
52
|
+
|
|
47
53
|
def _get_api_url(self) -> str:
|
|
54
|
+
"""Get the api url with the configured endpoint."""
|
|
48
55
|
return f"wss://{self.config.endpoint}/v1/listen?"
|
|
49
56
|
|
|
50
57
|
def _get_query_params(self) -> str:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
"""Get the configured query parameters for the api."""
|
|
59
|
+
query_params = {
|
|
60
|
+
"encoding": "mulaw",
|
|
61
|
+
"sample_rate": HERTZ,
|
|
62
|
+
"endpointing": self.config.endpointing,
|
|
63
|
+
"vad_events": "true",
|
|
64
|
+
"language": self.config.language,
|
|
65
|
+
"interim_results": "true",
|
|
66
|
+
"model": self.config.model,
|
|
67
|
+
"smart_format": str(self.config.smart_format).lower(),
|
|
68
|
+
}
|
|
69
|
+
if self.config.utterance_end_ms and self.config.utterance_end_ms > 0:
|
|
70
|
+
query_params["utterance_end_ms"] = self.config.utterance_end_ms
|
|
71
|
+
|
|
72
|
+
return urlencode(query_params)
|
|
56
73
|
|
|
57
74
|
async def signal_audio_done(self) -> None:
|
|
58
75
|
"""Signal to the ASR Api that you are done sending data."""
|
|
@@ -67,24 +84,48 @@ class DeepgramASR(ASREngine[DeepgramASRConfig]):
|
|
|
67
84
|
def engine_event_to_asr_event(self, e: Any) -> Optional[ASREvent]:
|
|
68
85
|
"""Translate an engine event to a common ASREvent."""
|
|
69
86
|
data = json.loads(e)
|
|
70
|
-
|
|
71
|
-
|
|
87
|
+
data_type = data["type"]
|
|
88
|
+
if data_type == "Results":
|
|
89
|
+
transcript_data = data["channel"]["alternatives"][0]
|
|
90
|
+
transcript = transcript_data["transcript"]
|
|
72
91
|
if data["is_final"]:
|
|
73
92
|
if data.get("speech_final"):
|
|
74
|
-
full_transcript = self.
|
|
93
|
+
full_transcript = self.concatenate_transcripts(
|
|
94
|
+
self.accumulated_transcript, transcript
|
|
95
|
+
)
|
|
75
96
|
self.accumulated_transcript = ""
|
|
76
97
|
if full_transcript:
|
|
77
98
|
return NewTranscript(full_transcript)
|
|
78
99
|
else:
|
|
79
|
-
self.accumulated_transcript
|
|
100
|
+
self.accumulated_transcript = self.concatenate_transcripts(
|
|
101
|
+
self.accumulated_transcript, transcript
|
|
102
|
+
)
|
|
80
103
|
elif transcript:
|
|
81
104
|
return UserIsSpeaking()
|
|
105
|
+
# event that comes after utterance_end_ms of no new transcript
|
|
106
|
+
elif data_type == "UtteranceEnd":
|
|
107
|
+
if self.accumulated_transcript:
|
|
108
|
+
transcript = self.accumulated_transcript
|
|
109
|
+
self.accumulated_transcript = ""
|
|
110
|
+
return NewTranscript(transcript)
|
|
82
111
|
return None
|
|
83
112
|
|
|
84
113
|
@staticmethod
|
|
85
114
|
def get_default_config() -> DeepgramASRConfig:
|
|
86
|
-
return DeepgramASRConfig(
|
|
115
|
+
return DeepgramASRConfig(
|
|
116
|
+
endpoint="api.deepgram.com",
|
|
117
|
+
endpointing=400,
|
|
118
|
+
language="en",
|
|
119
|
+
model="nova-2-general",
|
|
120
|
+
smart_format=True,
|
|
121
|
+
utterance_end_ms=1000,
|
|
122
|
+
)
|
|
87
123
|
|
|
88
124
|
@classmethod
|
|
89
125
|
def from_config_dict(cls, config: Dict) -> "DeepgramASR":
|
|
90
126
|
return DeepgramASR(DeepgramASRConfig.from_dict(config))
|
|
127
|
+
|
|
128
|
+
@staticmethod
|
|
129
|
+
def concatenate_transcripts(t1: str, t2: str) -> str:
|
|
130
|
+
"""Concatenate two transcripts making sure there is a space between them."""
|
|
131
|
+
return (t1.strip() + " " + t2.strip()).strip()
|
|
@@ -102,6 +102,9 @@ class BrowserAudioInputChannel(VoiceInputChannel):
|
|
|
102
102
|
|
|
103
103
|
@blueprint.websocket("/websocket") # type: ignore
|
|
104
104
|
async def handle_message(request: Request, ws: Websocket) -> None:
|
|
105
|
-
|
|
105
|
+
try:
|
|
106
|
+
await self.run_audio_streaming(on_new_message, ws)
|
|
107
|
+
except Exception as e:
|
|
108
|
+
logger.error("browser_audio.handle_message.error", error=e)
|
|
106
109
|
|
|
107
110
|
return blueprint
|
|
@@ -87,13 +87,22 @@ class CartesiaTTS(TTSEngine[CartesiaTTSConfig]):
|
|
|
87
87
|
async for data in response.content.iter_chunked(1024):
|
|
88
88
|
yield self.engine_bytes_to_rasa_audio_bytes(data)
|
|
89
89
|
return
|
|
90
|
+
elif response.status == 401:
|
|
91
|
+
structlogger.error(
|
|
92
|
+
"cartesia.synthesize.rest.unauthorized",
|
|
93
|
+
status_code=response.status,
|
|
94
|
+
)
|
|
95
|
+
raise TTSError(
|
|
96
|
+
"Unauthorized. Please make sure you have the correct API key."
|
|
97
|
+
)
|
|
90
98
|
else:
|
|
99
|
+
response_text = await response.text()
|
|
91
100
|
structlogger.error(
|
|
92
101
|
"cartesia.synthesize.rest.failed",
|
|
93
102
|
status_code=response.status,
|
|
94
|
-
msg=
|
|
103
|
+
msg=response_text,
|
|
95
104
|
)
|
|
96
|
-
raise TTSError(f"TTS failed: {
|
|
105
|
+
raise TTSError(f"TTS failed: {response_text}")
|
|
97
106
|
except ClientConnectorError as e:
|
|
98
107
|
raise TTSError(e)
|
|
99
108
|
except TimeoutError as e:
|
|
@@ -4,7 +4,7 @@ If the answer is not known or cannot be determined from the provided documents o
|
|
|
4
4
|
Use the following documents to answer the question:
|
|
5
5
|
{% for doc in docs %}
|
|
6
6
|
{{ loop.cycle("*")}}. {{ doc.metadata }}
|
|
7
|
-
{{ doc.
|
|
7
|
+
{{ doc.text }}
|
|
8
8
|
{% endfor %}
|
|
9
9
|
|
|
10
10
|
{% if citation_enabled %}
|
rasa/keys
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"segment": "CcvVD1I68Nkkxrv93cIqv1twIwrwG8nz", "sentry": "a283f1fde04347b099c8d729109dd450@o251570"}
|
|
@@ -45,7 +45,7 @@ class ConversationStep:
|
|
|
45
45
|
elif isinstance(command, SetSlotCommand):
|
|
46
46
|
output.append(f"SetSlot({command.name}, {command.value})")
|
|
47
47
|
elif isinstance(command, ClarifyCommand):
|
|
48
|
-
output.append(f"Clarify({command.options})")
|
|
48
|
+
output.append(f"Clarify({', '.join(command.options)})")
|
|
49
49
|
elif isinstance(command, CancelFlowCommand):
|
|
50
50
|
output.append("CancelFlow()")
|
|
51
51
|
elif isinstance(command, ChitChatAnswerCommand):
|
rasa/server.py
CHANGED
|
@@ -272,7 +272,9 @@ def requires_auth(
|
|
|
272
272
|
raise ErrorResponse(
|
|
273
273
|
HTTPStatus.UNAUTHORIZED,
|
|
274
274
|
"NotAuthenticated",
|
|
275
|
-
"User is not authenticated.",
|
|
275
|
+
"User is not authenticated. ",
|
|
276
|
+
"Please make sure the use of token is supported and that "
|
|
277
|
+
"the supplied token is valid.",
|
|
276
278
|
help_url=_docs(
|
|
277
279
|
"/user-guide/configuring-http-api/#security-considerations"
|
|
278
280
|
),
|
rasa/shared/constants.py
CHANGED
|
@@ -166,6 +166,7 @@ OPENAI_API_VERSION_CONFIG_KEY = "openai_api_version"
|
|
|
166
166
|
|
|
167
167
|
AWS_BEDROCK_PROVIDER = "bedrock"
|
|
168
168
|
AWS_SAGEMAKER_PROVIDER = "sagemaker"
|
|
169
|
+
AWS_SAGEMAKER_CHAT_PROVIDER = "sagemaker"
|
|
169
170
|
|
|
170
171
|
API_BASE_CONFIG_KEY = "api_base"
|
|
171
172
|
API_TYPE_CONFIG_KEY = "api_type"
|
rasa/shared/core/constants.py
CHANGED
rasa/shared/core/events.py
CHANGED
|
@@ -31,6 +31,7 @@ from typing import Union
|
|
|
31
31
|
|
|
32
32
|
from rasa.shared.constants import DOCS_URL_TRAINING_DATA
|
|
33
33
|
from rasa.shared.core.constants import (
|
|
34
|
+
ERROR_CODE_KEY,
|
|
34
35
|
LOOP_NAME,
|
|
35
36
|
EXTERNAL_MESSAGE_PREFIX,
|
|
36
37
|
ACTION_NAME_SENDER_ID_CONNECTOR_STR,
|
|
@@ -2557,3 +2558,69 @@ class SessionEnded(AlwaysEqualEventMixin):
|
|
|
2557
2558
|
"""Applies event to current conversation state."""
|
|
2558
2559
|
# noinspection PyProtectedMember
|
|
2559
2560
|
tracker._reset()
|
|
2561
|
+
|
|
2562
|
+
|
|
2563
|
+
class ErrorHandled(Event):
|
|
2564
|
+
"""An error occurred during the conversation.
|
|
2565
|
+
|
|
2566
|
+
The error message is stored in the metadata of the event.
|
|
2567
|
+
"""
|
|
2568
|
+
|
|
2569
|
+
type_name = "error"
|
|
2570
|
+
|
|
2571
|
+
def __init__(
|
|
2572
|
+
self,
|
|
2573
|
+
error_code: int,
|
|
2574
|
+
timestamp: Optional[float] = None,
|
|
2575
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
2576
|
+
) -> None:
|
|
2577
|
+
"""Creates event for an error.
|
|
2578
|
+
|
|
2579
|
+
Args:
|
|
2580
|
+
error_code: Error int code.
|
|
2581
|
+
timestamp: When the event was created.
|
|
2582
|
+
metadata: Additional event metadata.
|
|
2583
|
+
"""
|
|
2584
|
+
self.error_code = error_code
|
|
2585
|
+
super().__init__(timestamp, metadata)
|
|
2586
|
+
|
|
2587
|
+
def __str__(self) -> Text:
|
|
2588
|
+
"""Returns text representation of event."""
|
|
2589
|
+
return f"ErrorHandled({self.error_code})"
|
|
2590
|
+
|
|
2591
|
+
def __repr__(self) -> Text:
|
|
2592
|
+
"""Returns event as string for debugging."""
|
|
2593
|
+
return f"ErrorHandled({self.error_code}, {self.timestamp}, {self.metadata})"
|
|
2594
|
+
|
|
2595
|
+
def __hash__(self) -> int:
|
|
2596
|
+
"""Returns unique hash for event."""
|
|
2597
|
+
return hash(self.error_code)
|
|
2598
|
+
|
|
2599
|
+
def __eq__(self, other: Any) -> bool:
|
|
2600
|
+
"""Compares object with other object."""
|
|
2601
|
+
if not isinstance(other, ErrorHandled):
|
|
2602
|
+
return NotImplemented
|
|
2603
|
+
|
|
2604
|
+
return self.error_code == other.error_code
|
|
2605
|
+
|
|
2606
|
+
def as_story_string(self) -> Text:
|
|
2607
|
+
"""Returns text representation of event."""
|
|
2608
|
+
props = json.dumps({ERROR_CODE_KEY: self.error_code})
|
|
2609
|
+
return f"{ErrorHandled.type_name}{props}"
|
|
2610
|
+
|
|
2611
|
+
@classmethod
|
|
2612
|
+
def _from_story_string(cls, parameters: Dict[Text, Any]) -> List["ErrorHandled"]:
|
|
2613
|
+
"""Called to convert a parsed story line into an event."""
|
|
2614
|
+
return [
|
|
2615
|
+
ErrorHandled(
|
|
2616
|
+
parameters.get(ERROR_CODE_KEY),
|
|
2617
|
+
parameters.get("timestamp"),
|
|
2618
|
+
parameters.get("metadata"),
|
|
2619
|
+
)
|
|
2620
|
+
]
|
|
2621
|
+
|
|
2622
|
+
def as_dict(self) -> Dict[Text, Any]:
|
|
2623
|
+
"""Returns serialized event."""
|
|
2624
|
+
serialized = super().as_dict()
|
|
2625
|
+
serialized.update({ERROR_CODE_KEY: self.error_code})
|
|
2626
|
+
return serialized
|
|
@@ -3,6 +3,7 @@ from typing import Dict, Any
|
|
|
3
3
|
from rasa.shared.constants import (
|
|
4
4
|
AWS_BEDROCK_PROVIDER,
|
|
5
5
|
AWS_SAGEMAKER_PROVIDER,
|
|
6
|
+
AWS_SAGEMAKER_CHAT_PROVIDER,
|
|
6
7
|
)
|
|
7
8
|
from rasa.shared.providers._configs.default_litellm_client_config import (
|
|
8
9
|
DefaultLiteLLMClientConfig,
|
|
@@ -98,7 +99,11 @@ class DefaultLiteLLMClient(_BaseLiteLLMClient):
|
|
|
98
99
|
# SageMaker) in Rasa by allowing AWS secrets to be provided as extra
|
|
99
100
|
# parameters without triggering validation errors due to missing AWS
|
|
100
101
|
# environment variables.
|
|
101
|
-
if self.provider.lower() in [
|
|
102
|
+
if self.provider.lower() in [
|
|
103
|
+
AWS_BEDROCK_PROVIDER,
|
|
104
|
+
AWS_SAGEMAKER_PROVIDER,
|
|
105
|
+
AWS_SAGEMAKER_CHAT_PROVIDER,
|
|
106
|
+
]:
|
|
102
107
|
validate_aws_setup_for_litellm_clients(
|
|
103
108
|
self._litellm_model_name,
|
|
104
109
|
self._litellm_extra_parameters,
|
|
@@ -165,8 +165,7 @@ DIALOGUE_STACK_UPDATED = {
|
|
|
165
165
|
}
|
|
166
166
|
ROUTING_SESSION_ENDED = {"properties": {"event": {"const": "routing_session_ended"}}}
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
ROUTING_SESSION_ENDED = {"properties": {"event": {"const": "routing_session_ended"}}}
|
|
168
|
+
ERROR_HANDLED = {"properties": {"event": {"const": "error"}}}
|
|
170
169
|
|
|
171
170
|
EVENT_SCHEMA = {
|
|
172
171
|
"type": "object",
|
|
@@ -208,6 +207,7 @@ EVENT_SCHEMA = {
|
|
|
208
207
|
DIALOGUE_STACK_UPDATED,
|
|
209
208
|
ROUTING_SESSION_ENDED,
|
|
210
209
|
SESSION_ENDED,
|
|
210
|
+
ERROR_HANDLED,
|
|
211
211
|
],
|
|
212
212
|
}
|
|
213
213
|
|
rasa/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rasa-pro
|
|
3
|
-
Version: 3.11.
|
|
3
|
+
Version: 3.11.6
|
|
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
|
|
@@ -8,11 +8,10 @@ Author: Rasa Technologies GmbH
|
|
|
8
8
|
Author-email: hi@rasa.com
|
|
9
9
|
Maintainer: Tom Bocklisch
|
|
10
10
|
Maintainer-email: tom@rasa.com
|
|
11
|
-
Requires-Python: >=3.9,<3.12
|
|
11
|
+
Requires-Python: >=3.9.2,<3.12
|
|
12
12
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Classifier: Topic :: Software Development :: Libraries
|
|
@@ -40,7 +39,7 @@ Requires-Dist: colorclass (>=2.2,<2.3)
|
|
|
40
39
|
Requires-Dist: coloredlogs (>=15,<16)
|
|
41
40
|
Requires-Dist: colorhash (>=2.0,<2.1.0)
|
|
42
41
|
Requires-Dist: confluent-kafka (>=2.3.0,<3.0.0)
|
|
43
|
-
Requires-Dist: cryptography (>=
|
|
42
|
+
Requires-Dist: cryptography (>=44.0.1)
|
|
44
43
|
Requires-Dist: cvg-python-sdk (>=0.5.1,<0.6.0)
|
|
45
44
|
Requires-Dist: dask (>=2024.7.0,<2024.8.0)
|
|
46
45
|
Requires-Dist: demoji (>=1.1.0,<2.0.0)
|
|
@@ -57,13 +56,13 @@ Requires-Dist: hvac (>=1.2.1,<2.0.0)
|
|
|
57
56
|
Requires-Dist: importlib-metadata (>=8.5.0,<8.6.0)
|
|
58
57
|
Requires-Dist: importlib-resources (==6.1.3)
|
|
59
58
|
Requires-Dist: jieba (>=0.42.1,<0.43) ; extra == "jieba" or extra == "full"
|
|
60
|
-
Requires-Dist: jinja2 (>=3.1.
|
|
59
|
+
Requires-Dist: jinja2 (>=3.1.6,<3.2.0)
|
|
61
60
|
Requires-Dist: jsonpatch (>=1.33,<2.0)
|
|
62
61
|
Requires-Dist: jsonpickle (>=3.3.0,<3.4)
|
|
63
62
|
Requires-Dist: jsonschema (>=4.22)
|
|
64
63
|
Requires-Dist: keras (==2.14.0)
|
|
65
|
-
Requires-Dist: langchain (>=0.2.
|
|
66
|
-
Requires-Dist: langchain-community (>=0.2.
|
|
64
|
+
Requires-Dist: langchain (>=0.2.17,<0.3.0)
|
|
65
|
+
Requires-Dist: langchain-community (>=0.2.19,<0.3.0)
|
|
67
66
|
Requires-Dist: litellm (>=1.52.6,<1.53.0)
|
|
68
67
|
Requires-Dist: matplotlib (>=3.7,<3.8)
|
|
69
68
|
Requires-Dist: mattermostwrapper (>=2.2,<2.3)
|
|
@@ -106,7 +105,7 @@ Requires-Dist: randomname (>=0.2.1,<0.3.0)
|
|
|
106
105
|
Requires-Dist: rasa-sdk (==3.11.0)
|
|
107
106
|
Requires-Dist: redis (>=4.6.0,<6.0)
|
|
108
107
|
Requires-Dist: regex (>=2022.10.31,<2022.11)
|
|
109
|
-
Requires-Dist: requests (>=2.
|
|
108
|
+
Requires-Dist: requests (>=2.32.2,<2.33.0)
|
|
110
109
|
Requires-Dist: rich (>=13.4.2,<14.0.0)
|
|
111
110
|
Requires-Dist: rocketchat_API (>=1.30.0,<1.31.0)
|
|
112
111
|
Requires-Dist: ruamel.yaml (>=0.17.21,<0.17.22)
|