rasa-pro 3.11.0rc1__py3-none-any.whl → 3.11.0rc3__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/cli/inspect.py +2 -0
- rasa/cli/studio/studio.py +18 -8
- rasa/core/actions/action_repeat_bot_messages.py +17 -0
- rasa/core/channels/channel.py +17 -0
- rasa/core/channels/development_inspector.py +4 -1
- rasa/core/channels/voice_ready/audiocodes.py +15 -4
- rasa/core/channels/voice_ready/jambonz.py +13 -2
- rasa/core/channels/voice_ready/twilio_voice.py +6 -21
- rasa/core/channels/voice_stream/asr/asr_event.py +1 -1
- rasa/core/channels/voice_stream/asr/azure.py +5 -7
- rasa/core/channels/voice_stream/asr/deepgram.py +13 -11
- rasa/core/channels/voice_stream/voice_channel.py +61 -19
- rasa/core/nlg/contextual_response_rephraser.py +20 -12
- rasa/core/policies/enterprise_search_policy.py +32 -72
- rasa/core/policies/intentless_policy.py +34 -72
- rasa/dialogue_understanding/coexistence/llm_based_router.py +18 -33
- rasa/dialogue_understanding/generator/constants.py +0 -2
- rasa/dialogue_understanding/generator/flow_retrieval.py +33 -50
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +12 -40
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +18 -20
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +19 -1
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +26 -22
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +9 -0
- rasa/dialogue_understanding/processor/command_processor.py +21 -1
- rasa/e2e_test/e2e_test_case.py +85 -6
- rasa/engine/validation.py +88 -60
- rasa/model_service.py +3 -0
- rasa/nlu/tokenizers/whitespace_tokenizer.py +3 -14
- rasa/server.py +3 -1
- rasa/shared/constants.py +5 -5
- rasa/shared/core/constants.py +1 -1
- rasa/shared/core/domain.py +0 -26
- rasa/shared/core/flows/flows_list.py +5 -1
- rasa/shared/providers/_configs/litellm_router_client_config.py +29 -9
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +6 -14
- rasa/shared/providers/embedding/litellm_router_embedding_client.py +1 -1
- rasa/shared/providers/llm/_base_litellm_client.py +32 -1
- rasa/shared/providers/llm/litellm_router_llm_client.py +56 -1
- rasa/shared/providers/llm/self_hosted_llm_client.py +4 -28
- rasa/shared/providers/router/_base_litellm_router_client.py +35 -1
- rasa/shared/utils/common.py +1 -1
- rasa/shared/utils/health_check/__init__.py +0 -0
- rasa/shared/utils/health_check/embeddings_health_check_mixin.py +31 -0
- rasa/shared/utils/health_check/health_check.py +256 -0
- rasa/shared/utils/health_check/llm_health_check_mixin.py +31 -0
- rasa/shared/utils/llm.py +5 -2
- rasa/shared/utils/yaml.py +102 -62
- rasa/studio/auth.py +3 -5
- rasa/studio/config.py +13 -4
- rasa/studio/constants.py +1 -0
- rasa/studio/data_handler.py +10 -3
- rasa/studio/upload.py +21 -10
- rasa/telemetry.py +15 -1
- rasa/tracing/config.py +3 -1
- rasa/tracing/instrumentation/attribute_extractors.py +20 -0
- rasa/tracing/instrumentation/instrumentation.py +121 -0
- rasa/utils/common.py +5 -0
- rasa/utils/io.py +8 -16
- rasa/utils/sanic_error_handler.py +32 -0
- rasa/version.py +1 -1
- {rasa_pro-3.11.0rc1.dist-info → rasa_pro-3.11.0rc3.dist-info}/METADATA +3 -2
- {rasa_pro-3.11.0rc1.dist-info → rasa_pro-3.11.0rc3.dist-info}/RECORD +65 -61
- rasa/shared/utils/health_check.py +0 -533
- {rasa_pro-3.11.0rc1.dist-info → rasa_pro-3.11.0rc3.dist-info}/NOTICE +0 -0
- {rasa_pro-3.11.0rc1.dist-info → rasa_pro-3.11.0rc3.dist-info}/WHEEL +0 -0
- {rasa_pro-3.11.0rc1.dist-info → rasa_pro-3.11.0rc3.dist-info}/entry_points.txt +0 -0
|
@@ -45,6 +45,7 @@ from rasa.dialogue_understanding.generator import (
|
|
|
45
45
|
MultiStepLLMCommandGenerator,
|
|
46
46
|
SingleStepLLMCommandGenerator,
|
|
47
47
|
)
|
|
48
|
+
from rasa.dialogue_understanding.generator.flow_retrieval import FlowRetrieval
|
|
48
49
|
from rasa.dialogue_understanding.generator.nlu_command_adapter import NLUCommandAdapter
|
|
49
50
|
from rasa.engine.graph import GraphNode
|
|
50
51
|
from rasa.engine.training.graph_trainer import GraphTrainer
|
|
@@ -283,6 +284,7 @@ SingleStepLLMCommandGeneratorType = TypeVar(
|
|
|
283
284
|
MultiStepLLMCommandGeneratorType = TypeVar(
|
|
284
285
|
"MultiStepLLMCommandGeneratorType", bound=MultiStepLLMCommandGenerator
|
|
285
286
|
)
|
|
287
|
+
FlowRetrievalType = TypeVar("FlowRetrievalType", bound=FlowRetrieval)
|
|
286
288
|
CommandType = TypeVar("CommandType", bound=Command)
|
|
287
289
|
PolicyType = TypeVar("PolicyType", bound=Policy)
|
|
288
290
|
InformationRetrievalType = TypeVar(
|
|
@@ -317,6 +319,7 @@ def instrument(
|
|
|
317
319
|
custom_action_executor_subclasses: Optional[
|
|
318
320
|
List[Type[CustomActionExecutor]]
|
|
319
321
|
] = None,
|
|
322
|
+
flow_retrieval_class: Optional[Type[FlowRetrievalType]] = None,
|
|
320
323
|
) -> None:
|
|
321
324
|
"""Substitute methods to be traced by their traced counterparts.
|
|
322
325
|
|
|
@@ -445,6 +448,12 @@ def instrument(
|
|
|
445
448
|
"_check_commands_against_startable_flows",
|
|
446
449
|
attribute_extractors.extract_attrs_for_check_commands_against_startable_flows,
|
|
447
450
|
)
|
|
451
|
+
_instrument_perform_health_check_method_for_component(
|
|
452
|
+
tracer_provider.get_tracer(llm_command_generator_class.__module__),
|
|
453
|
+
llm_command_generator_class,
|
|
454
|
+
"perform_llm_health_check",
|
|
455
|
+
attribute_extractors.extract_attrs_for_performing_health_check,
|
|
456
|
+
)
|
|
448
457
|
mark_class_as_instrumented(llm_command_generator_class)
|
|
449
458
|
|
|
450
459
|
if (
|
|
@@ -468,6 +477,14 @@ def instrument(
|
|
|
468
477
|
"_check_commands_against_startable_flows",
|
|
469
478
|
attribute_extractors.extract_attrs_for_check_commands_against_startable_flows,
|
|
470
479
|
)
|
|
480
|
+
_instrument_perform_health_check_method_for_component(
|
|
481
|
+
tracer_provider.get_tracer(
|
|
482
|
+
single_step_llm_command_generator_class.__module__
|
|
483
|
+
),
|
|
484
|
+
single_step_llm_command_generator_class,
|
|
485
|
+
"perform_llm_health_check",
|
|
486
|
+
attribute_extractors.extract_attrs_for_performing_health_check,
|
|
487
|
+
)
|
|
471
488
|
mark_class_as_instrumented(single_step_llm_command_generator_class)
|
|
472
489
|
|
|
473
490
|
if multi_step_llm_command_generator_class is not None and not class_is_instrumented(
|
|
@@ -488,8 +505,36 @@ def instrument(
|
|
|
488
505
|
),
|
|
489
506
|
multi_step_llm_command_generator_class,
|
|
490
507
|
)
|
|
508
|
+
_instrument_perform_health_check_method_for_component(
|
|
509
|
+
tracer_provider.get_tracer(
|
|
510
|
+
multi_step_llm_command_generator_class.__module__
|
|
511
|
+
),
|
|
512
|
+
multi_step_llm_command_generator_class,
|
|
513
|
+
"perform_llm_health_check",
|
|
514
|
+
attribute_extractors.extract_attrs_for_performing_health_check,
|
|
515
|
+
)
|
|
491
516
|
mark_class_as_instrumented(multi_step_llm_command_generator_class)
|
|
492
517
|
|
|
518
|
+
if (
|
|
519
|
+
any(
|
|
520
|
+
llm_based_command_generator_class is not None
|
|
521
|
+
for llm_based_command_generator_class in (
|
|
522
|
+
llm_command_generator_class,
|
|
523
|
+
single_step_llm_command_generator_class,
|
|
524
|
+
multi_step_llm_command_generator_class,
|
|
525
|
+
)
|
|
526
|
+
)
|
|
527
|
+
and flow_retrieval_class is not None
|
|
528
|
+
and not class_is_instrumented(flow_retrieval_class)
|
|
529
|
+
):
|
|
530
|
+
_instrument_perform_health_check_method_for_component(
|
|
531
|
+
tracer_provider.get_tracer(flow_retrieval_class.__module__),
|
|
532
|
+
flow_retrieval_class,
|
|
533
|
+
"perform_embeddings_health_check",
|
|
534
|
+
attribute_extractors.extract_attrs_for_performing_health_check,
|
|
535
|
+
)
|
|
536
|
+
mark_class_as_instrumented(flow_retrieval_class)
|
|
537
|
+
|
|
493
538
|
if command_subclasses:
|
|
494
539
|
for command_subclass in command_subclasses:
|
|
495
540
|
if command_subclass is not None and not class_is_instrumented(
|
|
@@ -524,6 +569,12 @@ def instrument(
|
|
|
524
569
|
"generate",
|
|
525
570
|
attribute_extractors.extract_attrs_for_generate,
|
|
526
571
|
)
|
|
572
|
+
_instrument_perform_health_check_method_for_component(
|
|
573
|
+
tracer_provider.get_tracer(contextual_response_rephraser_class.__module__),
|
|
574
|
+
contextual_response_rephraser_class,
|
|
575
|
+
"perform_llm_health_check",
|
|
576
|
+
attribute_extractors.extract_attrs_for_performing_health_check,
|
|
577
|
+
)
|
|
527
578
|
mark_class_as_instrumented(contextual_response_rephraser_class)
|
|
528
579
|
|
|
529
580
|
if not module_is_instrumented(COMMAND_PROCESSOR_MODULE_NAME):
|
|
@@ -755,6 +806,18 @@ def _instrument_enterprise_search_policy(
|
|
|
755
806
|
"_generate_llm_answer",
|
|
756
807
|
attribute_extractors.extract_attrs_for_enterprise_search_generate_llm_answer,
|
|
757
808
|
)
|
|
809
|
+
_instrument_perform_health_check_method_for_component(
|
|
810
|
+
tracer_provider.get_tracer(policy_class.__module__),
|
|
811
|
+
policy_class,
|
|
812
|
+
"perform_embeddings_health_check",
|
|
813
|
+
attribute_extractors.extract_attrs_for_performing_health_check,
|
|
814
|
+
)
|
|
815
|
+
_instrument_perform_health_check_method_for_component(
|
|
816
|
+
tracer_provider.get_tracer(policy_class.__module__),
|
|
817
|
+
policy_class,
|
|
818
|
+
"perform_llm_health_check",
|
|
819
|
+
attribute_extractors.extract_attrs_for_performing_health_check,
|
|
820
|
+
)
|
|
758
821
|
|
|
759
822
|
|
|
760
823
|
def _instrument_intentless_policy(
|
|
@@ -787,6 +850,18 @@ def _instrument_intentless_policy(
|
|
|
787
850
|
"_generate_llm_answer",
|
|
788
851
|
attribute_extractors.extract_attrs_for_intentless_policy_generate_llm_answer,
|
|
789
852
|
)
|
|
853
|
+
_instrument_perform_health_check_method_for_component(
|
|
854
|
+
tracer_provider.get_tracer(policy_class.__module__),
|
|
855
|
+
policy_class,
|
|
856
|
+
"perform_embeddings_health_check",
|
|
857
|
+
attribute_extractors.extract_attrs_for_performing_health_check,
|
|
858
|
+
)
|
|
859
|
+
_instrument_perform_health_check_method_for_component(
|
|
860
|
+
tracer_provider.get_tracer(policy_class.__module__),
|
|
861
|
+
policy_class,
|
|
862
|
+
"perform_llm_health_check",
|
|
863
|
+
attribute_extractors.extract_attrs_for_performing_health_check,
|
|
864
|
+
)
|
|
790
865
|
|
|
791
866
|
|
|
792
867
|
def _instrument_processor(
|
|
@@ -1139,6 +1214,52 @@ def _instrument_grpc_custom_action_executor(
|
|
|
1139
1214
|
logger.debug(f"Instrumented '{grpc_custom_action_executor_class.__name__}.run.")
|
|
1140
1215
|
|
|
1141
1216
|
|
|
1217
|
+
def _instrument_perform_health_check_method_for_component(
|
|
1218
|
+
tracer: Tracer,
|
|
1219
|
+
instrumented_class: Type,
|
|
1220
|
+
method_name: Text,
|
|
1221
|
+
attr_extractor: Optional[Callable] = None,
|
|
1222
|
+
return_value_attr_extractor: Optional[Callable] = None,
|
|
1223
|
+
) -> None:
|
|
1224
|
+
def tracing_perform_health_check_for_component(
|
|
1225
|
+
fn: Callable[..., S],
|
|
1226
|
+
) -> Callable[..., S]:
|
|
1227
|
+
@functools.wraps(fn)
|
|
1228
|
+
def wrapper(*args: Any, **kwargs: Any) -> S:
|
|
1229
|
+
# Check the first argument to adjust for self/cls depending on how
|
|
1230
|
+
# the static method from LLMHealthCheckMixin / EmbeddingsLLMHealthCheckMixin
|
|
1231
|
+
# is called.
|
|
1232
|
+
if args and isinstance(
|
|
1233
|
+
args[0], (instrumented_class, type(instrumented_class))
|
|
1234
|
+
):
|
|
1235
|
+
# The first argument is self/cls; align args to match the signature
|
|
1236
|
+
args = args[1:]
|
|
1237
|
+
|
|
1238
|
+
span_name = f"{instrumented_class.__name__}.{fn.__name__}"
|
|
1239
|
+
extracted_attrs = attr_extractor(*args, **kwargs) if attr_extractor else {}
|
|
1240
|
+
|
|
1241
|
+
with tracer.start_as_current_span(span_name) as span:
|
|
1242
|
+
result = fn(*args, **kwargs)
|
|
1243
|
+
|
|
1244
|
+
# Extract attributes from the return value, if an extractor is provided
|
|
1245
|
+
return_value_attributes = (
|
|
1246
|
+
return_value_attr_extractor(result, *args, **kwargs)
|
|
1247
|
+
if return_value_attr_extractor
|
|
1248
|
+
else {}
|
|
1249
|
+
)
|
|
1250
|
+
|
|
1251
|
+
span.set_attributes({**extracted_attrs, **return_value_attributes})
|
|
1252
|
+
return result
|
|
1253
|
+
|
|
1254
|
+
return wrapper
|
|
1255
|
+
|
|
1256
|
+
method_to_trace = getattr(instrumented_class, method_name)
|
|
1257
|
+
traced_method = tracing_perform_health_check_for_component(method_to_trace)
|
|
1258
|
+
setattr(instrumented_class, method_name, traced_method)
|
|
1259
|
+
|
|
1260
|
+
logger.debug(f"Instrumented '{instrumented_class.__name__}.{method_name}'.")
|
|
1261
|
+
|
|
1262
|
+
|
|
1142
1263
|
def _mangled_instrumented_boolean_attribute_name(instrumented_class: Type) -> Text:
|
|
1143
1264
|
# see https://peps.python.org/pep-0008/#method-names-and-instance-variables
|
|
1144
1265
|
# and https://stackoverflow.com/a/50401073
|
rasa/utils/common.py
CHANGED
|
@@ -90,6 +90,11 @@ EXPECTED_WARNINGS: List[Tuple[Type[Warning], str]] = [
|
|
|
90
90
|
# Ignore Keras DeprecationWarning since it requires that we
|
|
91
91
|
# upgrade tensorflow-macos to 2.13.0 version.
|
|
92
92
|
(DeprecationWarning, "invalid escape sequence*"),
|
|
93
|
+
# Ignore importlib open_text and read_text warnings for now
|
|
94
|
+
(
|
|
95
|
+
DeprecationWarning,
|
|
96
|
+
"https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy",
|
|
97
|
+
),
|
|
93
98
|
]
|
|
94
99
|
|
|
95
100
|
PYTHON_LOGGING_SCHEMA_DOCS = (
|
rasa/utils/io.py
CHANGED
|
@@ -18,7 +18,6 @@ from typing import (
|
|
|
18
18
|
Type,
|
|
19
19
|
Callable,
|
|
20
20
|
TYPE_CHECKING,
|
|
21
|
-
Pattern,
|
|
22
21
|
)
|
|
23
22
|
|
|
24
23
|
from ruamel import yaml
|
|
@@ -167,21 +166,14 @@ def create_validator(
|
|
|
167
166
|
return FunctionValidator
|
|
168
167
|
|
|
169
168
|
|
|
170
|
-
def
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"\U00002702-\U000027b0"
|
|
179
|
-
"\U000024c2-\U0001f251"
|
|
180
|
-
"\u200d" # zero width joiner
|
|
181
|
-
"\u200c" # zero width non-joiner
|
|
182
|
-
"]+",
|
|
183
|
-
flags=re.UNICODE,
|
|
184
|
-
)
|
|
169
|
+
def remove_emojis(s: str) -> str:
|
|
170
|
+
import demoji
|
|
171
|
+
|
|
172
|
+
replaced = demoji.replace(s)
|
|
173
|
+
if replaced == s:
|
|
174
|
+
return s
|
|
175
|
+
# remove duplicate or trailing whitespaces if emojis were removed
|
|
176
|
+
return re.sub(r" +", " ", replaced).strip()
|
|
185
177
|
|
|
186
178
|
|
|
187
179
|
def are_directories_equal(dir1: Path, dir2: Path) -> bool:
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from sanic import Sanic
|
|
2
|
+
from sanic.handlers import ErrorHandler
|
|
3
|
+
from sanic.request import Request
|
|
4
|
+
from sanic.exceptions import ServerError
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# TODO: remove custom handler when upgrading to sanic >= 24
|
|
8
|
+
# the underlying issue https://github.com/sanic-org/sanic/issues/2572
|
|
9
|
+
# has been fixed in sanic 24
|
|
10
|
+
class IgnoreWSServerErrorHandler(ErrorHandler):
|
|
11
|
+
@staticmethod
|
|
12
|
+
def log(request: Request, exception: Exception) -> None:
|
|
13
|
+
try:
|
|
14
|
+
if (
|
|
15
|
+
request.url.startswith("ws")
|
|
16
|
+
and isinstance(exception, ServerError)
|
|
17
|
+
and exception.args
|
|
18
|
+
and (
|
|
19
|
+
exception.args[0]
|
|
20
|
+
== "Invalid response type None (need HTTPResponse)"
|
|
21
|
+
)
|
|
22
|
+
):
|
|
23
|
+
# in case we are in a websocket connection, we don't want to log the
|
|
24
|
+
# the error, as this is a bug in sanic
|
|
25
|
+
return
|
|
26
|
+
except Exception:
|
|
27
|
+
pass
|
|
28
|
+
ErrorHandler.log(request, exception) # type: ignore
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def register_custom_sanic_error_handler(app: Sanic) -> None:
|
|
32
|
+
app.error_handler = IgnoreWSServerErrorHandler()
|
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.0rc3
|
|
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
|
|
@@ -43,6 +43,7 @@ Requires-Dist: confluent-kafka (>=2.3.0,<3.0.0)
|
|
|
43
43
|
Requires-Dist: cryptography (>=42.0.5)
|
|
44
44
|
Requires-Dist: cvg-python-sdk (>=0.5.1,<0.6.0)
|
|
45
45
|
Requires-Dist: dask (>=2024.7.0,<2024.8.0)
|
|
46
|
+
Requires-Dist: demoji (>=1.1.0,<2.0.0)
|
|
46
47
|
Requires-Dist: diskcache (>=5.6.3,<5.7.0)
|
|
47
48
|
Requires-Dist: dnspython (==2.6.1)
|
|
48
49
|
Requires-Dist: faiss-cpu (>=1.7.4,<2.0.0)
|
|
@@ -69,7 +70,7 @@ Requires-Dist: mattermostwrapper (>=2.2,<2.3)
|
|
|
69
70
|
Requires-Dist: mlflow (>=2.15.1,<3.0.0) ; extra == "mlflow"
|
|
70
71
|
Requires-Dist: networkx (>=3.1,<3.2)
|
|
71
72
|
Requires-Dist: numpy (>=1.26.4,<1.27.0)
|
|
72
|
-
Requires-Dist: openai (>=1.
|
|
73
|
+
Requires-Dist: openai (>=1.55.3,<1.56.0)
|
|
73
74
|
Requires-Dist: openpyxl (>=3.1.5,<4.0.0)
|
|
74
75
|
Requires-Dist: opentelemetry-api (>=1.16.0,<1.17.0)
|
|
75
76
|
Requires-Dist: opentelemetry-exporter-jaeger (>=1.16.0,<1.17.0)
|