rasa-pro 3.13.0.dev1__py3-none-any.whl → 3.13.0.dev3__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/run.py +10 -6
- rasa/cli/utils.py +7 -0
- rasa/core/actions/action.py +0 -6
- rasa/core/channels/channel.py +30 -0
- rasa/core/channels/voice_ready/audiocodes.py +52 -17
- rasa/core/channels/voice_ready/jambonz.py +25 -5
- rasa/core/channels/voice_ready/jambonz_protocol.py +4 -0
- rasa/core/channels/voice_stream/audiocodes.py +53 -9
- rasa/core/channels/voice_stream/genesys.py +146 -16
- rasa/core/information_retrieval/faiss.py +6 -62
- rasa/core/nlg/contextual_response_rephraser.py +3 -0
- rasa/core/policies/enterprise_search_policy.py +10 -1
- rasa/core/policies/flows/flow_executor.py +3 -38
- rasa/core/policies/intentless_policy.py +3 -0
- rasa/core/processor.py +27 -6
- rasa/core/utils.py +53 -0
- rasa/dialogue_understanding/coexistence/llm_based_router.py +8 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +4 -59
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -2
- rasa/dialogue_understanding/commands/start_flow_command.py +0 -41
- rasa/dialogue_understanding/generator/command_generator.py +67 -0
- rasa/dialogue_understanding/generator/flow_retrieval.py +1 -4
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +2 -12
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +13 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +1 -1
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +2 -5
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +22 -10
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +27 -12
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +0 -61
- rasa/dialogue_understanding/processor/command_processor.py +7 -65
- rasa/dialogue_understanding/stack/utils.py +0 -38
- rasa/e2e_test/utils/validation.py +3 -3
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +3 -0
- rasa/shared/core/constants.py +0 -8
- rasa/shared/core/domain.py +12 -3
- rasa/shared/core/flows/flow.py +0 -17
- rasa/shared/core/flows/flows_yaml_schema.json +3 -38
- rasa/shared/core/flows/steps/collect.py +5 -18
- rasa/shared/core/flows/utils.py +1 -16
- rasa/shared/core/slot_mappings.py +11 -5
- rasa/shared/nlu/constants.py +0 -1
- rasa/shared/utils/common.py +11 -1
- rasa/shared/utils/constants.py +3 -0
- rasa/shared/utils/llm.py +69 -23
- rasa/validator.py +1 -123
- rasa/version.py +1 -1
- {rasa_pro-3.13.0.dev1.dist-info → rasa_pro-3.13.0.dev3.dist-info}/METADATA +2 -2
- {rasa_pro-3.13.0.dev1.dist-info → rasa_pro-3.13.0.dev3.dist-info}/RECORD +51 -54
- rasa/core/actions/action_handle_digressions.py +0 -164
- rasa/dialogue_understanding/commands/handle_digressions_command.py +0 -144
- rasa/dialogue_understanding/patterns/handle_digressions.py +0 -81
- {rasa_pro-3.13.0.dev1.dist-info → rasa_pro-3.13.0.dev3.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.0.dev1.dist-info → rasa_pro-3.13.0.dev3.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.0.dev1.dist-info → rasa_pro-3.13.0.dev3.dist-info}/entry_points.txt +0 -0
|
@@ -217,15 +217,12 @@
|
|
|
217
217
|
"reset_after_flow_ends": {
|
|
218
218
|
"type": "boolean"
|
|
219
219
|
},
|
|
220
|
-
"ask_confirm_digressions": {
|
|
221
|
-
"$ref": "#/$defs/ask_confirm_digressions"
|
|
222
|
-
},
|
|
223
|
-
"block_digressions": {
|
|
224
|
-
"$ref": "#/$defs/block_digressions"
|
|
225
|
-
},
|
|
226
220
|
"utter": {
|
|
227
221
|
"type": "string"
|
|
228
222
|
},
|
|
223
|
+
"force_slot_filling": {
|
|
224
|
+
"type": "boolean"
|
|
225
|
+
},
|
|
229
226
|
"rejections": {
|
|
230
227
|
"type": "array",
|
|
231
228
|
"schema_name": "list of rejections",
|
|
@@ -253,32 +250,6 @@
|
|
|
253
250
|
}
|
|
254
251
|
}
|
|
255
252
|
},
|
|
256
|
-
"ask_confirm_digressions": {
|
|
257
|
-
"oneOf": [
|
|
258
|
-
{
|
|
259
|
-
"type": "boolean"
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
"type": "array",
|
|
263
|
-
"items": {
|
|
264
|
-
"type": "string"
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
]
|
|
268
|
-
},
|
|
269
|
-
"block_digressions": {
|
|
270
|
-
"oneOf": [
|
|
271
|
-
{
|
|
272
|
-
"type": "boolean"
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
"type": "array",
|
|
276
|
-
"items": {
|
|
277
|
-
"type": "string"
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
]
|
|
281
|
-
},
|
|
282
253
|
"flow": {
|
|
283
254
|
"required": [
|
|
284
255
|
"steps",
|
|
@@ -340,12 +311,6 @@
|
|
|
340
311
|
"persisted_slots": {
|
|
341
312
|
"$ref": "#/$defs/persisted_slots"
|
|
342
313
|
},
|
|
343
|
-
"ask_confirm_digressions": {
|
|
344
|
-
"$ref": "#/$defs/ask_confirm_digressions"
|
|
345
|
-
},
|
|
346
|
-
"block_digressions": {
|
|
347
|
-
"$ref": "#/$defs/block_digressions"
|
|
348
|
-
},
|
|
349
314
|
"run_pattern_completed": {
|
|
350
315
|
"type": "boolean"
|
|
351
316
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from dataclasses import dataclass
|
|
3
|
+
from dataclasses import dataclass
|
|
4
4
|
from typing import Any, Dict, List, Set, Text
|
|
5
5
|
|
|
6
6
|
from rasa.shared.constants import ACTION_ASK_PREFIX, UTTER_ASK_PREFIX
|
|
7
|
-
from rasa.shared.core.constants import (
|
|
8
|
-
KEY_ASK_CONFIRM_DIGRESSIONS,
|
|
9
|
-
KEY_BLOCK_DIGRESSIONS,
|
|
10
|
-
)
|
|
11
7
|
from rasa.shared.core.flows.flow_step import FlowStep
|
|
12
|
-
from rasa.shared.core.flows.utils import extract_digression_prop
|
|
13
8
|
from rasa.shared.core.slots import SlotRejection
|
|
14
9
|
|
|
15
10
|
|
|
@@ -29,10 +24,8 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
29
24
|
"""Whether to always ask the question even if the slot is already filled."""
|
|
30
25
|
reset_after_flow_ends: bool = True
|
|
31
26
|
"""Whether to reset the slot value at the end of the flow."""
|
|
32
|
-
|
|
33
|
-
"""
|
|
34
|
-
block_digressions: List[str] = field(default_factory=list)
|
|
35
|
-
"""The flow id digressions that should be blocked during the flow step."""
|
|
27
|
+
force_slot_filling: bool = False
|
|
28
|
+
"""Whether to keep only the SetSlot command for the collected slot."""
|
|
36
29
|
|
|
37
30
|
@classmethod
|
|
38
31
|
def from_json(
|
|
@@ -60,10 +53,7 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
60
53
|
SlotRejection.from_dict(rejection)
|
|
61
54
|
for rejection in data.get("rejections", [])
|
|
62
55
|
],
|
|
63
|
-
|
|
64
|
-
KEY_ASK_CONFIRM_DIGRESSIONS, data
|
|
65
|
-
),
|
|
66
|
-
block_digressions=extract_digression_prop(KEY_BLOCK_DIGRESSIONS, data),
|
|
56
|
+
force_slot_filling=data.get("force_slot_filling", False),
|
|
67
57
|
**base.__dict__,
|
|
68
58
|
)
|
|
69
59
|
|
|
@@ -79,10 +69,7 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
79
69
|
data["ask_before_filling"] = self.ask_before_filling
|
|
80
70
|
data["reset_after_flow_ends"] = self.reset_after_flow_ends
|
|
81
71
|
data["rejections"] = [rejection.as_dict() for rejection in self.rejections]
|
|
82
|
-
data["
|
|
83
|
-
data["block_digressions"] = (
|
|
84
|
-
self.block_digressions if self.block_digressions else False
|
|
85
|
-
)
|
|
72
|
+
data["force_slot_filling"] = self.force_slot_filling
|
|
86
73
|
|
|
87
74
|
return data
|
|
88
75
|
|
rasa/shared/core/flows/utils.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import TYPE_CHECKING, Any, Dict,
|
|
1
|
+
from typing import TYPE_CHECKING, Any, Dict, Set, Text
|
|
2
2
|
|
|
3
3
|
from rasa.shared.utils.io import raise_deprecation_warning
|
|
4
4
|
|
|
@@ -8,7 +8,6 @@ if TYPE_CHECKING:
|
|
|
8
8
|
|
|
9
9
|
RESET_PROPERTY_NAME = "reset_after_flow_ends"
|
|
10
10
|
PERSIST_PROPERTY_NAME = "persisted_slots"
|
|
11
|
-
ALL_LABEL = "ALL"
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
def warn_deprecated_collect_step_config() -> None:
|
|
@@ -45,20 +44,6 @@ def get_invalid_slot_persistence_config_error_message(
|
|
|
45
44
|
)
|
|
46
45
|
|
|
47
46
|
|
|
48
|
-
def extract_digression_prop(prop: str, data: Dict[str, Any]) -> List[str]:
|
|
49
|
-
"""Extracts the digression property from the data.
|
|
50
|
-
|
|
51
|
-
There can be two types of properties: ask_confirm_digressions and
|
|
52
|
-
block_digressions.
|
|
53
|
-
"""
|
|
54
|
-
digression_property = data.get(prop, [])
|
|
55
|
-
|
|
56
|
-
if isinstance(digression_property, bool):
|
|
57
|
-
digression_property = [ALL_LABEL] if digression_property else []
|
|
58
|
-
|
|
59
|
-
return digression_property
|
|
60
|
-
|
|
61
|
-
|
|
62
47
|
def extract_translations(
|
|
63
48
|
translation_data: Dict[Text, Any],
|
|
64
49
|
) -> Dict[Text, "FlowLanguageTranslation"]:
|
|
@@ -648,12 +648,14 @@ class SlotFillingManager:
|
|
|
648
648
|
output_channel: "OutputChannel",
|
|
649
649
|
nlg: "NaturalLanguageGenerator",
|
|
650
650
|
recreate_tracker: bool = False,
|
|
651
|
+
slot_events: Optional[List[Event]] = None,
|
|
651
652
|
) -> List[Event]:
|
|
652
653
|
from rasa.core.actions.action import RemoteAction
|
|
653
654
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
654
655
|
from rasa.utils.endpoints import ClientResponseError
|
|
655
656
|
|
|
656
|
-
|
|
657
|
+
validated_slot_events: List[Event] = []
|
|
658
|
+
slot_events = slot_events if slot_events is not None else []
|
|
657
659
|
remote_action = RemoteAction(custom_action, self._action_endpoint)
|
|
658
660
|
disallowed_types = set()
|
|
659
661
|
|
|
@@ -673,9 +675,9 @@ class SlotFillingManager:
|
|
|
673
675
|
)
|
|
674
676
|
for event in custom_events:
|
|
675
677
|
if isinstance(event, SlotSet):
|
|
676
|
-
|
|
678
|
+
validated_slot_events.append(event)
|
|
677
679
|
elif isinstance(event, BotUttered):
|
|
678
|
-
|
|
680
|
+
validated_slot_events.append(event)
|
|
679
681
|
else:
|
|
680
682
|
disallowed_types.add(event.type_name)
|
|
681
683
|
except (RasaException, ClientResponseError) as e:
|
|
@@ -699,7 +701,7 @@ class SlotFillingManager:
|
|
|
699
701
|
f"updated with this event.",
|
|
700
702
|
)
|
|
701
703
|
|
|
702
|
-
return
|
|
704
|
+
return validated_slot_events
|
|
703
705
|
|
|
704
706
|
async def execute_validation_action(
|
|
705
707
|
self,
|
|
@@ -722,7 +724,11 @@ class SlotFillingManager:
|
|
|
722
724
|
return cast(List[Event], slot_events)
|
|
723
725
|
|
|
724
726
|
validate_events = await self._run_custom_action(
|
|
725
|
-
ACTION_VALIDATE_SLOT_MAPPINGS,
|
|
727
|
+
ACTION_VALIDATE_SLOT_MAPPINGS,
|
|
728
|
+
output_channel,
|
|
729
|
+
nlg,
|
|
730
|
+
recreate_tracker=True,
|
|
731
|
+
slot_events=cast(List[Event], slot_events),
|
|
726
732
|
)
|
|
727
733
|
validated_slot_names = [
|
|
728
734
|
event.key for event in validate_events if isinstance(event, SlotSet)
|
rasa/shared/nlu/constants.py
CHANGED
rasa/shared/utils/common.py
CHANGED
|
@@ -7,7 +7,17 @@ import os
|
|
|
7
7
|
import pkgutil
|
|
8
8
|
import sys
|
|
9
9
|
from types import ModuleType
|
|
10
|
-
from typing import
|
|
10
|
+
from typing import (
|
|
11
|
+
Any,
|
|
12
|
+
Callable,
|
|
13
|
+
Collection,
|
|
14
|
+
Dict,
|
|
15
|
+
List,
|
|
16
|
+
Optional,
|
|
17
|
+
Sequence,
|
|
18
|
+
Text,
|
|
19
|
+
Type,
|
|
20
|
+
)
|
|
11
21
|
|
|
12
22
|
import rasa.shared.utils.io
|
|
13
23
|
from rasa.exceptions import MissingDependencyException
|
rasa/shared/utils/constants.py
CHANGED
|
@@ -5,3 +5,6 @@ DEFAULT_READ_YAML_FILE_CACHE_MAXSIZE = 256
|
|
|
5
5
|
RASA_PRO_BETA_PREDICATES_IN_RESPONSE_CONDITIONS_ENV_VAR_NAME = (
|
|
6
6
|
"RASA_PRO_BETA_PREDICATES_IN_RESPONSE_CONDITIONS"
|
|
7
7
|
)
|
|
8
|
+
|
|
9
|
+
LOG_COMPONENT_SOURCE_METHOD_INIT = "init"
|
|
10
|
+
LOG_COMPONENT_SOURCE_METHOD_FINGERPRINT_ADDON = "fingerprint_addon"
|
rasa/shared/utils/llm.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import importlib.resources
|
|
2
2
|
import json
|
|
3
|
+
import logging
|
|
3
4
|
from copy import deepcopy
|
|
4
5
|
from functools import wraps
|
|
5
6
|
from typing import (
|
|
@@ -7,6 +8,7 @@ from typing import (
|
|
|
7
8
|
Any,
|
|
8
9
|
Callable,
|
|
9
10
|
Dict,
|
|
11
|
+
Literal,
|
|
10
12
|
Optional,
|
|
11
13
|
Text,
|
|
12
14
|
Type,
|
|
@@ -59,6 +61,7 @@ from rasa.shared.providers.mappings import (
|
|
|
59
61
|
get_embedding_client_from_provider,
|
|
60
62
|
get_llm_client_from_provider,
|
|
61
63
|
)
|
|
64
|
+
from rasa.shared.utils.constants import LOG_COMPONENT_SOURCE_METHOD_INIT
|
|
62
65
|
|
|
63
66
|
if TYPE_CHECKING:
|
|
64
67
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
@@ -654,35 +657,59 @@ def embedder_client_factory(
|
|
|
654
657
|
|
|
655
658
|
|
|
656
659
|
def get_prompt_template(
|
|
657
|
-
jinja_file_path: Optional[Text],
|
|
660
|
+
jinja_file_path: Optional[Text],
|
|
661
|
+
default_prompt_template: Text,
|
|
662
|
+
*,
|
|
663
|
+
log_source_component: Optional[Text] = None,
|
|
664
|
+
log_source_method: Optional[Literal["init", "fingerprint_addon"]] = None,
|
|
658
665
|
) -> Text:
|
|
659
666
|
"""Returns the jinja template.
|
|
660
667
|
|
|
661
668
|
Args:
|
|
662
|
-
jinja_file_path:
|
|
663
|
-
|
|
669
|
+
jinja_file_path: The path to the jinja template file. If not provided, the
|
|
670
|
+
default template will be used.
|
|
671
|
+
default_prompt_template: The fallback prompt template to use if no file is
|
|
672
|
+
found or specified.
|
|
673
|
+
log_source_component: The name of the component emitting the log, used to
|
|
674
|
+
identify the source in structured logging.
|
|
675
|
+
log_source_method: The name of the method or function emitting the log for
|
|
676
|
+
better traceability.
|
|
664
677
|
|
|
665
678
|
Returns:
|
|
666
679
|
The prompt template.
|
|
667
680
|
"""
|
|
681
|
+
|
|
668
682
|
try:
|
|
669
683
|
if jinja_file_path is not None:
|
|
670
684
|
prompt_template = rasa.shared.utils.io.read_file(jinja_file_path)
|
|
671
|
-
|
|
672
|
-
|
|
685
|
+
|
|
686
|
+
log_level = (
|
|
687
|
+
logging.INFO
|
|
688
|
+
if log_source_method == LOG_COMPONENT_SOURCE_METHOD_INIT
|
|
689
|
+
else logging.DEBUG
|
|
690
|
+
)
|
|
691
|
+
|
|
692
|
+
structlogger.log(
|
|
693
|
+
log_level,
|
|
694
|
+
"utils.llm.get_prompt_template"
|
|
695
|
+
".custom_prompt_template_read_successfully",
|
|
673
696
|
event_info=(
|
|
674
697
|
f"Custom prompt template read successfully from "
|
|
675
698
|
f"`{jinja_file_path}`."
|
|
676
699
|
),
|
|
677
700
|
prompt_file_path=jinja_file_path,
|
|
701
|
+
log_source_component=log_source_component,
|
|
702
|
+
log_source_method=log_source_method,
|
|
678
703
|
)
|
|
679
704
|
return prompt_template
|
|
680
705
|
except (FileIOException, FileNotFoundException):
|
|
681
706
|
structlogger.warning(
|
|
682
|
-
"utils.llm.get_prompt_template.failed_to_read_custom_prompt_template",
|
|
707
|
+
"utils.llm.get_prompt_template" ".failed_to_read_custom_prompt_template",
|
|
683
708
|
event_info=(
|
|
684
709
|
"Failed to read custom prompt template. Using default template instead."
|
|
685
710
|
),
|
|
711
|
+
log_source_component=log_source_component,
|
|
712
|
+
log_source_method=log_source_method,
|
|
686
713
|
)
|
|
687
714
|
return default_prompt_template
|
|
688
715
|
|
|
@@ -692,50 +719,66 @@ def get_default_prompt_template_based_on_model(
|
|
|
692
719
|
model_prompt_mapping: Dict[str, Any],
|
|
693
720
|
default_prompt_path: str,
|
|
694
721
|
fallback_prompt_path: str,
|
|
722
|
+
*,
|
|
723
|
+
log_source_component: Optional[Text] = None,
|
|
724
|
+
log_source_method: Optional[Literal["init", "fingerprint_addon"]] = None,
|
|
695
725
|
) -> Text:
|
|
696
726
|
"""Returns the default prompt template based on the model name.
|
|
697
727
|
|
|
698
728
|
Args:
|
|
699
729
|
llm_config: The model config.
|
|
700
|
-
model_prompt_mapping: The
|
|
701
|
-
default_prompt_path: The default prompt
|
|
702
|
-
fallback_prompt_path: The fallback prompt path for all other models
|
|
703
|
-
|
|
730
|
+
model_prompt_mapping: The model name -> prompt template mapping.
|
|
731
|
+
default_prompt_path: The path to the default prompt template for the component.
|
|
732
|
+
fallback_prompt_path: The fallback prompt path for all other models that do not
|
|
733
|
+
have a mapping in the model_prompt_mapping.
|
|
734
|
+
log_source_component: The name of the component emitting the log, used to
|
|
735
|
+
identify the source in structured logging.
|
|
736
|
+
log_source_method: The name of the method or function emitting the log for
|
|
737
|
+
better traceability.
|
|
704
738
|
|
|
705
739
|
Returns:
|
|
706
740
|
The default prompt template.
|
|
707
741
|
"""
|
|
742
|
+
# Extract the provider and model name information from the configuration
|
|
708
743
|
_llm_config = deepcopy(llm_config)
|
|
709
744
|
if MODELS_CONFIG_KEY in _llm_config:
|
|
710
745
|
_llm_config = _llm_config[MODELS_CONFIG_KEY][0]
|
|
711
746
|
provider = _llm_config.get(PROVIDER_CONFIG_KEY)
|
|
712
747
|
model = _llm_config.get(MODEL_CONFIG_KEY)
|
|
748
|
+
|
|
749
|
+
# If the model is not defined, we default to the default prompt template.
|
|
713
750
|
if not model:
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
"
|
|
751
|
+
structlogger.debug(
|
|
752
|
+
"utils.llm.get_default_prompt_template_based_on_model"
|
|
753
|
+
".using_default_prompt_template",
|
|
717
754
|
event_info=(
|
|
718
755
|
f"Model not defined in the config. Default prompt template read from"
|
|
719
756
|
f" - `{default_prompt_path}`."
|
|
720
757
|
),
|
|
721
758
|
default_prompt_path=default_prompt_path,
|
|
759
|
+
log_source_component=log_source_component,
|
|
760
|
+
log_source_method=log_source_method,
|
|
722
761
|
)
|
|
723
762
|
return importlib.resources.read_text(
|
|
724
763
|
DEFAULT_PROMPT_PACKAGE_NAME, default_prompt_path
|
|
725
764
|
)
|
|
726
765
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
766
|
+
full_model_name = model if provider and provider in model else f"{provider}/{model}"
|
|
767
|
+
|
|
768
|
+
# If the model is found in the mapping, we use the model-specific prompt
|
|
769
|
+
# template.
|
|
770
|
+
if prompt_file_path := model_prompt_mapping.get(full_model_name):
|
|
771
|
+
structlogger.debug(
|
|
772
|
+
"utils.llm.get_default_prompt_template_based_on_model"
|
|
773
|
+
".using_model_specific_prompt_template",
|
|
733
774
|
event_info=(
|
|
734
775
|
f"Using model-specific default prompt template. Default prompt "
|
|
735
776
|
f"template read from - `{prompt_file_path}`."
|
|
736
777
|
),
|
|
737
778
|
default_prompt_path=prompt_file_path,
|
|
738
|
-
model_name=
|
|
779
|
+
model_name=full_model_name,
|
|
780
|
+
log_source_component=log_source_component,
|
|
781
|
+
log_source_method=log_source_method,
|
|
739
782
|
)
|
|
740
783
|
return importlib.resources.read_text(
|
|
741
784
|
DEFAULT_PROMPT_PACKAGE_NAME, prompt_file_path
|
|
@@ -743,14 +786,17 @@ def get_default_prompt_template_based_on_model(
|
|
|
743
786
|
|
|
744
787
|
# If the model is not found in the mapping, we default to the fallback prompt
|
|
745
788
|
# template.
|
|
746
|
-
structlogger.
|
|
747
|
-
"utils.llm.get_default_prompt_template_based_on_model
|
|
789
|
+
structlogger.debug(
|
|
790
|
+
"utils.llm.get_default_prompt_template_based_on_model"
|
|
791
|
+
".using_fallback_prompt_template",
|
|
748
792
|
event_info=(
|
|
749
793
|
f"Model not found in the model prompt mapping. Fallback prompt template "
|
|
750
794
|
f"read from - `{fallback_prompt_path}`."
|
|
751
795
|
),
|
|
752
796
|
fallback_prompt_path=fallback_prompt_path,
|
|
753
|
-
model_name=
|
|
797
|
+
model_name=full_model_name,
|
|
798
|
+
log_source_component=log_source_component,
|
|
799
|
+
log_source_method=log_source_method,
|
|
754
800
|
)
|
|
755
801
|
return importlib.resources.read_text(
|
|
756
802
|
DEFAULT_PROMPT_PACKAGE_NAME, fallback_prompt_path
|
rasa/validator.py
CHANGED
|
@@ -48,7 +48,7 @@ from rasa.shared.core.domain import (
|
|
|
48
48
|
Domain,
|
|
49
49
|
)
|
|
50
50
|
from rasa.shared.core.events import ActionExecuted, ActiveLoop, UserUttered
|
|
51
|
-
from rasa.shared.core.flows import
|
|
51
|
+
from rasa.shared.core.flows import FlowsList
|
|
52
52
|
from rasa.shared.core.flows.constants import KEY_NAME, KEY_TRANSLATION
|
|
53
53
|
from rasa.shared.core.flows.flow_step_links import IfFlowStepLink
|
|
54
54
|
from rasa.shared.core.flows.steps.action import ActionFlowStep
|
|
@@ -56,7 +56,6 @@ from rasa.shared.core.flows.steps.collect import CollectInformationFlowStep
|
|
|
56
56
|
from rasa.shared.core.flows.steps.link import LinkFlowStep
|
|
57
57
|
from rasa.shared.core.flows.steps.set_slots import SetSlotsFlowStep
|
|
58
58
|
from rasa.shared.core.flows.utils import (
|
|
59
|
-
ALL_LABEL,
|
|
60
59
|
get_duplicate_slot_persistence_config_error_message,
|
|
61
60
|
get_invalid_slot_persistence_config_error_message,
|
|
62
61
|
warn_deprecated_collect_step_config,
|
|
@@ -1281,7 +1280,6 @@ class Validator:
|
|
|
1281
1280
|
self.verify_unique_flows(),
|
|
1282
1281
|
self.verify_predicates(),
|
|
1283
1282
|
self.verify_slot_persistence_configuration(),
|
|
1284
|
-
self.verify_digression_configuration(),
|
|
1285
1283
|
]
|
|
1286
1284
|
|
|
1287
1285
|
all_good = all(flow_validation_conditions)
|
|
@@ -1830,126 +1828,6 @@ class Validator:
|
|
|
1830
1828
|
|
|
1831
1829
|
return all_good
|
|
1832
1830
|
|
|
1833
|
-
def verify_digression_configuration(self) -> bool:
|
|
1834
|
-
"""Validates the digression configuration in flows."""
|
|
1835
|
-
all_good = True
|
|
1836
|
-
|
|
1837
|
-
for flow in self.flows.underlying_flows:
|
|
1838
|
-
all_good = self._validate_ask_confirm_digressions(flow, all_good)
|
|
1839
|
-
all_good = self._validate_block_digressions(flow, all_good)
|
|
1840
|
-
|
|
1841
|
-
return all_good
|
|
1842
|
-
|
|
1843
|
-
def _validate_ask_confirm_digressions(self, flow: Flow, all_good: bool) -> bool:
|
|
1844
|
-
"""Validates the ask_confirm_digressions configuration in a flow."""
|
|
1845
|
-
for flow_id in flow.ask_confirm_digressions:
|
|
1846
|
-
if flow_id == ALL_LABEL:
|
|
1847
|
-
continue
|
|
1848
|
-
if flow_id not in self.flows.flow_ids:
|
|
1849
|
-
structlogger.error(
|
|
1850
|
-
"validator.verify_digression_configuration.ask_confirm_digressions",
|
|
1851
|
-
flow=flow.id,
|
|
1852
|
-
event_info=(
|
|
1853
|
-
f"The flow '{flow_id}' is listed in the "
|
|
1854
|
-
f"`ask_confirm_digressions` configuration of flow "
|
|
1855
|
-
f"'{flow.id}', but it is not found in the "
|
|
1856
|
-
f"flows file. Please make sure that the flow id is correct."
|
|
1857
|
-
),
|
|
1858
|
-
)
|
|
1859
|
-
all_good = False
|
|
1860
|
-
|
|
1861
|
-
if flow_id in flow.block_digressions:
|
|
1862
|
-
structlogger.error(
|
|
1863
|
-
"validator.verify_digression_configuration.overlap_digressions",
|
|
1864
|
-
flow=flow.id,
|
|
1865
|
-
event_info=(
|
|
1866
|
-
f"The flow '{flow_id}' is listed in both the "
|
|
1867
|
-
f"`ask_confirm_digressions` and `block_digressions` "
|
|
1868
|
-
f"configuration of flow '{flow.id}'. "
|
|
1869
|
-
f"Please make sure that the flow id is not listed in both "
|
|
1870
|
-
f"configurations."
|
|
1871
|
-
),
|
|
1872
|
-
)
|
|
1873
|
-
all_good = False
|
|
1874
|
-
|
|
1875
|
-
for step in flow.get_collect_steps():
|
|
1876
|
-
for flow_id in step.ask_confirm_digressions:
|
|
1877
|
-
if flow_id == ALL_LABEL:
|
|
1878
|
-
continue
|
|
1879
|
-
|
|
1880
|
-
if flow_id not in self.flows.flow_ids:
|
|
1881
|
-
structlogger.error(
|
|
1882
|
-
"validator.verify_digression_configuration.ask_confirm_digressions",
|
|
1883
|
-
flow=flow.id,
|
|
1884
|
-
step_id=step.id,
|
|
1885
|
-
event_info=(
|
|
1886
|
-
f"The flow '{flow_id}' is listed in the "
|
|
1887
|
-
f"`ask_confirm_digressions` configuration of step "
|
|
1888
|
-
f"'{step.id}' in flow '{flow.id}', but it is "
|
|
1889
|
-
f"not found in the flows file. "
|
|
1890
|
-
f"Please make sure that the flow id is correct."
|
|
1891
|
-
),
|
|
1892
|
-
)
|
|
1893
|
-
all_good = False
|
|
1894
|
-
|
|
1895
|
-
if flow_id in step.block_digressions:
|
|
1896
|
-
structlogger.error(
|
|
1897
|
-
"validator.verify_digression_configuration.overlap_digressions",
|
|
1898
|
-
flow=flow.id,
|
|
1899
|
-
step_id=step.id,
|
|
1900
|
-
event_info=(
|
|
1901
|
-
f"The flow '{flow_id}' is listed in both the "
|
|
1902
|
-
f"`ask_confirm_digressions` and `block_digressions` "
|
|
1903
|
-
f"configuration of step '{step.id}' in flow '{flow.id}'. "
|
|
1904
|
-
f"Please make sure that the flow id is not listed in both "
|
|
1905
|
-
f"configurations."
|
|
1906
|
-
),
|
|
1907
|
-
)
|
|
1908
|
-
all_good = False
|
|
1909
|
-
|
|
1910
|
-
return all_good
|
|
1911
|
-
|
|
1912
|
-
def _validate_block_digressions(self, flow: Flow, all_good: bool) -> bool:
|
|
1913
|
-
"""Validates the block_digressions configuration in a flow."""
|
|
1914
|
-
for flow_id in flow.block_digressions:
|
|
1915
|
-
if flow_id == ALL_LABEL:
|
|
1916
|
-
continue
|
|
1917
|
-
|
|
1918
|
-
if flow_id not in self.flows.flow_ids:
|
|
1919
|
-
structlogger.error(
|
|
1920
|
-
"validator.verify_digression_configuration.block_digressions",
|
|
1921
|
-
flow=flow.id,
|
|
1922
|
-
event_info=(
|
|
1923
|
-
f"The flow '{flow_id}' is listed in the `block_digressions` "
|
|
1924
|
-
f"configuration of flow '{flow.id}', but it is not found "
|
|
1925
|
-
f"in the flows file. Please make sure that the flow id "
|
|
1926
|
-
f"is correct."
|
|
1927
|
-
),
|
|
1928
|
-
)
|
|
1929
|
-
all_good = False
|
|
1930
|
-
|
|
1931
|
-
for step in flow.get_collect_steps():
|
|
1932
|
-
for flow_id in step.block_digressions:
|
|
1933
|
-
if flow_id == ALL_LABEL:
|
|
1934
|
-
continue
|
|
1935
|
-
|
|
1936
|
-
if flow_id not in self.flows.flow_ids:
|
|
1937
|
-
structlogger.error(
|
|
1938
|
-
"validator.verify_digression_configuration.block_digressions",
|
|
1939
|
-
flow=flow.id,
|
|
1940
|
-
step_id=step.id,
|
|
1941
|
-
event_info=(
|
|
1942
|
-
f"The flow '{flow_id}' is listed in the "
|
|
1943
|
-
f"`block_digressions` configuration of step "
|
|
1944
|
-
f"'{step.id}' in flow '{flow.id}', but it is "
|
|
1945
|
-
f"not found in the flows file. "
|
|
1946
|
-
f"Please make sure that the flow id is correct."
|
|
1947
|
-
),
|
|
1948
|
-
)
|
|
1949
|
-
all_good = False
|
|
1950
|
-
|
|
1951
|
-
return all_good
|
|
1952
|
-
|
|
1953
1831
|
def verify_slot_validation(self) -> bool:
|
|
1954
1832
|
"""Validates the slot validation configuration in the domain file."""
|
|
1955
1833
|
all_good = True
|
rasa/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: rasa-pro
|
|
3
|
-
Version: 3.13.0.
|
|
3
|
+
Version: 3.13.0.dev3
|
|
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
|
|
@@ -100,7 +100,7 @@ Requires-Dist: pyyaml (>=6.0)
|
|
|
100
100
|
Requires-Dist: qdrant-client (>=1.9.1,<1.10.0)
|
|
101
101
|
Requires-Dist: questionary (>=1.10.0,<2.1.0)
|
|
102
102
|
Requires-Dist: randomname (>=0.2.1,<0.3.0)
|
|
103
|
-
Requires-Dist: rasa-sdk (==3.
|
|
103
|
+
Requires-Dist: rasa-sdk (==3.12.0)
|
|
104
104
|
Requires-Dist: redis (>=4.6.0,<6.0)
|
|
105
105
|
Requires-Dist: regex (>=2024.7.24,<2024.8.0)
|
|
106
106
|
Requires-Dist: requests (>=2.32.3,<2.33.0)
|