rasa-pro 3.12.0.dev13__py3-none-any.whl → 3.12.0rc1__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/anonymization/anonymization_rule_executor.py +16 -10
- rasa/cli/data.py +16 -0
- rasa/cli/project_templates/calm/config.yml +2 -2
- rasa/cli/project_templates/calm/endpoints.yml +2 -2
- rasa/cli/utils.py +12 -0
- rasa/core/actions/action.py +84 -191
- rasa/core/actions/action_run_slot_rejections.py +16 -4
- rasa/core/channels/__init__.py +2 -0
- rasa/core/channels/studio_chat.py +19 -0
- rasa/core/channels/telegram.py +42 -24
- rasa/core/channels/voice_ready/utils.py +1 -1
- rasa/core/channels/voice_stream/asr/asr_engine.py +10 -4
- rasa/core/channels/voice_stream/asr/azure.py +14 -1
- rasa/core/channels/voice_stream/asr/deepgram.py +20 -4
- rasa/core/channels/voice_stream/audiocodes.py +264 -0
- rasa/core/channels/voice_stream/browser_audio.py +4 -1
- rasa/core/channels/voice_stream/call_state.py +3 -0
- rasa/core/channels/voice_stream/genesys.py +6 -2
- rasa/core/channels/voice_stream/tts/azure.py +9 -1
- rasa/core/channels/voice_stream/tts/cartesia.py +14 -8
- rasa/core/channels/voice_stream/voice_channel.py +23 -2
- rasa/core/constants.py +2 -0
- rasa/core/nlg/contextual_response_rephraser.py +18 -1
- rasa/core/nlg/generator.py +83 -15
- rasa/core/nlg/response.py +6 -3
- rasa/core/nlg/translate.py +55 -0
- rasa/core/policies/enterprise_search_prompt_with_citation_template.jinja2 +1 -1
- rasa/core/policies/flows/flow_executor.py +12 -5
- rasa/core/processor.py +72 -9
- rasa/dialogue_understanding/commands/can_not_handle_command.py +20 -2
- rasa/dialogue_understanding/commands/cancel_flow_command.py +24 -6
- rasa/dialogue_understanding/commands/change_flow_command.py +20 -2
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +20 -2
- rasa/dialogue_understanding/commands/clarify_command.py +29 -3
- rasa/dialogue_understanding/commands/command.py +1 -16
- rasa/dialogue_understanding/commands/command_syntax_manager.py +55 -0
- rasa/dialogue_understanding/commands/human_handoff_command.py +20 -2
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +20 -2
- rasa/dialogue_understanding/commands/prompt_command.py +94 -0
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +20 -2
- rasa/dialogue_understanding/commands/set_slot_command.py +24 -2
- rasa/dialogue_understanding/commands/skip_question_command.py +20 -2
- rasa/dialogue_understanding/commands/start_flow_command.py +20 -2
- rasa/dialogue_understanding/commands/utils.py +98 -4
- rasa/dialogue_understanding/generator/__init__.py +2 -0
- rasa/dialogue_understanding/generator/command_parser.py +15 -12
- rasa/dialogue_understanding/generator/constants.py +3 -0
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +12 -5
- rasa/dialogue_understanding/generator/llm_command_generator.py +5 -3
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +16 -2
- rasa/dialogue_understanding/generator/prompt_templates/__init__.py +0 -0
- rasa/dialogue_understanding/generator/{single_step → prompt_templates}/command_prompt_template.jinja2 +2 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +77 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_default.jinja2 +68 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +84 -0
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +460 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +12 -310
- rasa/dialogue_understanding/patterns/collect_information.py +1 -1
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +16 -0
- rasa/dialogue_understanding/patterns/validate_slot.py +65 -0
- rasa/dialogue_understanding/processor/command_processor.py +39 -0
- rasa/dialogue_understanding_test/du_test_case.py +28 -8
- rasa/dialogue_understanding_test/du_test_result.py +13 -9
- rasa/dialogue_understanding_test/io.py +14 -0
- rasa/e2e_test/utils/io.py +0 -37
- rasa/engine/graph.py +1 -0
- rasa/engine/language.py +140 -0
- rasa/engine/recipes/config_files/default_config.yml +4 -0
- rasa/engine/recipes/default_recipe.py +2 -0
- rasa/engine/recipes/graph_recipe.py +2 -0
- rasa/engine/storage/local_model_storage.py +1 -0
- rasa/engine/storage/storage.py +4 -1
- rasa/model_manager/runner_service.py +7 -4
- rasa/model_manager/socket_bridge.py +7 -6
- rasa/shared/constants.py +15 -13
- rasa/shared/core/constants.py +2 -0
- rasa/shared/core/flows/constants.py +11 -0
- rasa/shared/core/flows/flow.py +83 -19
- rasa/shared/core/flows/flows_yaml_schema.json +31 -3
- rasa/shared/core/flows/steps/collect.py +1 -36
- rasa/shared/core/flows/utils.py +28 -4
- rasa/shared/core/flows/validation.py +1 -1
- rasa/shared/core/slot_mappings.py +208 -5
- rasa/shared/core/slots.py +131 -1
- rasa/shared/core/trackers.py +74 -1
- rasa/shared/importers/importer.py +50 -2
- rasa/shared/nlu/training_data/schemas/responses.yml +19 -12
- rasa/shared/providers/_configs/azure_entra_id_config.py +541 -0
- rasa/shared/providers/_configs/azure_openai_client_config.py +138 -3
- rasa/shared/providers/_configs/client_config.py +3 -1
- rasa/shared/providers/_configs/default_litellm_client_config.py +3 -1
- rasa/shared/providers/_configs/huggingface_local_embedding_client_config.py +3 -1
- rasa/shared/providers/_configs/litellm_router_client_config.py +3 -1
- rasa/shared/providers/_configs/model_group_config.py +4 -2
- rasa/shared/providers/_configs/oauth_config.py +33 -0
- rasa/shared/providers/_configs/openai_client_config.py +3 -1
- rasa/shared/providers/_configs/rasa_llm_client_config.py +3 -1
- rasa/shared/providers/_configs/self_hosted_llm_client_config.py +3 -1
- rasa/shared/providers/constants.py +6 -0
- rasa/shared/providers/embedding/azure_openai_embedding_client.py +28 -3
- rasa/shared/providers/embedding/litellm_router_embedding_client.py +3 -1
- rasa/shared/providers/llm/_base_litellm_client.py +42 -17
- rasa/shared/providers/llm/azure_openai_llm_client.py +81 -25
- rasa/shared/providers/llm/default_litellm_llm_client.py +3 -1
- rasa/shared/providers/llm/litellm_router_llm_client.py +29 -8
- rasa/shared/providers/llm/llm_client.py +23 -7
- rasa/shared/providers/llm/openai_llm_client.py +9 -3
- rasa/shared/providers/llm/rasa_llm_client.py +11 -2
- rasa/shared/providers/llm/self_hosted_llm_client.py +30 -11
- rasa/shared/providers/router/_base_litellm_router_client.py +3 -1
- rasa/shared/providers/router/router_client.py +3 -1
- rasa/shared/utils/constants.py +3 -0
- rasa/shared/utils/llm.py +30 -7
- rasa/shared/utils/pykwalify_extensions.py +24 -0
- rasa/shared/utils/schemas/domain.yml +26 -0
- rasa/telemetry.py +2 -1
- rasa/tracing/config.py +2 -0
- rasa/tracing/constants.py +12 -0
- rasa/tracing/instrumentation/instrumentation.py +36 -0
- rasa/tracing/instrumentation/metrics.py +41 -0
- rasa/tracing/metric_instrument_provider.py +40 -0
- rasa/validator.py +372 -7
- rasa/version.py +1 -1
- {rasa_pro-3.12.0.dev13.dist-info → rasa_pro-3.12.0rc1.dist-info}/METADATA +2 -1
- {rasa_pro-3.12.0.dev13.dist-info → rasa_pro-3.12.0rc1.dist-info}/RECORD +128 -113
- {rasa_pro-3.12.0.dev13.dist-info → rasa_pro-3.12.0rc1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.12.0.dev13.dist-info → rasa_pro-3.12.0rc1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.12.0.dev13.dist-info → rasa_pro-3.12.0rc1.dist-info}/entry_points.txt +0 -0
|
@@ -9,6 +9,7 @@ from rasa.dialogue_understanding.generator.multi_step.multi_step_llm_command_gen
|
|
|
9
9
|
MultiStepLLMCommandGenerator,
|
|
10
10
|
)
|
|
11
11
|
from rasa.dialogue_understanding.generator.single_step.single_step_llm_command_generator import ( # noqa: E501
|
|
12
|
+
CompactLLMCommandGenerator,
|
|
12
13
|
SingleStepLLMCommandGenerator,
|
|
13
14
|
)
|
|
14
15
|
|
|
@@ -18,4 +19,5 @@ __all__ = [
|
|
|
18
19
|
"LLMCommandGenerator",
|
|
19
20
|
"MultiStepLLMCommandGenerator",
|
|
20
21
|
"SingleStepLLMCommandGenerator",
|
|
22
|
+
"CompactLLMCommandGenerator",
|
|
21
23
|
]
|
|
@@ -16,6 +16,7 @@ from rasa.dialogue_understanding.commands import (
|
|
|
16
16
|
SkipQuestionCommand,
|
|
17
17
|
StartFlowCommand,
|
|
18
18
|
)
|
|
19
|
+
from rasa.dialogue_understanding.commands.prompt_command import PromptCommand
|
|
19
20
|
from rasa.dialogue_understanding.commands.utils import start_flow_by_name
|
|
20
21
|
from rasa.shared.core.flows import FlowsList
|
|
21
22
|
|
|
@@ -41,8 +42,8 @@ def _get_compiled_pattern(pattern_str: str) -> re.Pattern:
|
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
def _create_default_commands(
|
|
44
|
-
default_commands_to_remove: Union[List[Type[
|
|
45
|
-
) -> List[Type[
|
|
45
|
+
default_commands_to_remove: Union[List[Type[PromptCommand]], List[str]],
|
|
46
|
+
) -> List[Type[PromptCommand]]:
|
|
46
47
|
"""Return an updated list of default commands after removing the provided commands.
|
|
47
48
|
|
|
48
49
|
Args:
|
|
@@ -64,11 +65,11 @@ def _create_default_commands(
|
|
|
64
65
|
|
|
65
66
|
|
|
66
67
|
def _get_additional_parsing_logic(
|
|
67
|
-
command_clz: Type[
|
|
68
|
-
) -> Optional[Callable[[
|
|
68
|
+
command_clz: Type[PromptCommand],
|
|
69
|
+
) -> Optional[Callable[[PromptCommand, FlowsList], Optional[PromptCommand]]]:
|
|
69
70
|
"""Get additional parsing logic for a command."""
|
|
70
71
|
command_to_parsing_fn_mapper: Dict[
|
|
71
|
-
Type[
|
|
72
|
+
Type[PromptCommand], Callable[..., Optional[PromptCommand]]
|
|
72
73
|
] = {
|
|
73
74
|
ClarifyCommand: _parse_clarify_command,
|
|
74
75
|
SetSlotCommand: _parse_set_slot_command,
|
|
@@ -81,8 +82,10 @@ def parse_commands(
|
|
|
81
82
|
actions: Optional[str],
|
|
82
83
|
flows: FlowsList,
|
|
83
84
|
is_handle_flows_prompt: bool = False,
|
|
84
|
-
additional_commands: Optional[List[Type[
|
|
85
|
-
default_commands_to_remove: Optional[
|
|
85
|
+
additional_commands: Optional[List[Type[PromptCommand]]] = None,
|
|
86
|
+
default_commands_to_remove: Optional[
|
|
87
|
+
Union[List[Type[PromptCommand]], List[str]]
|
|
88
|
+
] = None,
|
|
86
89
|
**kwargs: Any,
|
|
87
90
|
) -> List[Command]:
|
|
88
91
|
"""Parse a list of action commands."""
|
|
@@ -116,7 +119,7 @@ def parse_commands(
|
|
|
116
119
|
|
|
117
120
|
|
|
118
121
|
def _parse_standard_commands(
|
|
119
|
-
standard_commands: List[Type[
|
|
122
|
+
standard_commands: List[Type[PromptCommand]],
|
|
120
123
|
action: str,
|
|
121
124
|
flows: FlowsList,
|
|
122
125
|
**kwargs: Any,
|
|
@@ -135,7 +138,7 @@ def _parse_standard_commands(
|
|
|
135
138
|
|
|
136
139
|
|
|
137
140
|
def _parse_custom_commands(
|
|
138
|
-
custom_commands: List[Type[
|
|
141
|
+
custom_commands: List[Type[PromptCommand]],
|
|
139
142
|
action: str,
|
|
140
143
|
flows: FlowsList,
|
|
141
144
|
**kwargs: Any,
|
|
@@ -152,7 +155,7 @@ def _parse_custom_commands(
|
|
|
152
155
|
|
|
153
156
|
def _parse_set_slot_command(
|
|
154
157
|
parsed_command: Optional[SetSlotCommand], flows: FlowsList, **kwargs: Any
|
|
155
|
-
) -> Optional[
|
|
158
|
+
) -> Optional[PromptCommand]:
|
|
156
159
|
"""Additional parsing logic for the SetSlotCommand."""
|
|
157
160
|
if not parsed_command:
|
|
158
161
|
return None
|
|
@@ -164,7 +167,7 @@ def _parse_set_slot_command(
|
|
|
164
167
|
|
|
165
168
|
def _parse_clarify_command(
|
|
166
169
|
parsed_command: Optional[ClarifyCommand], flows: FlowsList, **kwargs: Any
|
|
167
|
-
) -> Optional[
|
|
170
|
+
) -> Optional[PromptCommand]:
|
|
168
171
|
"""Additional parsing logic for the ClarifyCommand."""
|
|
169
172
|
if not parsed_command:
|
|
170
173
|
return None
|
|
@@ -194,7 +197,7 @@ def _parse_clarify_command(
|
|
|
194
197
|
|
|
195
198
|
def _parse_start_flow_command(
|
|
196
199
|
parsed_command: Optional[StartFlowCommand], flows: FlowsList, **kwargs: Any
|
|
197
|
-
) -> Optional[
|
|
200
|
+
) -> Optional[PromptCommand]:
|
|
198
201
|
"""Additional parsing logic for the StartFlowCommand."""
|
|
199
202
|
if not parsed_command:
|
|
200
203
|
return None
|
|
@@ -27,9 +27,7 @@ from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
|
27
27
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
28
28
|
from rasa.engine.storage.resource import Resource
|
|
29
29
|
from rasa.engine.storage.storage import ModelStorage
|
|
30
|
-
from rasa.shared.core.constants import
|
|
31
|
-
SetSlotExtractor,
|
|
32
|
-
)
|
|
30
|
+
from rasa.shared.core.constants import SetSlotExtractor
|
|
33
31
|
from rasa.shared.core.domain import Domain
|
|
34
32
|
from rasa.shared.core.flows import Flow, FlowsList, FlowStep
|
|
35
33
|
from rasa.shared.core.flows.steps.collect import CollectInformationFlowStep
|
|
@@ -313,11 +311,20 @@ class LLMBasedCommandGenerator(
|
|
|
313
311
|
return filtered_flows
|
|
314
312
|
|
|
315
313
|
@measure_llm_latency
|
|
316
|
-
async def invoke_llm(
|
|
314
|
+
async def invoke_llm(
|
|
315
|
+
self, prompt: Union[List[dict], List[str], str]
|
|
316
|
+
) -> Optional[LLMResponse]:
|
|
317
317
|
"""Use LLM to generate a response.
|
|
318
318
|
|
|
319
319
|
Args:
|
|
320
|
-
prompt: The prompt
|
|
320
|
+
prompt: The prompt can be,
|
|
321
|
+
- a list of preformatted messages. Each message should be a dictionary
|
|
322
|
+
with the following keys:
|
|
323
|
+
- content: The message content.
|
|
324
|
+
- role: The role of the message (e.g. user or system).
|
|
325
|
+
- a list of messages. Each message is a string and will be formatted
|
|
326
|
+
as a user message.
|
|
327
|
+
- a single message as a string which will be formatted as user message.
|
|
321
328
|
|
|
322
329
|
Returns:
|
|
323
330
|
An LLMResponse object.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any, Dict, Optional, Text
|
|
1
|
+
from typing import Any, Dict, List, Optional, Text, Union
|
|
2
2
|
|
|
3
3
|
import structlog
|
|
4
4
|
from deprecated import deprecated # type: ignore[import]
|
|
@@ -25,7 +25,7 @@ structlogger = structlog.get_logger()
|
|
|
25
25
|
@deprecated(
|
|
26
26
|
reason=(
|
|
27
27
|
"The LLMCommandGenerator is deprecated and will be removed in Rasa 4.0.0. "
|
|
28
|
-
"Please use
|
|
28
|
+
"Please use SingleStepLLMCommandGenerator instead."
|
|
29
29
|
)
|
|
30
30
|
)
|
|
31
31
|
class LLMCommandGenerator(SingleStepLLMCommandGenerator):
|
|
@@ -54,7 +54,9 @@ class LLMCommandGenerator(SingleStepLLMCommandGenerator):
|
|
|
54
54
|
**kwargs,
|
|
55
55
|
)
|
|
56
56
|
|
|
57
|
-
async def invoke_llm(
|
|
57
|
+
async def invoke_llm(
|
|
58
|
+
self, prompt: Union[List[dict], List[str], str]
|
|
59
|
+
) -> Optional[LLMResponse]:
|
|
58
60
|
try:
|
|
59
61
|
return await super().invoke_llm(prompt)
|
|
60
62
|
except ProviderClientAPIException:
|
|
@@ -2,6 +2,7 @@ import importlib.resources
|
|
|
2
2
|
from typing import Any, Dict, List, Optional, Text, Tuple, Union
|
|
3
3
|
|
|
4
4
|
import structlog
|
|
5
|
+
from deprecated import deprecated # type: ignore[import]
|
|
5
6
|
from jinja2 import Template
|
|
6
7
|
|
|
7
8
|
import rasa.shared.utils.io
|
|
@@ -51,7 +52,7 @@ from rasa.shared.exceptions import ProviderClientAPIException
|
|
|
51
52
|
from rasa.shared.nlu.constants import TEXT
|
|
52
53
|
from rasa.shared.nlu.training_data.message import Message
|
|
53
54
|
from rasa.shared.providers.llm.llm_response import LLMResponse
|
|
54
|
-
from rasa.shared.utils.io import deep_container_fingerprint
|
|
55
|
+
from rasa.shared.utils.io import deep_container_fingerprint, raise_deprecation_warning
|
|
55
56
|
from rasa.shared.utils.llm import (
|
|
56
57
|
allowed_values_for_slot,
|
|
57
58
|
get_prompt_template,
|
|
@@ -100,6 +101,12 @@ structlogger = structlog.get_logger()
|
|
|
100
101
|
],
|
|
101
102
|
is_trainable=True,
|
|
102
103
|
)
|
|
104
|
+
@deprecated(
|
|
105
|
+
reason=(
|
|
106
|
+
"The MultiStepLLMCommandGenerator is deprecated and will be removed in "
|
|
107
|
+
"Rasa `4.0.0`."
|
|
108
|
+
)
|
|
109
|
+
)
|
|
103
110
|
class MultiStepLLMCommandGenerator(LLMBasedCommandGenerator):
|
|
104
111
|
"""An multi step command generator using LLM."""
|
|
105
112
|
|
|
@@ -111,6 +118,14 @@ class MultiStepLLMCommandGenerator(LLMBasedCommandGenerator):
|
|
|
111
118
|
prompt_templates: Optional[Dict[Text, Optional[Text]]] = None,
|
|
112
119
|
**kwargs: Any,
|
|
113
120
|
) -> None:
|
|
121
|
+
raise_deprecation_warning(
|
|
122
|
+
message=(
|
|
123
|
+
"Support for `MultiStepLLMCommandGenerator` will be removed in Rasa "
|
|
124
|
+
"`4.0.0`. Please modify your assistant's configuration to use other "
|
|
125
|
+
"LLM command generators like the `SingleStepLLMCommandGenerator`."
|
|
126
|
+
)
|
|
127
|
+
)
|
|
128
|
+
|
|
114
129
|
super().__init__(
|
|
115
130
|
config, model_storage, resource, prompt_templates=prompt_templates, **kwargs
|
|
116
131
|
)
|
|
@@ -120,7 +135,6 @@ class MultiStepLLMCommandGenerator(LLMBasedCommandGenerator):
|
|
|
120
135
|
FILL_SLOTS_KEY: None,
|
|
121
136
|
}
|
|
122
137
|
self._init_prompt_templates(prompt_templates)
|
|
123
|
-
|
|
124
138
|
self.trace_prompt_tokens = self.config.get("trace_prompt_tokens", False)
|
|
125
139
|
|
|
126
140
|
### Implementations of LLMBasedCommandGenerator parent
|
|
File without changes
|
|
@@ -41,7 +41,9 @@ Based on this information generate a list of actions you want to take. Your job
|
|
|
41
41
|
* Responding to knowledge-oriented user messages, described by "SearchAndReply()"
|
|
42
42
|
* Responding to a casual, non-task-oriented user message, described by "ChitChat()".
|
|
43
43
|
* Handing off to a human, in case the user seems frustrated or explicitly asks to speak to one, described by "HumanHandoff()".
|
|
44
|
+
{% if is_repeat_command_enabled %}
|
|
44
45
|
* Repeat the last bot messages, described by "RepeatLastBotMessages()". This is useful when the user asks to repeat the last bot messages.
|
|
46
|
+
{% endif %}
|
|
45
47
|
|
|
46
48
|
===
|
|
47
49
|
Write out the actions you want to take, one per line, in the order they should take place.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
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 small talk and knowledge requests.
|
|
2
|
+
|
|
3
|
+
## Available Actions:
|
|
4
|
+
* `start flow flow_name`: Starting a flow. For example, `start flow transfer_money` or `start flow list_contacts`
|
|
5
|
+
* `set slot slot_name slot_value`: Slot setting. For example, `set slot transfer_money_recipient Freddy`. Can be used to correct and change previously set values
|
|
6
|
+
* `cancel flow`: Cancelling the current flow
|
|
7
|
+
* `disambiguate flows flow_name1 flow_name2 ... flow_name_n`: Disambiguate which flow should be started when user input is ambiguous by listing the potential flows as options. For example, `disambiguate flows list_contacts add_contact remove_contact ...` if the user just wrote "contacts".
|
|
8
|
+
* `provide info`: Responding to the user's questions by supplying relevant information, such as answering FAQs or explaining services
|
|
9
|
+
* `offtopic reply`: Responding to casual or social user messages that are unrelated to any flows, engaging in friendly conversation and addressing off-topic remarks.
|
|
10
|
+
* `hand over`: Handing over to a human, in case the user seems frustrated or explicitly asks to speak to one
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## General Tips
|
|
14
|
+
* Do not fill slots with abstract values or placeholders.
|
|
15
|
+
* Only use information provided by the user.
|
|
16
|
+
* Use clarification in ambiguous cases.
|
|
17
|
+
* Multiple flows can be started. If a user wants to digress into a second flow, you do not need to cancel the current flow.
|
|
18
|
+
* Strictly adhere to the provided action format.
|
|
19
|
+
* For categorical slots try to match the user message with potential slot values. Use "other" if you cannot match it
|
|
20
|
+
* Focus on the last message and take it one step at a time.
|
|
21
|
+
* Use the previous conversation steps only to aid understanding.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Available Flows:
|
|
25
|
+
Use the following structured date:
|
|
26
|
+
```xml
|
|
27
|
+
<flows>
|
|
28
|
+
{% for flow in available_flows %}<flow>
|
|
29
|
+
<name>{{ flow.name }}</name>
|
|
30
|
+
<description>{{ flow.description }}</description>
|
|
31
|
+
<slots>{% for slot in flow.slots %}
|
|
32
|
+
<slot>
|
|
33
|
+
<name>{{ slot.name }}</name>
|
|
34
|
+
<description>{{ slot.description }}</description>
|
|
35
|
+
<allowed_values>{{ slot.allowed_values }}</allowed_values>
|
|
36
|
+
</slot>{% endfor %}
|
|
37
|
+
</slots>
|
|
38
|
+
</flow>
|
|
39
|
+
{% endfor %}
|
|
40
|
+
</flows>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Current State
|
|
44
|
+
{% if current_flow != None %}
|
|
45
|
+
Use the following structured date:
|
|
46
|
+
```xml
|
|
47
|
+
<current_state>
|
|
48
|
+
<active_flow>{{ current_flow }}</active_flow>
|
|
49
|
+
<current_step>
|
|
50
|
+
<requested_slot>{{ current_slot }}</requested_slot>
|
|
51
|
+
<requested_slot_description>{{ current_slot_description }}</requested_slot_description>
|
|
52
|
+
</current_step>
|
|
53
|
+
<slots>
|
|
54
|
+
{% for slot in flow_slots %}<slot>
|
|
55
|
+
<name>{{ slot.name }}</name>
|
|
56
|
+
<value>{{ slot.value }}</value>
|
|
57
|
+
<type>{{ slot.type }}</type>
|
|
58
|
+
<description>{{ slot.description }}</description>{% if slot.allowed_values %}
|
|
59
|
+
<allowed_values>{{ slot.allowed_values }}</allowed_values>{% endif %}
|
|
60
|
+
</slot>
|
|
61
|
+
{% endfor %}
|
|
62
|
+
</slots>
|
|
63
|
+
</current_state>
|
|
64
|
+
```
|
|
65
|
+
{% else %}
|
|
66
|
+
You are currently not inside any flow.
|
|
67
|
+
{% endif %}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Conversation History
|
|
71
|
+
{{ current_conversation }}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Task
|
|
75
|
+
Create an action list with one action per line in response to the users last message: """{{ user_message }}""".
|
|
76
|
+
|
|
77
|
+
Your action list:
|
|
@@ -0,0 +1,68 @@
|
|
|
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 small talk and knowledge requests.
|
|
3
|
+
|
|
4
|
+
--
|
|
5
|
+
|
|
6
|
+
## Available Actions:
|
|
7
|
+
* `start flow flow_name`: Starting a flow. For example, `start flow transfer_money` or `start flow list_contacts`
|
|
8
|
+
* `set slot slot_name slot_value`: Slot setting. For example, `set slot transfer_money_recipient Freddy`. Can be used to correct and change previously set values
|
|
9
|
+
* `cancel flow`: Cancelling the current flow
|
|
10
|
+
* `disambiguate flows flow_name1 flow_name2 ... flow_name_n`: Disambiguate which flow should be started when user input is ambiguous by listing the potential flows as options. For example, `disambiguate flows list_contacts add_contact remove_contact ...` if the user just wrote "contacts".
|
|
11
|
+
* `provide info`: Responding to the user's questions by supplying relevant information, such as answering FAQs or explaining services
|
|
12
|
+
* `offtopic reply`: Responding to casual or social user messages that are unrelated to any flows, engaging in friendly conversation and addressing off-topic remarks.
|
|
13
|
+
* `hand over`: Handing over to a human, in case the user seems frustrated or explicitly asks to speak to one
|
|
14
|
+
|
|
15
|
+
--
|
|
16
|
+
|
|
17
|
+
## General Tips
|
|
18
|
+
* Do not fill slots with abstract values or placeholders.
|
|
19
|
+
* Only use information provided by the user.
|
|
20
|
+
* Use clarification in ambiguous cases.
|
|
21
|
+
* Multiple flows can be started. If a user wants to digress into a second flow, you do not need to cancel the current flow.
|
|
22
|
+
* Strictly adhere to the provided action format.
|
|
23
|
+
* For categorical slots try to match the user message with potential slot values. Use "other" if you cannot match it
|
|
24
|
+
* Focus on the last message and take it one step at a time.
|
|
25
|
+
* Use the previous conversation steps only to aid understanding.
|
|
26
|
+
|
|
27
|
+
--
|
|
28
|
+
|
|
29
|
+
## Available Flows and Slots
|
|
30
|
+
{% for flow in available_flows %}
|
|
31
|
+
* `{{ flow.name }}`: {{ flow.description }}
|
|
32
|
+
{% for slot in flow.slots -%}
|
|
33
|
+
* `{{ slot.name }}`{% if slot.description %} ({{ slot.description }}){% endif %}{% if slot.allowed_values %}, allowed values: `{{ slot.allowed_values }}`{% endif %}
|
|
34
|
+
{% endfor %}
|
|
35
|
+
{%- endfor %}
|
|
36
|
+
|
|
37
|
+
--
|
|
38
|
+
|
|
39
|
+
## Current State
|
|
40
|
+
{% if current_flow != None %}
|
|
41
|
+
You are currently in the flow `{{ current_flow }}`.
|
|
42
|
+
You have just asked the user for the slot `{{ current_slot }}`{% if current_slot_description %} ({{ current_slot_description }}){% endif %}.
|
|
43
|
+
|
|
44
|
+
{% if flow_slots|length > 0 %}
|
|
45
|
+
Here are the slots of the flow `{{ current_flow }}`:
|
|
46
|
+
{% for slot in flow_slots -%}
|
|
47
|
+
* `{{ slot.name }}`
|
|
48
|
+
- value: "{{ slot.value }}"
|
|
49
|
+
- type: {{ slot.type }}
|
|
50
|
+
- description: {{ slot.description}}
|
|
51
|
+
{% if slot.allowed_values %} - allowed values: {{ slot.allowed_values }}{% endif %}
|
|
52
|
+
{% endfor %}
|
|
53
|
+
{% endif %}
|
|
54
|
+
{% else %}
|
|
55
|
+
You are currently not inside any flow.
|
|
56
|
+
{% endif %}
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Conversation History
|
|
61
|
+
{{ current_conversation }}
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Task
|
|
66
|
+
Create an action list with one action per line in response to the users last message: """{{ user_message }}""".
|
|
67
|
+
|
|
68
|
+
Your action list:
|
|
@@ -0,0 +1,84 @@
|
|
|
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 small talk and knowledge requests.
|
|
3
|
+
|
|
4
|
+
--
|
|
5
|
+
|
|
6
|
+
## Available Actions:
|
|
7
|
+
* `start flow flow_name`: Starting a flow. For example, `start flow transfer_money` or `start flow list_contacts`
|
|
8
|
+
* `set slot slot_name slot_value`: Slot setting. For example, `set slot transfer_money_recipient Freddy`. Can be used to correct and change previously set values
|
|
9
|
+
* `cancel flow`: Cancelling the current flow
|
|
10
|
+
* `disambiguate flows flow_name1 flow_name2 ... flow_name_n`: Disambiguate which flow should be started when user input is ambiguous by listing the potential flows as options. For example, `disambiguate flows list_contacts add_contact remove_contact ...` if the user just wrote "contacts".
|
|
11
|
+
* `provide info`: Responding to the user's questions by supplying relevant information, such as answering FAQs or explaining services
|
|
12
|
+
* `offtopic reply`: Responding to casual or social user messages that are unrelated to any flows, engaging in friendly conversation and addressing off-topic remarks.
|
|
13
|
+
* `hand over`: Handing over to a human, in case the user seems frustrated or explicitly asks to speak to one
|
|
14
|
+
|
|
15
|
+
--
|
|
16
|
+
|
|
17
|
+
## General Tips
|
|
18
|
+
* Do not fill slots with abstract values or placeholders.
|
|
19
|
+
* Only use information provided by the user.
|
|
20
|
+
* Use clarification in ambiguous cases.
|
|
21
|
+
* Multiple flows can be started. If a user wants to digress into a second flow, you do not need to cancel the current flow.
|
|
22
|
+
* Strictly adhere to the provided action format.
|
|
23
|
+
* For categorical slots try to match the user message with potential slot values. Use "other" if you cannot match it
|
|
24
|
+
* Focus on the last message and take it one step at a time.
|
|
25
|
+
* Use the previous conversation steps only to aid understanding.
|
|
26
|
+
|
|
27
|
+
--
|
|
28
|
+
|
|
29
|
+
## Available Flows and Slots
|
|
30
|
+
Use the following structured date:
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"flows": [
|
|
34
|
+
{% for flow in available_flows %}{
|
|
35
|
+
"name": "{{ flow.name }}",
|
|
36
|
+
"description": "{{ flow.description }}"{% if flow.slots %},
|
|
37
|
+
"slots": [{% for slot in flow.slots %}
|
|
38
|
+
{
|
|
39
|
+
"name": "{{ slot.name }}"{% if slot.description %},
|
|
40
|
+
"description": "{{ slot.description }}"{% endif %}{% if slot.allowed_values %},
|
|
41
|
+
"allowed_values": {{ slot.allowed_values }}{% endif %}
|
|
42
|
+
}{% if not loop.last %},{% endif %}{% endfor %}
|
|
43
|
+
]{% endif %}
|
|
44
|
+
}{% if not loop.last %},
|
|
45
|
+
{% endif %}{% endfor %}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
--
|
|
51
|
+
|
|
52
|
+
## Current State
|
|
53
|
+
{% if current_flow != None %}Use the following structured date:
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"active_flow": "{{ current_flow }}",
|
|
57
|
+
"current_step": {
|
|
58
|
+
"requested_slot": "{{ current_slot }}",
|
|
59
|
+
"requested_slot_description": "{{ current_slot_description }}"
|
|
60
|
+
},
|
|
61
|
+
"slots": [{% for slot in flow_slots %}
|
|
62
|
+
{
|
|
63
|
+
"name": "{{ slot.name }}",
|
|
64
|
+
"value": "{{ slot.value }}",
|
|
65
|
+
"type": "{{ slot.type }}"{% if slot.description %},
|
|
66
|
+
"description": "{{ slot.description }}"{% endif %}{% if slot.allowed_values %},
|
|
67
|
+
"allowed_values": "{{ slot.allowed_values }}"{% endif %}
|
|
68
|
+
}{% if not loop.last %},{% endif %}{% endfor %}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
```{% else %}
|
|
72
|
+
You are currently not inside any flow.{% endif %}
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Conversation History
|
|
77
|
+
{{ current_conversation }}
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Task
|
|
82
|
+
Create an action list with one action per line in response to the users last message: """{{ user_message }}""".
|
|
83
|
+
|
|
84
|
+
Your action list:
|