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.

Files changed (110) hide show
  1. rasa/cli/dialogue_understanding_test.py +40 -5
  2. rasa/constants.py +0 -1
  3. rasa/core/actions/action.py +4 -2
  4. rasa/core/actions/custom_action_executor.py +1 -1
  5. rasa/core/channels/inspector/dist/assets/Tableau10-1b767f5e.js +1 -0
  6. rasa/core/channels/inspector/dist/assets/arc-f0f8bd46.js +1 -0
  7. rasa/core/channels/inspector/dist/assets/blockDiagram-38ab4fdb-7162c77d.js +118 -0
  8. rasa/core/channels/inspector/dist/assets/c4Diagram-3d4e48cf-b1d0d098.js +10 -0
  9. rasa/core/channels/inspector/dist/assets/channel-e265ea59.js +1 -0
  10. rasa/core/channels/inspector/dist/assets/classDiagram-70f12bd4-807a1b27.js +2 -0
  11. rasa/core/channels/inspector/dist/assets/classDiagram-v2-f2320105-5238dcdb.js +2 -0
  12. rasa/core/channels/inspector/dist/assets/clone-21f8a43d.js +1 -0
  13. rasa/core/channels/inspector/dist/assets/{createText-62fc7601-89c73b31.js → createText-2e5e7dd3-75dfaa67.js} +1 -1
  14. rasa/core/channels/inspector/dist/assets/edges-e0da2a9e-df20501d.js +4 -0
  15. rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-907e0440.js → erDiagram-9861fffd-13cf4797.js} +4 -4
  16. rasa/core/channels/inspector/dist/assets/flowDb-956e92f1-a4991264.js +10 -0
  17. rasa/core/channels/inspector/dist/assets/flowDiagram-66a62f08-ccecf773.js +4 -0
  18. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-5c8ce12d.js +1 -0
  19. rasa/core/channels/inspector/dist/assets/flowchart-elk-definition-4a651766-b5801783.js +139 -0
  20. rasa/core/channels/inspector/dist/assets/ganttDiagram-c361ad54-161e079a.js +257 -0
  21. rasa/core/channels/inspector/dist/assets/gitGraphDiagram-72cf32ee-f38e86a4.js +70 -0
  22. rasa/core/channels/inspector/dist/assets/graph-be6ef5d8.js +1 -0
  23. rasa/core/channels/inspector/dist/assets/index-3862675e-d9ce8994.js +1 -0
  24. rasa/core/channels/inspector/dist/assets/{index-e793d777.js → index-7794b245.js} +200 -195
  25. rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-8ceba4db.js → infoDiagram-f8f76790-5000a3dc.js} +1 -1
  26. rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-960d3809.js → journeyDiagram-49397b02-8ef0a17a.js} +4 -4
  27. rasa/core/channels/inspector/dist/assets/katex-498eb57e.js +261 -0
  28. rasa/core/channels/inspector/dist/assets/layout-d649bc98.js +1 -0
  29. rasa/core/channels/inspector/dist/assets/{line-eeccc4e2.js → line-95add810.js} +1 -1
  30. rasa/core/channels/inspector/dist/assets/linear-f6025094.js +1 -0
  31. rasa/core/channels/inspector/dist/assets/mindmap-definition-fc14e90a-2e8531c4.js +312 -0
  32. rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-dc9b5e1b.js → pieDiagram-8a3498a8-918adfdb.js} +7 -7
  33. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-a08cba6d.js → quadrantDiagram-120e2f19-cbd01797.js} +1 -1
  34. rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-87242b9e.js → requirementDiagram-deff3bca-6a8b877b.js} +2 -2
  35. rasa/core/channels/inspector/dist/assets/sankeyDiagram-04a897e0-c377c3fe.js +8 -0
  36. rasa/core/channels/inspector/dist/assets/sequenceDiagram-704730f1-ab9e9b7f.js +122 -0
  37. rasa/core/channels/inspector/dist/assets/stateDiagram-587899a1-5e6ae67d.js +1 -0
  38. rasa/core/channels/inspector/dist/assets/stateDiagram-v2-d93cdb3a-40643476.js +1 -0
  39. rasa/core/channels/inspector/dist/assets/{styles-9c745c82-cef936a6.js → styles-6aaf32cf-afb8d108.js} +1 -1
  40. rasa/core/channels/inspector/dist/assets/styles-9a916d00-7edc9423.js +160 -0
  41. rasa/core/channels/inspector/dist/assets/styles-c10674c1-c1d8f7e9.js +116 -0
  42. rasa/core/channels/inspector/dist/assets/svgDrawCommon-08f97a94-f494b2ef.js +1 -0
  43. rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-0d39bdb2.js → timeline-definition-85554ec2-11c7cdd0.js} +3 -3
  44. rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-a03fa445.js → xychartDiagram-e933f94c-3f191ec1.js} +3 -3
  45. rasa/core/channels/inspector/dist/index.html +1 -1
  46. rasa/core/channels/inspector/package.json +10 -3
  47. rasa/core/channels/inspector/yarn.lock +89 -99
  48. rasa/core/channels/voice_stream/asr/azure.py +1 -1
  49. rasa/core/channels/voice_stream/tts/azure.py +1 -1
  50. rasa/core/nlg/contextual_response_rephraser.py +2 -1
  51. rasa/core/policies/enterprise_search_policy.py +2 -1
  52. rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -2
  53. rasa/dialogue_understanding/commands/cancel_flow_command.py +2 -2
  54. rasa/dialogue_understanding/commands/change_flow_command.py +2 -2
  55. rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -2
  56. rasa/dialogue_understanding/commands/clarify_command.py +2 -2
  57. rasa/dialogue_understanding/commands/human_handoff_command.py +2 -2
  58. rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -2
  59. rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +2 -2
  60. rasa/dialogue_understanding/commands/set_slot_command.py +2 -2
  61. rasa/dialogue_understanding/commands/skip_question_command.py +2 -2
  62. rasa/dialogue_understanding/commands/start_flow_command.py +2 -2
  63. rasa/dialogue_understanding/commands/utils.py +1 -1
  64. rasa/dialogue_understanding/generator/command_parser.py +1 -1
  65. rasa/dialogue_understanding/generator/llm_based_command_generator.py +3 -3
  66. rasa/dialogue_understanding/generator/single_step/command_prompt_template.jinja2 +41 -39
  67. rasa/dialogue_understanding_test/command_metric_calculation.py +8 -4
  68. rasa/dialogue_understanding_test/du_test_result.py +9 -0
  69. rasa/e2e_test/assertions.py +203 -174
  70. rasa/e2e_test/assertions_schema.yml +6 -0
  71. rasa/e2e_test/constants.py +16 -1
  72. rasa/e2e_test/e2e_config.py +102 -41
  73. rasa/e2e_test/e2e_config_schema.yml +28 -10
  74. rasa/e2e_test/llm_judge_prompts/answer_relevance_prompt_template.jinja2 +89 -0
  75. rasa/e2e_test/llm_judge_prompts/groundedness_prompt_template.jinja2 +165 -0
  76. rasa/e2e_test/utils/generative_assertions.py +243 -0
  77. rasa/server.py +3 -1
  78. rasa/shared/nlu/constants.py +1 -0
  79. rasa/shared/providers/llm/llm_response.py +21 -1
  80. rasa/shared/utils/llm.py +1 -1
  81. rasa/tracing/instrumentation/attribute_extractors.py +23 -7
  82. rasa/utils/common.py +0 -14
  83. rasa/version.py +1 -1
  84. {rasa_pro-3.12.0.dev5.dist-info → rasa_pro-3.12.0.dev7.dist-info}/METADATA +2 -4
  85. {rasa_pro-3.12.0.dev5.dist-info → rasa_pro-3.12.0.dev7.dist-info}/RECORD +88 -79
  86. rasa/core/channels/inspector/dist/assets/arc-632a63ec.js +0 -1
  87. rasa/core/channels/inspector/dist/assets/c4Diagram-d0fbc5ce-081e0df4.js +0 -10
  88. rasa/core/channels/inspector/dist/assets/classDiagram-936ed81e-3df0afc2.js +0 -2
  89. rasa/core/channels/inspector/dist/assets/classDiagram-v2-c3cb15f1-8c5ed31e.js +0 -2
  90. rasa/core/channels/inspector/dist/assets/edges-f2ad444c-4fc48c3e.js +0 -4
  91. rasa/core/channels/inspector/dist/assets/flowDb-1972c806-9ec53a3c.js +0 -6
  92. rasa/core/channels/inspector/dist/assets/flowDiagram-7ea5b25a-41da787a.js +0 -4
  93. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-8bea338b.js +0 -1
  94. rasa/core/channels/inspector/dist/assets/flowchart-elk-definition-abe16c3d-ce370633.js +0 -139
  95. rasa/core/channels/inspector/dist/assets/ganttDiagram-9b5ea136-90a36523.js +0 -266
  96. rasa/core/channels/inspector/dist/assets/gitGraphDiagram-99d0ae7c-41e1aa3f.js +0 -70
  97. rasa/core/channels/inspector/dist/assets/index-2c4b9a3b-e6f2af62.js +0 -1
  98. rasa/core/channels/inspector/dist/assets/layout-498807d8.js +0 -1
  99. rasa/core/channels/inspector/dist/assets/linear-8a078617.js +0 -1
  100. rasa/core/channels/inspector/dist/assets/mindmap-definition-beec6740-396d17dd.js +0 -109
  101. rasa/core/channels/inspector/dist/assets/sankeyDiagram-8f13d901-53f6f391.js +0 -8
  102. rasa/core/channels/inspector/dist/assets/sequenceDiagram-b655622a-715c9c20.js +0 -122
  103. rasa/core/channels/inspector/dist/assets/stateDiagram-59f0c015-2e8fb31f.js +0 -1
  104. rasa/core/channels/inspector/dist/assets/stateDiagram-v2-2b26beab-7e2d2aa0.js +0 -1
  105. rasa/core/channels/inspector/dist/assets/styles-080da4f6-4420cea6.js +0 -110
  106. rasa/core/channels/inspector/dist/assets/styles-3dcbcfbf-28676cf4.js +0 -159
  107. rasa/core/channels/inspector/dist/assets/svgDrawCommon-4835440b-151251e9.js +0 -1
  108. {rasa_pro-3.12.0.dev5.dist-info → rasa_pro-3.12.0.dev7.dist-info}/NOTICE +0 -0
  109. {rasa_pro-3.12.0.dev5.dist-info → rasa_pro-3.12.0.dev7.dist-info}/WHEEL +0 -0
  110. {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 "cannot handle"
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"^cannot handle$"
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 "cancel"
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"^cancel$"
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 "change"
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"^change"
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 "chat"
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"^chat$"
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"clarify {' '.join(self.options)}"
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"^clarify([\"\'a-zA-Z0-9_, ]*)$"
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 "hand over"
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"^hand over$"
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 "search"
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"^search$"
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 "repeat message"
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"^repeat message$"
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"set {self.name} {self.value}"
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"""^set ['"]?([a-zA-Z_][a-zA-Z0-9_-]*)['"]? ['"]?(.+?)['"]?$"""
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 "skip"
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"^skip$"
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"start {self.flow}"
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"^start ['\"]?([a-zA-Z0-9_-]+)['\"]?$"
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.strip()):
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
- * {{ flow.name }}: {{ flow.description }}
5
+ {{ flow.name }}: {{ flow.description }}
29
6
  {% for slot in flow.slots -%}
30
- * {{ slot.name }}{% if slot.description %} ({{ slot.description }}){% endif %}{% if slot.allowed_values %}, allowed values: {{ slot.allowed_values }}{% endif %}
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
- ## Current State
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 flow "{{ current_flow }}":
21
+ Here are the slots of the currently active flow:
42
22
  {% for slot in flow_slots -%}
43
- * name: {{ slot.name }}, value: {{ slot.value }}, type: {{ slot.type }}, description: {{ slot.description}}{% if slot.allowed_values %}, allowed values: {{ slot.allowed_values }}{% endif %}
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 inside any flow.
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
- ## Conversation History
52
- {{ current_conversation }}
53
-
54
-
55
- ## Task
56
- Create an action list with one action per line in response to the users last message: """{{ user_message }}""".
57
-
58
- Your action list:
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.command()].total_count += 1
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.command()].tp += 1
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.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.command()].fp += 1
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