rasa-pro 3.12.0.dev5__py3-none-any.whl → 3.12.0.dev7__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/dialogue_understanding_test.py +40 -5
- rasa/constants.py +0 -1
- rasa/core/actions/action.py +4 -2
- rasa/core/actions/custom_action_executor.py +1 -1
- rasa/core/channels/inspector/dist/assets/Tableau10-1b767f5e.js +1 -0
- rasa/core/channels/inspector/dist/assets/arc-f0f8bd46.js +1 -0
- rasa/core/channels/inspector/dist/assets/blockDiagram-38ab4fdb-7162c77d.js +118 -0
- rasa/core/channels/inspector/dist/assets/c4Diagram-3d4e48cf-b1d0d098.js +10 -0
- rasa/core/channels/inspector/dist/assets/channel-e265ea59.js +1 -0
- rasa/core/channels/inspector/dist/assets/classDiagram-70f12bd4-807a1b27.js +2 -0
- rasa/core/channels/inspector/dist/assets/classDiagram-v2-f2320105-5238dcdb.js +2 -0
- rasa/core/channels/inspector/dist/assets/clone-21f8a43d.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-62fc7601-89c73b31.js → createText-2e5e7dd3-75dfaa67.js} +1 -1
- rasa/core/channels/inspector/dist/assets/edges-e0da2a9e-df20501d.js +4 -0
- rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-907e0440.js → erDiagram-9861fffd-13cf4797.js} +4 -4
- rasa/core/channels/inspector/dist/assets/flowDb-956e92f1-a4991264.js +10 -0
- rasa/core/channels/inspector/dist/assets/flowDiagram-66a62f08-ccecf773.js +4 -0
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-5c8ce12d.js +1 -0
- rasa/core/channels/inspector/dist/assets/flowchart-elk-definition-4a651766-b5801783.js +139 -0
- rasa/core/channels/inspector/dist/assets/ganttDiagram-c361ad54-161e079a.js +257 -0
- rasa/core/channels/inspector/dist/assets/gitGraphDiagram-72cf32ee-f38e86a4.js +70 -0
- rasa/core/channels/inspector/dist/assets/graph-be6ef5d8.js +1 -0
- rasa/core/channels/inspector/dist/assets/index-3862675e-d9ce8994.js +1 -0
- rasa/core/channels/inspector/dist/assets/{index-e793d777.js → index-7794b245.js} +200 -195
- rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-8ceba4db.js → infoDiagram-f8f76790-5000a3dc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-960d3809.js → journeyDiagram-49397b02-8ef0a17a.js} +4 -4
- rasa/core/channels/inspector/dist/assets/katex-498eb57e.js +261 -0
- rasa/core/channels/inspector/dist/assets/layout-d649bc98.js +1 -0
- rasa/core/channels/inspector/dist/assets/{line-eeccc4e2.js → line-95add810.js} +1 -1
- rasa/core/channels/inspector/dist/assets/linear-f6025094.js +1 -0
- rasa/core/channels/inspector/dist/assets/mindmap-definition-fc14e90a-2e8531c4.js +312 -0
- rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-dc9b5e1b.js → pieDiagram-8a3498a8-918adfdb.js} +7 -7
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-a08cba6d.js → quadrantDiagram-120e2f19-cbd01797.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-87242b9e.js → requirementDiagram-deff3bca-6a8b877b.js} +2 -2
- rasa/core/channels/inspector/dist/assets/sankeyDiagram-04a897e0-c377c3fe.js +8 -0
- rasa/core/channels/inspector/dist/assets/sequenceDiagram-704730f1-ab9e9b7f.js +122 -0
- rasa/core/channels/inspector/dist/assets/stateDiagram-587899a1-5e6ae67d.js +1 -0
- rasa/core/channels/inspector/dist/assets/stateDiagram-v2-d93cdb3a-40643476.js +1 -0
- rasa/core/channels/inspector/dist/assets/{styles-9c745c82-cef936a6.js → styles-6aaf32cf-afb8d108.js} +1 -1
- rasa/core/channels/inspector/dist/assets/styles-9a916d00-7edc9423.js +160 -0
- rasa/core/channels/inspector/dist/assets/styles-c10674c1-c1d8f7e9.js +116 -0
- rasa/core/channels/inspector/dist/assets/svgDrawCommon-08f97a94-f494b2ef.js +1 -0
- rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-0d39bdb2.js → timeline-definition-85554ec2-11c7cdd0.js} +3 -3
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-a03fa445.js → xychartDiagram-e933f94c-3f191ec1.js} +3 -3
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/package.json +10 -3
- rasa/core/channels/inspector/yarn.lock +89 -99
- rasa/core/channels/voice_stream/asr/azure.py +1 -1
- rasa/core/channels/voice_stream/tts/azure.py +1 -1
- rasa/core/nlg/contextual_response_rephraser.py +2 -1
- rasa/core/policies/enterprise_search_policy.py +2 -1
- rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -2
- rasa/dialogue_understanding/commands/cancel_flow_command.py +2 -2
- rasa/dialogue_understanding/commands/change_flow_command.py +2 -2
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -2
- rasa/dialogue_understanding/commands/clarify_command.py +2 -2
- rasa/dialogue_understanding/commands/human_handoff_command.py +2 -2
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -2
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +2 -2
- rasa/dialogue_understanding/commands/set_slot_command.py +2 -2
- rasa/dialogue_understanding/commands/skip_question_command.py +2 -2
- rasa/dialogue_understanding/commands/start_flow_command.py +2 -2
- rasa/dialogue_understanding/commands/utils.py +1 -1
- rasa/dialogue_understanding/generator/command_parser.py +1 -1
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +3 -3
- rasa/dialogue_understanding/generator/single_step/command_prompt_template.jinja2 +41 -39
- rasa/dialogue_understanding_test/command_metric_calculation.py +8 -4
- rasa/dialogue_understanding_test/du_test_result.py +9 -0
- rasa/e2e_test/assertions.py +203 -174
- rasa/e2e_test/assertions_schema.yml +6 -0
- rasa/e2e_test/constants.py +16 -1
- rasa/e2e_test/e2e_config.py +102 -41
- rasa/e2e_test/e2e_config_schema.yml +28 -10
- rasa/e2e_test/llm_judge_prompts/answer_relevance_prompt_template.jinja2 +89 -0
- rasa/e2e_test/llm_judge_prompts/groundedness_prompt_template.jinja2 +165 -0
- rasa/e2e_test/utils/generative_assertions.py +243 -0
- rasa/server.py +3 -1
- rasa/shared/nlu/constants.py +1 -0
- rasa/shared/providers/llm/llm_response.py +21 -1
- rasa/shared/utils/llm.py +1 -1
- rasa/tracing/instrumentation/attribute_extractors.py +23 -7
- rasa/utils/common.py +0 -14
- rasa/version.py +1 -1
- {rasa_pro-3.12.0.dev5.dist-info → rasa_pro-3.12.0.dev7.dist-info}/METADATA +2 -4
- {rasa_pro-3.12.0.dev5.dist-info → rasa_pro-3.12.0.dev7.dist-info}/RECORD +88 -79
- rasa/core/channels/inspector/dist/assets/arc-632a63ec.js +0 -1
- rasa/core/channels/inspector/dist/assets/c4Diagram-d0fbc5ce-081e0df4.js +0 -10
- rasa/core/channels/inspector/dist/assets/classDiagram-936ed81e-3df0afc2.js +0 -2
- rasa/core/channels/inspector/dist/assets/classDiagram-v2-c3cb15f1-8c5ed31e.js +0 -2
- rasa/core/channels/inspector/dist/assets/edges-f2ad444c-4fc48c3e.js +0 -4
- rasa/core/channels/inspector/dist/assets/flowDb-1972c806-9ec53a3c.js +0 -6
- rasa/core/channels/inspector/dist/assets/flowDiagram-7ea5b25a-41da787a.js +0 -4
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-8bea338b.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowchart-elk-definition-abe16c3d-ce370633.js +0 -139
- rasa/core/channels/inspector/dist/assets/ganttDiagram-9b5ea136-90a36523.js +0 -266
- rasa/core/channels/inspector/dist/assets/gitGraphDiagram-99d0ae7c-41e1aa3f.js +0 -70
- rasa/core/channels/inspector/dist/assets/index-2c4b9a3b-e6f2af62.js +0 -1
- rasa/core/channels/inspector/dist/assets/layout-498807d8.js +0 -1
- rasa/core/channels/inspector/dist/assets/linear-8a078617.js +0 -1
- rasa/core/channels/inspector/dist/assets/mindmap-definition-beec6740-396d17dd.js +0 -109
- rasa/core/channels/inspector/dist/assets/sankeyDiagram-8f13d901-53f6f391.js +0 -8
- rasa/core/channels/inspector/dist/assets/sequenceDiagram-b655622a-715c9c20.js +0 -122
- rasa/core/channels/inspector/dist/assets/stateDiagram-59f0c015-2e8fb31f.js +0 -1
- rasa/core/channels/inspector/dist/assets/stateDiagram-v2-2b26beab-7e2d2aa0.js +0 -1
- rasa/core/channels/inspector/dist/assets/styles-080da4f6-4420cea6.js +0 -110
- rasa/core/channels/inspector/dist/assets/styles-3dcbcfbf-28676cf4.js +0 -159
- rasa/core/channels/inspector/dist/assets/svgDrawCommon-4835440b-151251e9.js +0 -1
- {rasa_pro-3.12.0.dev5.dist-info → rasa_pro-3.12.0.dev7.dist-info}/NOTICE +0 -0
- {rasa_pro-3.12.0.dev5.dist-info → rasa_pro-3.12.0.dev7.dist-info}/WHEEL +0 -0
- {rasa_pro-3.12.0.dev5.dist-info → rasa_pro-3.12.0.dev7.dist-info}/entry_points.txt +0 -0
|
@@ -76,7 +76,7 @@ from rasa.shared.providers.embedding._langchain_embedding_client_adapter import
|
|
|
76
76
|
_LangchainEmbeddingClientAdapter,
|
|
77
77
|
)
|
|
78
78
|
from rasa.shared.providers.llm.llm_client import LLMClient
|
|
79
|
-
from rasa.shared.providers.llm.llm_response import LLMResponse
|
|
79
|
+
from rasa.shared.providers.llm.llm_response import LLMResponse, measure_llm_latency
|
|
80
80
|
from rasa.shared.utils.cli import print_error_and_exit
|
|
81
81
|
from rasa.shared.utils.health_check.embeddings_health_check_mixin import (
|
|
82
82
|
EmbeddingsHealthCheckMixin,
|
|
@@ -639,6 +639,7 @@ class EnterpriseSearchPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Po
|
|
|
639
639
|
)
|
|
640
640
|
return prompt
|
|
641
641
|
|
|
642
|
+
@measure_llm_latency
|
|
642
643
|
async def _generate_llm_answer(
|
|
643
644
|
self, llm: LLMClient, prompt: Text
|
|
644
645
|
) -> Optional[LLMResponse]:
|
|
@@ -74,7 +74,7 @@ class CannotHandleCommand(Command):
|
|
|
74
74
|
|
|
75
75
|
def to_dsl(self) -> str:
|
|
76
76
|
"""Converts the command to a DSL string."""
|
|
77
|
-
return "
|
|
77
|
+
return "CannotHandle()"
|
|
78
78
|
|
|
79
79
|
@classmethod
|
|
80
80
|
def from_dsl(cls, match: re.Match, **kwargs: Any) -> CannotHandleCommand:
|
|
@@ -86,4 +86,4 @@ class CannotHandleCommand(Command):
|
|
|
86
86
|
|
|
87
87
|
@staticmethod
|
|
88
88
|
def regex_pattern() -> str:
|
|
89
|
-
return r"
|
|
89
|
+
return r"CannotHandle\(\)"
|
|
@@ -124,7 +124,7 @@ class CancelFlowCommand(Command):
|
|
|
124
124
|
|
|
125
125
|
def to_dsl(self) -> str:
|
|
126
126
|
"""Converts the command to a DSL string."""
|
|
127
|
-
return "
|
|
127
|
+
return "CancelFlow()"
|
|
128
128
|
|
|
129
129
|
@classmethod
|
|
130
130
|
def from_dsl(cls, match: re.Match, **kwargs: Any) -> CancelFlowCommand:
|
|
@@ -133,4 +133,4 @@ class CancelFlowCommand(Command):
|
|
|
133
133
|
|
|
134
134
|
@staticmethod
|
|
135
135
|
def regex_pattern() -> str:
|
|
136
|
-
return r"
|
|
136
|
+
return r"CancelFlow\(\)"
|
|
@@ -48,7 +48,7 @@ class ChangeFlowCommand(Command):
|
|
|
48
48
|
|
|
49
49
|
def to_dsl(self) -> str:
|
|
50
50
|
"""Converts the command to a DSL string."""
|
|
51
|
-
return "
|
|
51
|
+
return "ChangeFlow()"
|
|
52
52
|
|
|
53
53
|
@staticmethod
|
|
54
54
|
def from_dsl(match: re.Match, **kwargs: Any) -> ChangeFlowCommand:
|
|
@@ -57,4 +57,4 @@ class ChangeFlowCommand(Command):
|
|
|
57
57
|
|
|
58
58
|
@staticmethod
|
|
59
59
|
def regex_pattern() -> str:
|
|
60
|
-
return r"
|
|
60
|
+
return r"ChangeFlow\(\)"
|
|
@@ -59,7 +59,7 @@ class ChitChatAnswerCommand(FreeFormAnswerCommand):
|
|
|
59
59
|
|
|
60
60
|
def to_dsl(self) -> str:
|
|
61
61
|
"""Converts the command to a DSL string."""
|
|
62
|
-
return "
|
|
62
|
+
return "ChitChat()"
|
|
63
63
|
|
|
64
64
|
@classmethod
|
|
65
65
|
def from_dsl(cls, match: re.Match, **kwargs: Any) -> ChitChatAnswerCommand:
|
|
@@ -68,4 +68,4 @@ class ChitChatAnswerCommand(FreeFormAnswerCommand):
|
|
|
68
68
|
|
|
69
69
|
@staticmethod
|
|
70
70
|
def regex_pattern() -> str:
|
|
71
|
-
return r"
|
|
71
|
+
return r"ChitChat\(\)"
|
|
@@ -89,7 +89,7 @@ class ClarifyCommand(Command):
|
|
|
89
89
|
|
|
90
90
|
def to_dsl(self) -> str:
|
|
91
91
|
"""Converts the command to a DSL string."""
|
|
92
|
-
return f"
|
|
92
|
+
return f"Clarify({', '.join(self.options)})"
|
|
93
93
|
|
|
94
94
|
@classmethod
|
|
95
95
|
def from_dsl(cls, match: re.Match, **kwargs: Any) -> Optional[ClarifyCommand]:
|
|
@@ -99,4 +99,4 @@ class ClarifyCommand(Command):
|
|
|
99
99
|
|
|
100
100
|
@staticmethod
|
|
101
101
|
def regex_pattern() -> str:
|
|
102
|
-
return r"
|
|
102
|
+
return r"Clarify\(([\"\'a-zA-Z0-9_, ]*)\)"
|
|
@@ -66,7 +66,7 @@ class HumanHandoffCommand(Command):
|
|
|
66
66
|
|
|
67
67
|
def to_dsl(self) -> str:
|
|
68
68
|
"""Converts the command to a DSL string."""
|
|
69
|
-
return "
|
|
69
|
+
return "HumanHandoff()"
|
|
70
70
|
|
|
71
71
|
@classmethod
|
|
72
72
|
def from_dsl(cls, match: re.Match, **kwargs: Any) -> HumanHandoffCommand:
|
|
@@ -75,4 +75,4 @@ class HumanHandoffCommand(Command):
|
|
|
75
75
|
|
|
76
76
|
@staticmethod
|
|
77
77
|
def regex_pattern() -> str:
|
|
78
|
-
return r"
|
|
78
|
+
return r"HumanHandoff\(\)"
|
|
@@ -59,7 +59,7 @@ class KnowledgeAnswerCommand(FreeFormAnswerCommand):
|
|
|
59
59
|
|
|
60
60
|
def to_dsl(self) -> str:
|
|
61
61
|
"""Converts the command to a DSL string."""
|
|
62
|
-
return "
|
|
62
|
+
return "SearchAndReply()"
|
|
63
63
|
|
|
64
64
|
@classmethod
|
|
65
65
|
def from_dsl(cls, match: re.Match, **kwargs: Any) -> KnowledgeAnswerCommand:
|
|
@@ -68,4 +68,4 @@ class KnowledgeAnswerCommand(FreeFormAnswerCommand):
|
|
|
68
68
|
|
|
69
69
|
@staticmethod
|
|
70
70
|
def regex_pattern() -> str:
|
|
71
|
-
return r"
|
|
71
|
+
return r"SearchAndReply\(\)"
|
|
@@ -60,7 +60,7 @@ class RepeatBotMessagesCommand(Command):
|
|
|
60
60
|
|
|
61
61
|
def to_dsl(self) -> str:
|
|
62
62
|
"""Converts the command to a DSL string."""
|
|
63
|
-
return "
|
|
63
|
+
return "RepeatLastBotMessages()"
|
|
64
64
|
|
|
65
65
|
@classmethod
|
|
66
66
|
def from_dsl(cls, match: re.Match, **kwargs: Any) -> RepeatBotMessagesCommand:
|
|
@@ -69,4 +69,4 @@ class RepeatBotMessagesCommand(Command):
|
|
|
69
69
|
|
|
70
70
|
@staticmethod
|
|
71
71
|
def regex_pattern() -> str:
|
|
72
|
-
return r"
|
|
72
|
+
return r"RepeatLastBotMessages\(\)"
|
|
@@ -170,7 +170,7 @@ class SetSlotCommand(Command):
|
|
|
170
170
|
|
|
171
171
|
def to_dsl(self) -> str:
|
|
172
172
|
"""Converts the command to a DSL string."""
|
|
173
|
-
return f"
|
|
173
|
+
return f"SetSlot({self.name}, {self.value})"
|
|
174
174
|
|
|
175
175
|
@classmethod
|
|
176
176
|
def from_dsl(cls, match: re.Match, **kwargs: Any) -> SetSlotCommand:
|
|
@@ -181,4 +181,4 @@ class SetSlotCommand(Command):
|
|
|
181
181
|
|
|
182
182
|
@staticmethod
|
|
183
183
|
def regex_pattern() -> str:
|
|
184
|
-
return r"""
|
|
184
|
+
return r"""SetSlot\(['"]?([a-zA-Z_][a-zA-Z0-9_-]*)['"]?, ?['"]?(.*)['"]?\)"""
|
|
@@ -75,7 +75,7 @@ class SkipQuestionCommand(Command):
|
|
|
75
75
|
|
|
76
76
|
def to_dsl(self) -> str:
|
|
77
77
|
"""Converts the command to a DSL string."""
|
|
78
|
-
return "
|
|
78
|
+
return "SkipQuestion()"
|
|
79
79
|
|
|
80
80
|
@classmethod
|
|
81
81
|
def from_dsl(cls, match: re.Match, **kwargs: Any) -> SkipQuestionCommand:
|
|
@@ -84,4 +84,4 @@ class SkipQuestionCommand(Command):
|
|
|
84
84
|
|
|
85
85
|
@staticmethod
|
|
86
86
|
def regex_pattern() -> str:
|
|
87
|
-
return r"
|
|
87
|
+
return r"SkipQuestion\(\)"
|
|
@@ -110,7 +110,7 @@ class StartFlowCommand(Command):
|
|
|
110
110
|
|
|
111
111
|
def to_dsl(self) -> str:
|
|
112
112
|
"""Converts the command to a DSL string."""
|
|
113
|
-
return f"
|
|
113
|
+
return f"StartFlow({self.flow})"
|
|
114
114
|
|
|
115
115
|
@classmethod
|
|
116
116
|
def from_dsl(cls, match: re.Match, **kwargs: Any) -> Optional[StartFlowCommand]:
|
|
@@ -119,4 +119,4 @@ class StartFlowCommand(Command):
|
|
|
119
119
|
|
|
120
120
|
@staticmethod
|
|
121
121
|
def regex_pattern() -> str:
|
|
122
|
-
return r"
|
|
122
|
+
return r"StartFlow\(['\"]?([a-zA-Z0-9_-]+)['\"]?\)"
|
|
@@ -27,7 +27,7 @@ def extract_cleaned_options(options_str: str) -> List[str]:
|
|
|
27
27
|
"""Extract and clean options from a string."""
|
|
28
28
|
return sorted(
|
|
29
29
|
opt.strip().strip('"').strip("'")
|
|
30
|
-
for opt in options_str.split("
|
|
30
|
+
for opt in options_str.split(",")
|
|
31
31
|
if opt.strip()
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -125,7 +125,7 @@ def _parse_standard_commands(
|
|
|
125
125
|
commands: List[Command] = []
|
|
126
126
|
for command_clz in standard_commands:
|
|
127
127
|
pattern = _get_compiled_pattern(command_clz.regex_pattern())
|
|
128
|
-
if match := pattern.search(action
|
|
128
|
+
if match := pattern.search(action):
|
|
129
129
|
parsed_command = command_clz.from_dsl(match, **kwargs)
|
|
130
130
|
if _additional_parsing_fn := _get_additional_parsing_logic(command_clz):
|
|
131
131
|
parsed_command = _additional_parsing_fn(parsed_command, flows, **kwargs)
|
|
@@ -30,7 +30,7 @@ from rasa.shared.exceptions import FileIOException, ProviderClientAPIException
|
|
|
30
30
|
from rasa.shared.nlu.constants import FLOWS_IN_PROMPT
|
|
31
31
|
from rasa.shared.nlu.training_data.message import Message
|
|
32
32
|
from rasa.shared.nlu.training_data.training_data import TrainingData
|
|
33
|
-
from rasa.shared.providers.llm.llm_response import LLMResponse
|
|
33
|
+
from rasa.shared.providers.llm.llm_response import LLMResponse, measure_llm_latency
|
|
34
34
|
from rasa.shared.utils.health_check.llm_health_check_mixin import LLMHealthCheckMixin
|
|
35
35
|
from rasa.shared.utils.llm import (
|
|
36
36
|
allowed_values_for_slot,
|
|
@@ -303,6 +303,7 @@ class LLMBasedCommandGenerator(
|
|
|
303
303
|
)
|
|
304
304
|
return filtered_flows
|
|
305
305
|
|
|
306
|
+
@measure_llm_latency
|
|
306
307
|
async def invoke_llm(self, prompt: Text) -> Optional[LLMResponse]:
|
|
307
308
|
"""Use LLM to generate a response.
|
|
308
309
|
|
|
@@ -356,8 +357,7 @@ class LLMBasedCommandGenerator(
|
|
|
356
357
|
"slots": slots_with_info,
|
|
357
358
|
}
|
|
358
359
|
)
|
|
359
|
-
|
|
360
|
-
return sorted(result, key=lambda x: x["name"])
|
|
360
|
+
return result
|
|
361
361
|
|
|
362
362
|
@staticmethod
|
|
363
363
|
def is_extractable(
|
|
@@ -1,58 +1,60 @@
|
|
|
1
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
2
|
|
|
3
|
-
|
|
4
|
-
## Available Actions:
|
|
5
|
-
* Starting a flow, described by "start flow_name". For example, "start transfer_money" or "start list_contacts"
|
|
6
|
-
* Slot setting, described by "set slot_name slot_value". For example, "set transfer_money_recipient Freddy". Can be used to correct and change previously set values.
|
|
7
|
-
* Cancelling the current flow, described by "cancel"
|
|
8
|
-
* Clarifying which flow should be started in ambiguous cases. For example, "clarify list_contacts add_contact remove_contact" if the user just wrote "contacts" and there are multiple potential candidates.
|
|
9
|
-
* Skipping the current question when the user explicitly asks for it, described by "skip".
|
|
10
|
-
* Responding to knowledge-oriented user messages, described by "search"
|
|
11
|
-
* Responding to a casual, non-task-oriented user message, described by "chat".
|
|
12
|
-
* Handing over to a human, in case the user seems frustrated or explicitly asks to speak to one, described by "hand over".
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## General Tips
|
|
16
|
-
* Do not fill slots with abstract values or placeholders.
|
|
17
|
-
* Only use information provided by the user.
|
|
18
|
-
* Use clarification in ambiguous cases.
|
|
19
|
-
* Multiple flows can be started. If a user wants to digress into a second flow, you do not need to cancel the current flow.
|
|
20
|
-
* Strictly adhere to the provided action format.
|
|
21
|
-
* For categorical slots try to match the user message with potential slot values. Use "other" if you cannot match it
|
|
22
|
-
* Focus on the last message and take it one step at a time.
|
|
23
|
-
* Use the previous conversation steps only to aid understanding.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## Available Flows:
|
|
3
|
+
These are the flows that can be started, with their description and slots:
|
|
27
4
|
{% for flow in available_flows %}
|
|
28
|
-
|
|
5
|
+
{{ flow.name }}: {{ flow.description }}
|
|
29
6
|
{% for slot in flow.slots -%}
|
|
30
|
-
|
|
7
|
+
slot: {{ slot.name }}{% if slot.description %} ({{ slot.description }}){% endif %}{% if slot.allowed_values %}, allowed values: {{ slot.allowed_values }}{% endif %}
|
|
31
8
|
{% endfor %}
|
|
32
9
|
{%- endfor %}
|
|
33
10
|
|
|
11
|
+
===
|
|
12
|
+
Here is what happened previously in the conversation:
|
|
13
|
+
{{ current_conversation }}
|
|
34
14
|
|
|
35
|
-
|
|
15
|
+
===
|
|
36
16
|
{% if current_flow != None %}
|
|
37
17
|
You are currently in the flow "{{ current_flow }}".
|
|
38
18
|
You have just asked the user for the slot "{{ current_slot }}"{% if current_slot_description %} ({{ current_slot_description }}){% endif %}.
|
|
39
19
|
|
|
40
20
|
{% if flow_slots|length > 0 %}
|
|
41
|
-
Here are the slots of the
|
|
21
|
+
Here are the slots of the currently active flow:
|
|
42
22
|
{% for slot in flow_slots -%}
|
|
43
|
-
|
|
23
|
+
- name: {{ slot.name }}, value: {{ slot.value }}, type: {{ slot.type }}, description: {{ slot.description}}{% if slot.allowed_values %}, allowed values: {{ slot.allowed_values }}{% endif %}
|
|
44
24
|
{% endfor %}
|
|
45
25
|
{% endif %}
|
|
46
26
|
{% else %}
|
|
47
|
-
You are currently not
|
|
27
|
+
You are currently not in any flow and so there are no active slots.
|
|
28
|
+
This means you can only set a slot if you first start a flow that requires that slot.
|
|
29
|
+
{% endif %}
|
|
30
|
+
If you start a flow, first start the flow and then optionally fill that flow's slots with information the user provided in their message.
|
|
31
|
+
|
|
32
|
+
The user just said """{{ user_message }}""".
|
|
33
|
+
|
|
34
|
+
===
|
|
35
|
+
Based on this information generate a list of actions you want to take. Your job is to start flows and to fill slots where appropriate. Any logic of what happens afterwards is handled by the flow engine. These are your available actions:
|
|
36
|
+
* Slot setting, described by "SetSlot(slot_name, slot_value)". An example would be "SetSlot(recipient, Freddy)"
|
|
37
|
+
* Starting another flow, described by "StartFlow(flow_name)". An example would be "StartFlow(transfer_money)"
|
|
38
|
+
* Cancelling the current flow, described by "CancelFlow()"
|
|
39
|
+
* Clarifying which flow should be started. An example would be Clarify(list_contacts, add_contact, remove_contact) if the user just wrote "contacts" and there are multiple potential candidates. It also works with a single flow name to confirm you understood correctly, as in Clarify(transfer_money).
|
|
40
|
+
* Intercepting and handle user messages with the intent to bypass the current step in the flow, described by "SkipQuestion()". Examples of user skip phrases are: "Go to the next question", "Ask me something else".
|
|
41
|
+
* Responding to knowledge-oriented user messages, described by "SearchAndReply()"
|
|
42
|
+
* Responding to a casual, non-task-oriented user message, described by "ChitChat()".
|
|
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 %}
|
|
45
|
+
* Repeat the last bot messages, described by "RepeatLastBotMessages()". This is useful when the user asks to repeat the last bot messages.
|
|
48
46
|
{% endif %}
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
===
|
|
49
|
+
Write out the actions you want to take, one per line, in the order they should take place.
|
|
50
|
+
Do not fill slots with abstract values or placeholders.
|
|
51
|
+
Only use information provided by the user.
|
|
52
|
+
Only start a flow if it's completely clear what the user wants. Imagine you were a person reading this message. If it's not 100% clear, clarify the next step.
|
|
53
|
+
Don't be overly confident. Take a conservative approach and clarify before proceeding.
|
|
54
|
+
If the user asks for two things which seem contradictory, clarify before starting a flow.
|
|
55
|
+
If it's not clear whether the user wants to skip the step or to cancel the flow, cancel the flow.
|
|
56
|
+
Strictly adhere to the provided action types listed above.
|
|
57
|
+
Focus on the last message and take it one step at a time.
|
|
58
|
+
Use the previous conversation steps only to aid understanding.
|
|
59
|
+
|
|
60
|
+
Your action list:
|
|
@@ -79,12 +79,16 @@ def calculate_command_metrics(
|
|
|
79
79
|
return metrics
|
|
80
80
|
|
|
81
81
|
|
|
82
|
+
def _get_command_name(command: Command) -> str:
|
|
83
|
+
return command.command().replace(" ", "_")
|
|
84
|
+
|
|
85
|
+
|
|
82
86
|
def _increase_total_count(
|
|
83
87
|
commands: List[Command],
|
|
84
88
|
metrics: Dict[str, CommandMetrics],
|
|
85
89
|
) -> None:
|
|
86
90
|
for command in commands:
|
|
87
|
-
metrics[command
|
|
91
|
+
metrics[_get_command_name(command)].total_count += 1
|
|
88
92
|
|
|
89
93
|
|
|
90
94
|
def _increase_tp(
|
|
@@ -92,7 +96,7 @@ def _increase_tp(
|
|
|
92
96
|
metrics: Dict[str, CommandMetrics],
|
|
93
97
|
) -> None:
|
|
94
98
|
for command in commands:
|
|
95
|
-
metrics[command
|
|
99
|
+
metrics[_get_command_name(command)].tp += 1
|
|
96
100
|
|
|
97
101
|
|
|
98
102
|
def _update_metrics_true_positive_and_false_negative(
|
|
@@ -101,7 +105,7 @@ def _update_metrics_true_positive_and_false_negative(
|
|
|
101
105
|
metrics: Dict[str, CommandMetrics],
|
|
102
106
|
) -> None:
|
|
103
107
|
for expected_command in expected_commands:
|
|
104
|
-
command_name = expected_command
|
|
108
|
+
command_name = _get_command_name(expected_command)
|
|
105
109
|
if is_command_present_in_list(expected_command, predicted_commands):
|
|
106
110
|
metrics[command_name].tp += 1
|
|
107
111
|
else:
|
|
@@ -115,4 +119,4 @@ def _update_metrics_false_positive(
|
|
|
115
119
|
) -> None:
|
|
116
120
|
for predicted_command in predicted_commands:
|
|
117
121
|
if not is_command_present_in_list(predicted_command, expected_commands):
|
|
118
|
-
metrics[predicted_command
|
|
122
|
+
metrics[_get_command_name(predicted_command)].fp += 1
|
|
@@ -27,6 +27,7 @@ OUTPUT_NUMBER_OF_FAILED_USER_UTTERANCES = "number_of_failed_user_utterances"
|
|
|
27
27
|
OUTPUT_COMMAND_METRICS = "command_metrics"
|
|
28
28
|
OUTPUT_NAMES_OF_FAILED_TESTS = "names_of_failed_tests"
|
|
29
29
|
OUTPUT_NAMES_OF_PASSED_TESTS = "names_of_passed_tests"
|
|
30
|
+
OUTPUT_LLM_COMMAND_GENERATOR_CONFIG = "llm_command_generator_config"
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
class DialogueUnderstandingTestResult(BaseModel):
|
|
@@ -151,6 +152,7 @@ class DialogueUnderstandingTestSuiteResult:
|
|
|
151
152
|
self.names_of_failed_tests: List[str] = []
|
|
152
153
|
self.names_of_passed_tests: List[str] = []
|
|
153
154
|
self.failed_test_steps: List[FailedTestStep] = []
|
|
155
|
+
self.llm_config: Optional[Dict[str, Any]] = None
|
|
154
156
|
|
|
155
157
|
@classmethod
|
|
156
158
|
def from_results(
|
|
@@ -158,6 +160,7 @@ class DialogueUnderstandingTestSuiteResult:
|
|
|
158
160
|
failing_test_results: List[DialogueUnderstandingTestResult],
|
|
159
161
|
passing_test_results: List[DialogueUnderstandingTestResult],
|
|
160
162
|
command_metrics: Dict[str, "CommandMetrics"],
|
|
163
|
+
llm_config: Optional[Dict[str, Any]],
|
|
161
164
|
) -> "DialogueUnderstandingTestSuiteResult":
|
|
162
165
|
"""Create a DialogueUnderstandingTestSuiteResult object from the test results.
|
|
163
166
|
|
|
@@ -171,6 +174,7 @@ class DialogueUnderstandingTestSuiteResult:
|
|
|
171
174
|
representing the test cases that passed.
|
|
172
175
|
command_metrics: A dictionary of command-specific performance metrics, keyed
|
|
173
176
|
by command name.
|
|
177
|
+
llm_config: A dictionary containing the command generator configuration.
|
|
174
178
|
|
|
175
179
|
Returns:
|
|
176
180
|
A DialogueUnderstandingTestSuiteResult object containing aggregated test
|
|
@@ -202,6 +206,8 @@ class DialogueUnderstandingTestSuiteResult:
|
|
|
202
206
|
failing_test_results
|
|
203
207
|
)
|
|
204
208
|
|
|
209
|
+
instance.llm_config = llm_config
|
|
210
|
+
|
|
205
211
|
return instance
|
|
206
212
|
|
|
207
213
|
def _set_user_utterance_metrics(
|
|
@@ -297,4 +303,7 @@ class DialogueUnderstandingTestSuiteResult:
|
|
|
297
303
|
|
|
298
304
|
result_dict["failed_test_steps"] = failed_steps_list
|
|
299
305
|
|
|
306
|
+
if self.llm_config:
|
|
307
|
+
result_dict[OUTPUT_LLM_COMMAND_GENERATOR_CONFIG] = self.llm_config
|
|
308
|
+
|
|
300
309
|
return result_dict
|