rasa-pro 3.13.0.dev20250612__py3-none-any.whl → 3.13.0.dev20250613__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/__main__.py +0 -3
- rasa/api.py +1 -1
- rasa/cli/dialogue_understanding_test.py +1 -1
- rasa/cli/e2e_test.py +1 -1
- rasa/cli/evaluate.py +1 -1
- rasa/cli/export.py +1 -1
- rasa/cli/llm_fine_tuning.py +12 -11
- rasa/cli/project_templates/defaults.py +133 -0
- rasa/cli/run.py +1 -1
- rasa/cli/studio/link.py +53 -0
- rasa/cli/studio/pull.py +78 -0
- rasa/cli/studio/push.py +78 -0
- rasa/cli/studio/studio.py +12 -0
- rasa/cli/studio/upload.py +8 -0
- rasa/cli/train.py +1 -1
- rasa/cli/utils.py +1 -1
- rasa/cli/x.py +1 -1
- rasa/constants.py +2 -0
- rasa/core/__init__.py +0 -16
- rasa/core/actions/action.py +5 -1
- rasa/core/actions/action_repeat_bot_messages.py +18 -22
- rasa/core/actions/action_run_slot_rejections.py +0 -1
- rasa/core/agent.py +16 -1
- rasa/core/available_endpoints.py +146 -0
- rasa/core/brokers/pika.py +1 -2
- rasa/core/channels/botframework.py +2 -2
- rasa/core/channels/channel.py +2 -2
- rasa/core/channels/hangouts.py +8 -5
- rasa/core/channels/mattermost.py +1 -1
- rasa/core/channels/rasa_chat.py +2 -4
- rasa/core/channels/rest.py +5 -4
- rasa/core/channels/studio_chat.py +3 -2
- rasa/core/channels/vier_cvg.py +1 -2
- rasa/core/channels/voice_ready/audiocodes.py +1 -8
- rasa/core/channels/voice_stream/audiocodes.py +7 -4
- rasa/core/channels/voice_stream/genesys.py +2 -2
- rasa/core/channels/voice_stream/twilio_media_streams.py +10 -5
- rasa/core/channels/voice_stream/voice_channel.py +33 -22
- rasa/core/http_interpreter.py +3 -7
- rasa/core/jobs.py +2 -1
- rasa/core/nlg/contextual_response_rephraser.py +38 -11
- rasa/core/nlg/generator.py +0 -1
- rasa/core/nlg/interpolator.py +2 -3
- rasa/core/nlg/summarize.py +39 -5
- rasa/core/policies/enterprise_search_policy.py +290 -66
- rasa/core/policies/enterprise_search_prompt_with_relevancy_check_and_citation_template.jinja2 +63 -0
- rasa/core/policies/flow_policy.py +1 -1
- rasa/core/policies/flows/flow_executor.py +96 -17
- rasa/core/policies/intentless_policy.py +24 -16
- rasa/core/processor.py +104 -51
- rasa/core/run.py +33 -11
- rasa/core/tracker_stores/tracker_store.py +1 -1
- rasa/core/training/interactive.py +1 -1
- rasa/core/utils.py +24 -97
- rasa/dialogue_understanding/coexistence/intent_based_router.py +2 -1
- rasa/dialogue_understanding/coexistence/llm_based_router.py +8 -3
- rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +2 -0
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/clarify_command.py +5 -1
- rasa/dialogue_understanding/commands/command_syntax_manager.py +1 -0
- rasa/dialogue_understanding/commands/human_handoff_command.py +2 -0
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +2 -0
- rasa/dialogue_understanding/commands/set_slot_command.py +11 -1
- rasa/dialogue_understanding/commands/skip_question_command.py +2 -0
- rasa/dialogue_understanding/commands/start_flow_command.py +4 -0
- rasa/dialogue_understanding/commands/utils.py +26 -2
- rasa/dialogue_understanding/generator/__init__.py +7 -1
- rasa/dialogue_understanding/generator/command_generator.py +4 -2
- rasa/dialogue_understanding/generator/command_parser.py +2 -2
- rasa/dialogue_understanding/generator/command_parser_validator.py +63 -0
- rasa/dialogue_understanding/generator/constants.py +2 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +78 -0
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +28 -463
- rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +147 -0
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +477 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +8 -58
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +37 -25
- rasa/dialogue_understanding/patterns/domain_for_patterns.py +190 -0
- rasa/dialogue_understanding/processor/command_processor.py +3 -3
- rasa/dialogue_understanding/processor/command_processor_component.py +3 -3
- rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +17 -4
- rasa/dialogue_understanding/utils.py +68 -12
- rasa/dialogue_understanding_test/du_test_case.py +1 -1
- rasa/dialogue_understanding_test/du_test_runner.py +4 -22
- rasa/dialogue_understanding_test/test_case_simulation/test_case_tracker_simulator.py +2 -6
- rasa/e2e_test/e2e_test_runner.py +1 -1
- rasa/engine/constants.py +1 -1
- rasa/engine/recipes/default_recipe.py +26 -2
- rasa/engine/validation.py +3 -2
- rasa/hooks.py +0 -28
- rasa/llm_fine_tuning/annotation_module.py +39 -9
- rasa/llm_fine_tuning/conversations.py +3 -0
- rasa/llm_fine_tuning/llm_data_preparation_module.py +66 -49
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +4 -2
- rasa/llm_fine_tuning/paraphrasing/rephrase_validator.py +52 -44
- rasa/llm_fine_tuning/paraphrasing_module.py +10 -12
- rasa/llm_fine_tuning/storage.py +4 -4
- rasa/llm_fine_tuning/utils.py +63 -1
- rasa/model_manager/model_api.py +88 -0
- rasa/model_manager/trainer_service.py +4 -4
- rasa/plugin.py +1 -11
- rasa/privacy/__init__.py +0 -0
- rasa/privacy/constants.py +83 -0
- rasa/privacy/event_broker_utils.py +77 -0
- rasa/privacy/privacy_config.py +281 -0
- rasa/privacy/privacy_config_schema.json +86 -0
- rasa/privacy/privacy_filter.py +340 -0
- rasa/privacy/privacy_manager.py +576 -0
- rasa/server.py +23 -2
- rasa/shared/constants.py +6 -0
- rasa/shared/core/constants.py +4 -3
- rasa/shared/core/domain.py +7 -0
- rasa/shared/core/events.py +37 -7
- rasa/shared/core/flows/flow.py +1 -2
- rasa/shared/core/flows/flows_yaml_schema.json +3 -0
- rasa/shared/core/flows/steps/collect.py +46 -2
- rasa/shared/core/slots.py +28 -0
- rasa/shared/exceptions.py +4 -0
- rasa/shared/providers/_configs/azure_openai_client_config.py +4 -0
- rasa/shared/providers/_configs/openai_client_config.py +4 -0
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +3 -0
- rasa/shared/providers/llm/_base_litellm_client.py +5 -2
- rasa/shared/utils/llm.py +161 -6
- rasa/shared/utils/yaml.py +32 -0
- rasa/studio/data_handler.py +3 -3
- rasa/studio/download/download.py +37 -60
- rasa/studio/download/flows.py +23 -31
- rasa/studio/link.py +200 -0
- rasa/studio/pull.py +94 -0
- rasa/studio/push.py +131 -0
- rasa/studio/upload.py +117 -67
- rasa/telemetry.py +82 -25
- rasa/tracing/config.py +3 -4
- rasa/tracing/constants.py +19 -1
- rasa/tracing/instrumentation/attribute_extractors.py +10 -2
- rasa/tracing/instrumentation/instrumentation.py +53 -2
- rasa/tracing/instrumentation/metrics.py +98 -15
- rasa/tracing/metric_instrument_provider.py +75 -3
- rasa/utils/common.py +1 -27
- rasa/utils/log_utils.py +1 -45
- rasa/validator.py +2 -8
- rasa/version.py +1 -1
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0.dev20250613.dist-info}/METADATA +5 -6
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0.dev20250613.dist-info}/RECORD +149 -135
- rasa/anonymization/__init__.py +0 -2
- rasa/anonymization/anonymisation_rule_yaml_reader.py +0 -91
- rasa/anonymization/anonymization_pipeline.py +0 -286
- rasa/anonymization/anonymization_rule_executor.py +0 -266
- rasa/anonymization/anonymization_rule_orchestrator.py +0 -119
- rasa/anonymization/schemas/config.yml +0 -47
- rasa/anonymization/utils.py +0 -118
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0.dev20250613.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0.dev20250613.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0.dev20250613.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
import structlog
|
|
4
|
+
|
|
5
|
+
from rasa.dialogue_understanding.commands import (
|
|
6
|
+
Command,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
structlogger = structlog.get_logger()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CommandParserValidatorSingleton:
|
|
13
|
+
"""Singleton class to validate the command parser.
|
|
14
|
+
|
|
15
|
+
This class is used to validate the command parser. It keeps track of the number of
|
|
16
|
+
consecutive turns where no commands are parsed by the command parser. If the
|
|
17
|
+
number of consecutive turns exceeds a certain threshold, a warning is logged.
|
|
18
|
+
The prompt can use a DSL syntax that can be incompatible with the command syntax
|
|
19
|
+
used by the command parser. This class helps to detect such incompatibilities.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
MAX_CONSECUTIVE_TURNS_NO_COMMAND_PREDICTED = 5
|
|
23
|
+
_NO_COMMAND_PREDICTED_TURN_COUNTER = 0
|
|
24
|
+
_command_parser_validated = False
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def get_no_command_predicted_turn_counter(cls) -> int:
|
|
28
|
+
return cls._NO_COMMAND_PREDICTED_TURN_COUNTER
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
def should_validate_command_parser(cls) -> bool:
|
|
32
|
+
return not cls._command_parser_validated
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def reset_command_parser_validation(cls) -> None:
|
|
36
|
+
cls._NO_COMMAND_PREDICTED_TURN_COUNTER = 0
|
|
37
|
+
cls._command_parser_validated = False
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def validate_if_commands_are_parsed_from_llm_response(
|
|
41
|
+
cls, commands: List[Command], llm_response: str
|
|
42
|
+
) -> None:
|
|
43
|
+
if llm_response and not commands:
|
|
44
|
+
cls._NO_COMMAND_PREDICTED_TURN_COUNTER += 1
|
|
45
|
+
else:
|
|
46
|
+
# Reset the counter if commands are generated, and mark
|
|
47
|
+
# the command parser as validated.
|
|
48
|
+
cls._NO_COMMAND_PREDICTED_TURN_COUNTER = 0
|
|
49
|
+
cls._command_parser_validated = True
|
|
50
|
+
return
|
|
51
|
+
|
|
52
|
+
if (
|
|
53
|
+
cls._NO_COMMAND_PREDICTED_TURN_COUNTER
|
|
54
|
+
>= cls.MAX_CONSECUTIVE_TURNS_NO_COMMAND_PREDICTED
|
|
55
|
+
):
|
|
56
|
+
structlogger.warning(
|
|
57
|
+
"llm_command_generator.predict_commands.command_parser_not_working",
|
|
58
|
+
event_info=(
|
|
59
|
+
f"No commands were generated by the command parser for the last "
|
|
60
|
+
f"{cls._NO_COMMAND_PREDICTED_TURN_COUNTER} times. Check if you "
|
|
61
|
+
"are running incompatible prompt and LLM command generator."
|
|
62
|
+
),
|
|
63
|
+
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from rasa.shared.constants import (
|
|
2
|
-
|
|
2
|
+
MAX_COMPLETION_TOKENS_CONFIG_KEY,
|
|
3
3
|
MODEL_CONFIG_KEY,
|
|
4
4
|
OPENAI_PROVIDER,
|
|
5
5
|
PROVIDER_CONFIG_KEY,
|
|
@@ -15,7 +15,7 @@ DEFAULT_LLM_CONFIG = {
|
|
|
15
15
|
PROVIDER_CONFIG_KEY: OPENAI_PROVIDER,
|
|
16
16
|
MODEL_CONFIG_KEY: DEFAULT_OPENAI_CHAT_MODEL_NAME_ADVANCED,
|
|
17
17
|
TEMPERATURE_CONFIG_KEY: 0.0,
|
|
18
|
-
|
|
18
|
+
MAX_COMPLETION_TOKENS_CONFIG_KEY: DEFAULT_OPENAI_MAX_GENERATED_TOKENS,
|
|
19
19
|
TIMEOUT_CONFIG_KEY: 7,
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
## Task Description
|
|
2
|
+
Your task is to analyze the current conversation context and generate a list of actions to start new business processes that we call flows, to extract slots, or respond to off-topic and knowledge requests.
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Available Flows and Slots
|
|
7
|
+
Use the following structured data:
|
|
8
|
+
```json
|
|
9
|
+
{"flows":[{% for flow in available_flows %}{"name":"{{ flow.name }}","description":{{ flow.description | to_json_escaped_string }}{% if flow.slots %},"slots":[{% for slot in flow.slots %}{"name":"{{ slot.name }}"{% if slot.description %},"description":{{ slot.description | to_json_escaped_string }}{% endif %}{% if slot.allowed_values %},"allowed_values":{{ slot.allowed_values }}{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]}
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Available Actions:
|
|
15
|
+
* `start flow flow_name`: Start a flow. For example, `start flow transfer_money` or `start flow list_contacts`.
|
|
16
|
+
* `set slot slot_name slot_value`: Set a slot for the active flow. For example, `set slot transfer_money_recipient Freddy`. Can be used to correct and change previously set values.
|
|
17
|
+
* `disambiguate flows flow_name1 flow_name2 ... flow_name_n`: When a message could refer to multiple flows, list the possible flows as options to clarify. Example: `disambiguate flows list_contacts add_contact remove_contact`.
|
|
18
|
+
* `search and reply`: Provide a response from the knowledge base to address the user’s inquiry when no flows fit, including domain knowledge, FAQs, and all off-topic or social messages.
|
|
19
|
+
* `cancel flow`: Cancel the current flow if the user requests it.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## General Instructions
|
|
24
|
+
### Start Flow
|
|
25
|
+
* Only start a flow if the user's message is clear and fully addressed by that flow's description and purpose.
|
|
26
|
+
* Pay close attention to exact wording and scope in the flow description — do not assume or “stretch” the intended use of a flow.
|
|
27
|
+
### Set Slot
|
|
28
|
+
* Do not fill slots with abstract values or placeholders.
|
|
29
|
+
* For categorical slots try to match the user message with allowed slot values. Use "other" if you cannot match it.
|
|
30
|
+
* Set the boolean slots based on the user response. Map positive responses to `True`, and negative to `False`.
|
|
31
|
+
* Extract text slot values exactly as provided by the user. Avoid assumptions, format changes, or partial extractions.
|
|
32
|
+
### Disambiguate Flows
|
|
33
|
+
* Use `disambiguate flows` when the user's message matches multiple flows and you cannot decide which flow is most appropriate.
|
|
34
|
+
* If the user message is short and not precise enough to start a flow or `search and reply`, disambiguate.
|
|
35
|
+
* If a single flow is a strong/plausible fit, prefer starting that flow directly.
|
|
36
|
+
* If a user's message unambiguously and distinctly matches multiple flows, start all relevant flows at once (rather than disambiguating).
|
|
37
|
+
### Search and Reply
|
|
38
|
+
* Only start `search and reply` if the user intent is clear.
|
|
39
|
+
* Flow Priority: If you are unsure between starting a flow or `search and reply`, always prioritize starting a flow.
|
|
40
|
+
### Cancel Flow
|
|
41
|
+
* Do not cancel any flow unless the user explicitly requests it.
|
|
42
|
+
* Multiple flows can be started without cancelling the previous, if the user wants to pursue multiple processes.
|
|
43
|
+
### General Tips
|
|
44
|
+
* Only use information provided by the user.
|
|
45
|
+
* Strictly adhere to the provided action format.
|
|
46
|
+
* Focus on the last message and take it one step at a time.
|
|
47
|
+
* Use the previous conversation steps only to aid understanding.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Decision Rule Table
|
|
52
|
+
| Condition | Action |
|
|
53
|
+
|-------------------------------------------------------|--------------------|
|
|
54
|
+
| Flow perfectly matches user's message | start flow |
|
|
55
|
+
| Multiple flows are equally strong, relevant matches | disambiguate flows |
|
|
56
|
+
| User's message is unclear or imprecise | disambiguate flows |
|
|
57
|
+
| No flow fits at all, but knowledge base may help | search and reply |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Current State
|
|
62
|
+
{% if current_flow != None %}Use the following structured data:
|
|
63
|
+
```json
|
|
64
|
+
{"active_flow":"{{ current_flow }}","current_step":{"requested_slot":"{{ current_slot }}","requested_slot_description":{{ current_slot_description | to_json_escaped_string }}},"slots":[{% for slot in flow_slots %}{"name":"{{ slot.name }}","value":"{{ slot.value }}","type":"{{ slot.type }}"{% if slot.description %},"description":{{ slot.description | to_json_escaped_string }}{% endif %}{% if slot.allowed_values %},"allowed_values":"{{ slot.allowed_values }}"{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]}
|
|
65
|
+
```{% else %}
|
|
66
|
+
You are currently not inside any flow.{% endif %}
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Conversation History
|
|
71
|
+
{{ current_conversation }}
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Task
|
|
76
|
+
Create an action list with one action per line in response to the user's last message: """{{ user_message }}""".
|
|
77
|
+
|
|
78
|
+
Your action list:
|