From 2bfcb05ebb009fec32b7e2de6efa4626ab6a569b Mon Sep 17 00:00:00 2001 From: Tom Bocklisch Date: Mon, 18 Sep 2023 06:58:17 +0200 Subject: [PATCH] renamed cdu -> dialogue understanding --- .../default_config_core_predict_schema.yml | 2 +- .../default_config_e2e_predict_schema.yml | 2 +- .../default_config_predict_schema.yml | 2 +- .../max_hist_config_predict_schema.yml | 2 +- data/test_config/graph_config.yml | 2 +- pyproject.toml | 2 +- rasa/cdu/commands/__init__.py | 29 ------------- rasa/cdu/generator/__init__.py | 4 -- rasa/cdu/stack/frames/__init__.py | 17 -------- rasa/core/actions/action.py | 6 +-- rasa/core/actions/flow_trigger_action.py | 4 +- rasa/core/nlg/response.py | 2 +- rasa/core/policies/flow_policy.py | 18 ++++---- rasa/core/policies/policy.py | 2 +- .../__init__.py | 0 .../commands/__init__.py | 42 +++++++++++++++++++ .../commands/can_not_handle_command.py | 2 +- .../commands/cancel_flow_command.py | 10 ++--- .../commands/chit_chat_answer_command.py | 6 +-- .../commands/clarify_command.py | 6 +-- .../commands/command.py | 0 .../commands/correct_slots_command.py | 10 ++--- .../commands/error_command.py | 8 ++-- .../commands/free_form_answer_command.py | 2 +- .../commands/human_handoff_command.py | 2 +- .../commands/knowledge_answer_command.py | 6 +-- .../commands/set_slot_command.py | 6 +-- .../commands/start_flow_command.py | 11 +++-- .../generator/__init__.py | 6 +++ .../generator/command_generator.py | 2 +- .../generator/command_prompt_template.jinja2 | 0 .../generator/llm_command_generator.py | 8 ++-- .../generator/nlu_command_adapter.py | 0 .../patterns/__init__.py | 0 .../patterns/cancel.py | 7 +++- .../patterns/clarify.py | 4 +- .../patterns/collect_information.py | 4 +- .../patterns/completed.py | 2 +- .../patterns/continue_interrupted.py | 2 +- .../patterns/correction.py | 6 +-- .../patterns/default_flows_for_patterns.yml | 0 .../patterns/internal_error.py | 2 +- .../processor/__init__.py | 0 .../processor/command_processor.py | 15 ++++--- .../processor/command_processor_component.py | 2 +- .../stack/__init__.py | 0 .../stack/dialogue_stack.py | 2 +- .../stack/frames/__init__.py | 19 +++++++++ .../stack/frames/chit_chat_frame.py | 2 +- .../stack/frames/dialogue_stack_frame.py | 0 .../stack/frames/flow_stack_frame.py | 2 +- .../stack/frames/pattern_frame.py | 2 +- .../stack/frames/search_frame.py | 2 +- .../stack/utils.py | 8 ++-- rasa/engine/recipes/default_components.py | 4 +- rasa/engine/recipes/default_recipe.py | 4 +- rasa/shared/importers/importer.py | 4 +- .../commands/test_can_not_handle_command.py | 4 +- .../cdu/commands/test_cancel_flow_command.py | 8 ++-- .../commands/test_chit_chat_answer_command.py | 4 +- tests/cdu/commands/test_clarify_command.py | 2 +- tests/cdu/commands/test_command.py | 4 +- .../commands/test_correct_slots_command.py | 15 ++++--- tests/cdu/commands/test_error_command.py | 2 +- .../commands/test_human_handoff_command.py | 4 +- .../commands/test_konwledge_answer_command.py | 4 +- tests/cdu/commands/test_set_slot_command.py | 2 +- tests/cdu/commands/test_start_flow_command.py | 2 +- .../cdu/stack/frames/test_chit_chat_frame.py | 2 +- .../stack/frames/test_dialogue_stack_frame.py | 2 +- tests/cdu/stack/frames/test_flow_frame.py | 2 +- tests/cdu/stack/frames/test_search_frame.py | 2 +- tests/cdu/stack/test_dialogue_stack.py | 6 +-- tests/cdu/stack/test_utils.py | 10 ++--- 74 files changed, 218 insertions(+), 171 deletions(-) delete mode 100644 rasa/cdu/commands/__init__.py delete mode 100644 rasa/cdu/generator/__init__.py delete mode 100644 rasa/cdu/stack/frames/__init__.py rename rasa/{cdu => dialogue_understanding}/__init__.py (100%) create mode 100644 rasa/dialogue_understanding/commands/__init__.py rename rasa/{cdu => dialogue_understanding}/commands/can_not_handle_command.py (95%) rename rasa/{cdu => dialogue_understanding}/commands/cancel_flow_command.py (90%) rename rasa/{cdu => dialogue_understanding}/commands/chit_chat_answer_command.py (86%) rename rasa/{cdu => dialogue_understanding}/commands/clarify_command.py (92%) rename rasa/{cdu => dialogue_understanding}/commands/command.py (100%) rename rasa/{cdu => dialogue_understanding}/commands/correct_slots_command.py (97%) rename rasa/{cdu => dialogue_understanding}/commands/error_command.py (87%) rename rasa/{cdu => dialogue_understanding}/commands/free_form_answer_command.py (73%) rename rasa/{cdu => dialogue_understanding}/commands/human_handoff_command.py (95%) rename rasa/{cdu => dialogue_understanding}/commands/knowledge_answer_command.py (86%) rename rasa/{cdu => dialogue_understanding}/commands/set_slot_command.py (92%) rename rasa/{cdu => dialogue_understanding}/commands/start_flow_command.py (89%) create mode 100644 rasa/dialogue_understanding/generator/__init__.py rename rasa/{cdu => dialogue_understanding}/generator/command_generator.py (97%) rename rasa/{cdu => dialogue_understanding}/generator/command_prompt_template.jinja2 (100%) rename rasa/{cdu => dialogue_understanding}/generator/llm_command_generator.py (98%) rename rasa/{cdu => dialogue_understanding}/generator/nlu_command_adapter.py (100%) rename rasa/{cdu => dialogue_understanding}/patterns/__init__.py (100%) rename rasa/{cdu => dialogue_understanding}/patterns/cancel.py (95%) rename rasa/{cdu => dialogue_understanding}/patterns/clarify.py (96%) rename rasa/{cdu => dialogue_understanding}/patterns/collect_information.py (93%) rename rasa/{cdu => dialogue_understanding}/patterns/completed.py (94%) rename rasa/{cdu => dialogue_understanding}/patterns/continue_interrupted.py (94%) rename rasa/{cdu => dialogue_understanding}/patterns/correction.py (95%) rename rasa/{cdu => dialogue_understanding}/patterns/default_flows_for_patterns.yml (100%) rename rasa/{cdu => dialogue_understanding}/patterns/internal_error.py (93%) rename rasa/{cdu => dialogue_understanding}/processor/__init__.py (100%) rename rasa/{cdu => dialogue_understanding}/processor/command_processor.py (95%) rename rasa/{cdu => dialogue_understanding}/processor/command_processor_component.py (92%) rename rasa/{cdu => dialogue_understanding}/stack/__init__.py (100%) rename rasa/{cdu => dialogue_understanding}/stack/dialogue_stack.py (98%) create mode 100644 rasa/dialogue_understanding/stack/frames/__init__.py rename rasa/{cdu => dialogue_understanding}/stack/frames/chit_chat_frame.py (90%) rename rasa/{cdu => dialogue_understanding}/stack/frames/dialogue_stack_frame.py (100%) rename rasa/{cdu => dialogue_understanding}/stack/frames/flow_stack_frame.py (98%) rename rasa/{cdu => dialogue_understanding}/stack/frames/pattern_frame.py (69%) rename rasa/{cdu => dialogue_understanding}/stack/frames/search_frame.py (90%) rename rasa/{cdu => dialogue_understanding}/stack/utils.py (92%) diff --git a/data/graph_schemas/default_config_core_predict_schema.yml b/data/graph_schemas/default_config_core_predict_schema.yml index ce8715b6c9ed..4aa0e1903b43 100644 --- a/data/graph_schemas/default_config_core_predict_schema.yml +++ b/data/graph_schemas/default_config_core_predict_schema.yml @@ -25,7 +25,7 @@ nodes: needs: tracker: __tracker__ flows: flows_provider - uses: rasa.cdu.processor.command_processor_component.CommandProcessorComponent + uses: rasa.dialogue_understanding.processor.command_processor_component.CommandProcessorComponent constructor_name: load fn: execute_commands config: { } diff --git a/data/graph_schemas/default_config_e2e_predict_schema.yml b/data/graph_schemas/default_config_e2e_predict_schema.yml index 46d1cb69aab7..7861c3719d3e 100644 --- a/data/graph_schemas/default_config_e2e_predict_schema.yml +++ b/data/graph_schemas/default_config_e2e_predict_schema.yml @@ -247,7 +247,7 @@ nodes: needs: tracker: __tracker__ flows: flows_provider - uses: rasa.cdu.processor.command_processor_component.CommandProcessorComponent + uses: rasa.dialogue_understanding.processor.command_processor_component.CommandProcessorComponent constructor_name: load fn: execute_commands config: { } diff --git a/data/graph_schemas/default_config_predict_schema.yml b/data/graph_schemas/default_config_predict_schema.yml index 8a1908f745e7..de5790c4d31f 100644 --- a/data/graph_schemas/default_config_predict_schema.yml +++ b/data/graph_schemas/default_config_predict_schema.yml @@ -163,7 +163,7 @@ nodes: needs: tracker: __tracker__ flows: flows_provider - uses: rasa.cdu.processor.command_processor_component.CommandProcessorComponent + uses: rasa.dialogue_understanding.processor.command_processor_component.CommandProcessorComponent constructor_name: load fn: execute_commands config: { } diff --git a/data/graph_schemas/max_hist_config_predict_schema.yml b/data/graph_schemas/max_hist_config_predict_schema.yml index 9beb1771dec9..aed0dc4bdbed 100644 --- a/data/graph_schemas/max_hist_config_predict_schema.yml +++ b/data/graph_schemas/max_hist_config_predict_schema.yml @@ -25,7 +25,7 @@ nodes: needs: tracker: __tracker__ flows: flows_provider - uses: rasa.cdu.processor.command_processor_component.CommandProcessorComponent + uses: rasa.dialogue_understanding.processor.command_processor_component.CommandProcessorComponent constructor_name: load fn: execute_commands config: { } diff --git a/data/test_config/graph_config.yml b/data/test_config/graph_config.yml index 7f8b3200f5f0..a816e91ec000 100644 --- a/data/test_config/graph_config.yml +++ b/data/test_config/graph_config.yml @@ -356,7 +356,7 @@ predict_schema: needs: tracker: __tracker__ flows: flows_provider - uses: rasa.cdu.processor.command_processor_component.CommandProcessorComponent + uses: rasa.dialogue_understanding.processor.command_processor_component.CommandProcessorComponent constructor_name: load fn: execute_commands config: { } diff --git a/pyproject.toml b/pyproject.toml index c0a02e9e5646..16fc82f44ed1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ repository = "https://github.com/rasahq/rasa" documentation = "https://rasa.com/docs" classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Topic :: Software Development :: Libraries",] keywords = [ "nlp", "machine-learning", "machine-learning-library", "bot", "bots", "botkit", "rasa conversational-agents", "conversational-ai", "chatbot", "chatbot-framework", "bot-framework",] -include = [ "LICENSE.txt", "README.md", "rasa/shared/core/training_data/visualization.html", "rasa/cli/default_config.yml", "rasa/shared/importers/*", "rasa/utils/schemas/*", "rasa/keys", "rasa/core/channels/chat.html", "rasa/cdu/classifiers/command_prompt_template.jinja2",] +include = [ "LICENSE.txt", "README.md", "rasa/shared/core/training_data/visualization.html", "rasa/cli/default_config.yml", "rasa/shared/importers/*", "rasa/utils/schemas/*", "rasa/keys", "rasa/core/channels/chat.html", "rasa/dialogue_understanding/classifiers/command_prompt_template.jinja2",] readme = "README.md" [[tool.poetry.source]] name = "internal repository mirroring psycopg binary for macos" diff --git a/rasa/cdu/commands/__init__.py b/rasa/cdu/commands/__init__.py deleted file mode 100644 index c364839b8f44..000000000000 --- a/rasa/cdu/commands/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -from rasa.cdu.commands.command import Command -from rasa.cdu.commands.free_form_answer_command import FreeFormAnswerCommand -from rasa.cdu.commands.cancel_flow_command import CancelFlowCommand -from rasa.cdu.commands.knowledge_answer_command import KnowledgeAnswerCommand -from rasa.cdu.commands.chit_chat_answer_command import ChitChatAnswerCommand -from rasa.cdu.commands.can_not_handle_command import CannotHandleCommand -from rasa.cdu.commands.clarify_command import ClarifyCommand -from rasa.cdu.commands.error_command import ErrorCommand -from rasa.cdu.commands.set_slot_command import SetSlotCommand -from rasa.cdu.commands.start_flow_command import StartFlowCommand -from rasa.cdu.commands.human_handoff_command import HumanHandoffCommand -from rasa.cdu.commands.correct_slots_command import CorrectSlotsCommand, CorrectedSlot - - -__all__ = [ - "Command", - "FreeFormAnswerCommand", - "CancelFlowCommand", - "KnowledgeAnswerCommand", - "ChitChatAnswerCommand", - "CannotHandleCommand", - "ClarifyCommand", - "ErrorCommand", - "SetSlotCommand", - "StartFlowCommand", - "HumanHandoffCommand", - "CorrectSlotsCommand", - "CorrectedSlot", -] diff --git a/rasa/cdu/generator/__init__.py b/rasa/cdu/generator/__init__.py deleted file mode 100644 index 0fe0868ef1d5..000000000000 --- a/rasa/cdu/generator/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from rasa.cdu.generator.command_generator import CommandGenerator -from rasa.cdu.generator.llm_command_generator import LLMCommandGenerator - -__all__ = ["CommandGenerator", "LLMCommandGenerator"] diff --git a/rasa/cdu/stack/frames/__init__.py b/rasa/cdu/stack/frames/__init__.py deleted file mode 100644 index 404dccce571e..000000000000 --- a/rasa/cdu/stack/frames/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -from rasa.cdu.stack.frames.dialogue_stack_frame import DialogueStackFrame -from rasa.cdu.stack.frames.flow_stack_frame import ( - UserFlowStackFrame, - BaseFlowStackFrame, -) -from rasa.cdu.stack.frames.pattern_frame import PatternFlowStackFrame -from rasa.cdu.stack.frames.search_frame import SearchStackFrame -from rasa.cdu.stack.frames.chit_chat_frame import ChitChatStackFrame - -__all__ = [ - "DialogueStackFrame", - "BaseFlowStackFrame", - "PatternFlowStackFrame", - "UserFlowStackFrame", - "SearchStackFrame", - "ChitChatStackFrame", -] diff --git a/rasa/core/actions/action.py b/rasa/core/actions/action.py index 69424a39ccab..65f5e51cd444 100644 --- a/rasa/core/actions/action.py +++ b/rasa/core/actions/action.py @@ -97,9 +97,9 @@ def default_actions(action_endpoint: Optional[EndpointConfig] = None) -> List["Action"]: """List default actions.""" from rasa.core.actions.two_stage_fallback import TwoStageFallbackAction - from rasa.cdu.patterns.correction import ActionCorrectFlowSlot - from rasa.cdu.patterns.cancel import ActionCancelFlow - from rasa.cdu.patterns.clarify import ActionClarifyFlows + from rasa.dialogue_understanding.patterns.correction import ActionCorrectFlowSlot + from rasa.dialogue_understanding.patterns.cancel import ActionCancelFlow + from rasa.dialogue_understanding.patterns.clarify import ActionClarifyFlows return [ ActionListen(), diff --git a/rasa/core/actions/flow_trigger_action.py b/rasa/core/actions/flow_trigger_action.py index 2d7d0317826a..82ee017679bf 100644 --- a/rasa/core/actions/flow_trigger_action.py +++ b/rasa/core/actions/flow_trigger_action.py @@ -1,8 +1,8 @@ from typing import Any, Dict, Optional, Text, List import structlog -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames.flow_stack_frame import ( +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames.flow_stack_frame import ( FlowStackFrameType, UserFlowStackFrame, ) diff --git a/rasa/core/nlg/response.py b/rasa/core/nlg/response.py index b931c6b28c0e..756b243602d8 100644 --- a/rasa/core/nlg/response.py +++ b/rasa/core/nlg/response.py @@ -1,6 +1,6 @@ import copy import logging -from rasa.cdu.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack from rasa.core.constants import DEFAULT_TEMPLATE_ENGINE, TEMPLATE_ENGINE_CONFIG_KEY from rasa.shared.core.trackers import DialogueStateTracker diff --git a/rasa/core/policies/flow_policy.py b/rasa/core/policies/flow_policy.py index 635c969ec9bc..273bc97f8b96 100644 --- a/rasa/core/policies/flow_policy.py +++ b/rasa/core/policies/flow_policy.py @@ -1,27 +1,29 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Text, List, Optional, Union +from typing import Any, Dict, Text, List, Optional from jinja2 import Template from structlog.contextvars import ( bound_contextvars, ) -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames import ( +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames import ( BaseFlowStackFrame, DialogueStackFrame, UserFlowStackFrame, ) -from rasa.cdu.patterns.collect_information import ( +from rasa.dialogue_understanding.patterns.collect_information import ( CollectInformationPatternFlowStackFrame, ) -from rasa.cdu.patterns.completed import CompletedPatternFlowStackFrame -from rasa.cdu.patterns.continue_interrupted import ( +from rasa.dialogue_understanding.patterns.completed import ( + CompletedPatternFlowStackFrame, +) +from rasa.dialogue_understanding.patterns.continue_interrupted import ( ContinueInterruptedPatternFlowStackFrame, ) -from rasa.cdu.stack.frames.flow_stack_frame import FlowStackFrameType -from rasa.cdu.stack.utils import top_user_flow_frame +from rasa.dialogue_understanding.stack.frames.flow_stack_frame import FlowStackFrameType +from rasa.dialogue_understanding.stack.utils import top_user_flow_frame from rasa.core.constants import ( DEFAULT_POLICY_PRIORITY, diff --git a/rasa/core/policies/policy.py b/rasa/core/policies/policy.py index 439e32741b97..acf17ea8661c 100644 --- a/rasa/core/policies/policy.py +++ b/rasa/core/policies/policy.py @@ -4,7 +4,7 @@ import logging from enum import Enum from pathlib import Path -from rasa.cdu.stack.dialogue_stack import ( +from rasa.dialogue_understanding.stack.dialogue_stack import ( DialogueStack, DialogueStackFrame, ) diff --git a/rasa/cdu/__init__.py b/rasa/dialogue_understanding/__init__.py similarity index 100% rename from rasa/cdu/__init__.py rename to rasa/dialogue_understanding/__init__.py diff --git a/rasa/dialogue_understanding/commands/__init__.py b/rasa/dialogue_understanding/commands/__init__.py new file mode 100644 index 000000000000..fd437043c2da --- /dev/null +++ b/rasa/dialogue_understanding/commands/__init__.py @@ -0,0 +1,42 @@ +from rasa.dialogue_understanding.commands.command import Command +from rasa.dialogue_understanding.commands.free_form_answer_command import ( + FreeFormAnswerCommand, +) +from rasa.dialogue_understanding.commands.cancel_flow_command import CancelFlowCommand +from rasa.dialogue_understanding.commands.knowledge_answer_command import ( + KnowledgeAnswerCommand, +) +from rasa.dialogue_understanding.commands.chit_chat_answer_command import ( + ChitChatAnswerCommand, +) +from rasa.dialogue_understanding.commands.can_not_handle_command import ( + CannotHandleCommand, +) +from rasa.dialogue_understanding.commands.clarify_command import ClarifyCommand +from rasa.dialogue_understanding.commands.error_command import ErrorCommand +from rasa.dialogue_understanding.commands.set_slot_command import SetSlotCommand +from rasa.dialogue_understanding.commands.start_flow_command import StartFlowCommand +from rasa.dialogue_understanding.commands.human_handoff_command import ( + HumanHandoffCommand, +) +from rasa.dialogue_understanding.commands.correct_slots_command import ( + CorrectSlotsCommand, + CorrectedSlot, +) + + +__all__ = [ + "Command", + "FreeFormAnswerCommand", + "CancelFlowCommand", + "KnowledgeAnswerCommand", + "ChitChatAnswerCommand", + "CannotHandleCommand", + "ClarifyCommand", + "ErrorCommand", + "SetSlotCommand", + "StartFlowCommand", + "HumanHandoffCommand", + "CorrectSlotsCommand", + "CorrectedSlot", +] diff --git a/rasa/cdu/commands/can_not_handle_command.py b/rasa/dialogue_understanding/commands/can_not_handle_command.py similarity index 95% rename from rasa/cdu/commands/can_not_handle_command.py rename to rasa/dialogue_understanding/commands/can_not_handle_command.py index 1316770b05fe..631cbe378ec4 100644 --- a/rasa/cdu/commands/can_not_handle_command.py +++ b/rasa/dialogue_understanding/commands/can_not_handle_command.py @@ -2,7 +2,7 @@ from dataclasses import dataclass from typing import Any, Dict, List -from rasa.cdu.commands import Command +from rasa.dialogue_understanding.commands import Command from rasa.shared.core.events import Event from rasa.shared.core.flows.flow import FlowsList from rasa.shared.core.trackers import DialogueStateTracker diff --git a/rasa/cdu/commands/cancel_flow_command.py b/rasa/dialogue_understanding/commands/cancel_flow_command.py similarity index 90% rename from rasa/cdu/commands/cancel_flow_command.py rename to rasa/dialogue_understanding/commands/cancel_flow_command.py index 9d75b89c6229..9a880111e7fe 100644 --- a/rasa/cdu/commands/cancel_flow_command.py +++ b/rasa/dialogue_understanding/commands/cancel_flow_command.py @@ -5,15 +5,15 @@ import structlog -from rasa.cdu.commands import Command -from rasa.cdu.patterns.cancel import CancelPatternFlowStackFrame -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames import UserFlowStackFrame +from rasa.dialogue_understanding.commands import Command +from rasa.dialogue_understanding.patterns.cancel import CancelPatternFlowStackFrame +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames import UserFlowStackFrame from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import Event, SlotSet from rasa.shared.core.flows.flow import FlowsList from rasa.shared.core.trackers import DialogueStateTracker -from rasa.cdu.stack.utils import top_user_flow_frame +from rasa.dialogue_understanding.stack.utils import top_user_flow_frame structlogger = structlog.get_logger() diff --git a/rasa/cdu/commands/chit_chat_answer_command.py b/rasa/dialogue_understanding/commands/chit_chat_answer_command.py similarity index 86% rename from rasa/cdu/commands/chit_chat_answer_command.py rename to rasa/dialogue_understanding/commands/chit_chat_answer_command.py index 74b75081a25a..38be12d210b8 100644 --- a/rasa/cdu/commands/chit_chat_answer_command.py +++ b/rasa/dialogue_understanding/commands/chit_chat_answer_command.py @@ -2,9 +2,9 @@ from dataclasses import dataclass from typing import Any, Dict, List -from rasa.cdu.commands import FreeFormAnswerCommand -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames.chit_chat_frame import ChitChatStackFrame +from rasa.dialogue_understanding.commands import FreeFormAnswerCommand +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames.chit_chat_frame import ChitChatStackFrame from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import Event, SlotSet from rasa.shared.core.flows.flow import FlowsList diff --git a/rasa/cdu/commands/clarify_command.py b/rasa/dialogue_understanding/commands/clarify_command.py similarity index 92% rename from rasa/cdu/commands/clarify_command.py rename to rasa/dialogue_understanding/commands/clarify_command.py index da60ba8b878c..69a413730e0f 100644 --- a/rasa/cdu/commands/clarify_command.py +++ b/rasa/dialogue_understanding/commands/clarify_command.py @@ -4,9 +4,9 @@ from typing import Any, Dict, List import structlog -from rasa.cdu.commands import Command -from rasa.cdu.patterns.clarify import ClarifyPatternFlowStackFrame -from rasa.cdu.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.commands import Command +from rasa.dialogue_understanding.patterns.clarify import ClarifyPatternFlowStackFrame +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import Event, SlotSet from rasa.shared.core.flows.flow import FlowsList diff --git a/rasa/cdu/commands/command.py b/rasa/dialogue_understanding/commands/command.py similarity index 100% rename from rasa/cdu/commands/command.py rename to rasa/dialogue_understanding/commands/command.py diff --git a/rasa/cdu/commands/correct_slots_command.py b/rasa/dialogue_understanding/commands/correct_slots_command.py similarity index 97% rename from rasa/cdu/commands/correct_slots_command.py rename to rasa/dialogue_understanding/commands/correct_slots_command.py index d68641a684b4..6c9a425ba084 100644 --- a/rasa/cdu/commands/correct_slots_command.py +++ b/rasa/dialogue_understanding/commands/correct_slots_command.py @@ -5,13 +5,13 @@ import structlog -from rasa.cdu.commands import Command -from rasa.cdu.patterns.correction import ( +from rasa.dialogue_understanding.commands import Command +from rasa.dialogue_understanding.patterns.correction import ( FLOW_PATTERN_CORRECTION_ID, CorrectionPatternFlowStackFrame, ) -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames.flow_stack_frame import ( +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames.flow_stack_frame import ( BaseFlowStackFrame, UserFlowStackFrame, ) @@ -19,7 +19,7 @@ from rasa.shared.core.events import Event, SlotSet from rasa.shared.core.flows.flow import END_STEP, ContinueFlowStep, FlowStep, FlowsList from rasa.shared.core.trackers import DialogueStateTracker -import rasa.cdu.stack.utils as utils +import rasa.dialogue_understanding.stack.utils as utils structlogger = structlog.get_logger() diff --git a/rasa/cdu/commands/error_command.py b/rasa/dialogue_understanding/commands/error_command.py similarity index 87% rename from rasa/cdu/commands/error_command.py rename to rasa/dialogue_understanding/commands/error_command.py index a7c25a7082ac..b5e62cb90d1c 100644 --- a/rasa/cdu/commands/error_command.py +++ b/rasa/dialogue_understanding/commands/error_command.py @@ -4,9 +4,11 @@ from typing import Any, Dict, List import structlog -from rasa.cdu.commands import Command -from rasa.cdu.patterns.internal_error import InternalErrorPatternFlowStackFrame -from rasa.cdu.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.commands import Command +from rasa.dialogue_understanding.patterns.internal_error import ( + InternalErrorPatternFlowStackFrame, +) +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import Event, SlotSet from rasa.shared.core.flows.flow import FlowsList diff --git a/rasa/cdu/commands/free_form_answer_command.py b/rasa/dialogue_understanding/commands/free_form_answer_command.py similarity index 73% rename from rasa/cdu/commands/free_form_answer_command.py rename to rasa/dialogue_understanding/commands/free_form_answer_command.py index 6dc38808c192..13bac7e5ff5c 100644 --- a/rasa/cdu/commands/free_form_answer_command.py +++ b/rasa/dialogue_understanding/commands/free_form_answer_command.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from rasa.cdu.commands import Command +from rasa.dialogue_understanding.commands import Command @dataclass diff --git a/rasa/cdu/commands/human_handoff_command.py b/rasa/dialogue_understanding/commands/human_handoff_command.py similarity index 95% rename from rasa/cdu/commands/human_handoff_command.py rename to rasa/dialogue_understanding/commands/human_handoff_command.py index 819a6e6f4c19..a91630018c50 100644 --- a/rasa/cdu/commands/human_handoff_command.py +++ b/rasa/dialogue_understanding/commands/human_handoff_command.py @@ -2,7 +2,7 @@ from dataclasses import dataclass from typing import Any, Dict, List -from rasa.cdu.commands import Command +from rasa.dialogue_understanding.commands import Command from rasa.shared.core.events import Event from rasa.shared.core.flows.flow import FlowsList from rasa.shared.core.trackers import DialogueStateTracker diff --git a/rasa/cdu/commands/knowledge_answer_command.py b/rasa/dialogue_understanding/commands/knowledge_answer_command.py similarity index 86% rename from rasa/cdu/commands/knowledge_answer_command.py rename to rasa/dialogue_understanding/commands/knowledge_answer_command.py index fa708cb1cb5c..3077dd44a739 100644 --- a/rasa/cdu/commands/knowledge_answer_command.py +++ b/rasa/dialogue_understanding/commands/knowledge_answer_command.py @@ -2,9 +2,9 @@ from dataclasses import dataclass from typing import Any, Dict, List -from rasa.cdu.commands import FreeFormAnswerCommand -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames.search_frame import SearchStackFrame +from rasa.dialogue_understanding.commands import FreeFormAnswerCommand +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames.search_frame import SearchStackFrame from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import Event, SlotSet from rasa.shared.core.flows.flow import FlowsList diff --git a/rasa/cdu/commands/set_slot_command.py b/rasa/dialogue_understanding/commands/set_slot_command.py similarity index 92% rename from rasa/cdu/commands/set_slot_command.py rename to rasa/dialogue_understanding/commands/set_slot_command.py index 136f89f60adc..c17bfea9c15f 100644 --- a/rasa/cdu/commands/set_slot_command.py +++ b/rasa/dialogue_understanding/commands/set_slot_command.py @@ -4,9 +4,9 @@ from typing import Any, Dict, List import structlog -from rasa.cdu.commands import Command -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.utils import filled_slots_for_active_flow +from rasa.dialogue_understanding.commands import Command +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.utils import filled_slots_for_active_flow from rasa.shared.core.events import Event, SlotSet from rasa.shared.core.flows.flow import FlowsList from rasa.shared.core.trackers import DialogueStateTracker diff --git a/rasa/cdu/commands/start_flow_command.py b/rasa/dialogue_understanding/commands/start_flow_command.py similarity index 89% rename from rasa/cdu/commands/start_flow_command.py rename to rasa/dialogue_understanding/commands/start_flow_command.py index fd559d989063..cb3cd5d5166a 100644 --- a/rasa/cdu/commands/start_flow_command.py +++ b/rasa/dialogue_understanding/commands/start_flow_command.py @@ -4,13 +4,16 @@ from typing import Any, Dict, List import structlog -from rasa.cdu.commands import Command -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames.flow_stack_frame import ( +from rasa.dialogue_understanding.commands import Command +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames.flow_stack_frame import ( FlowStackFrameType, UserFlowStackFrame, ) -from rasa.cdu.stack.utils import top_user_flow_frame, user_flows_on_the_stack +from rasa.dialogue_understanding.stack.utils import ( + top_user_flow_frame, + user_flows_on_the_stack, +) from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import Event, SlotSet from rasa.shared.core.flows.flow import FlowsList diff --git a/rasa/dialogue_understanding/generator/__init__.py b/rasa/dialogue_understanding/generator/__init__.py new file mode 100644 index 000000000000..8d4efbb2bc73 --- /dev/null +++ b/rasa/dialogue_understanding/generator/__init__.py @@ -0,0 +1,6 @@ +from rasa.dialogue_understanding.generator.command_generator import CommandGenerator +from rasa.dialogue_understanding.generator.llm_command_generator import ( + LLMCommandGenerator, +) + +__all__ = ["CommandGenerator", "LLMCommandGenerator"] diff --git a/rasa/cdu/generator/command_generator.py b/rasa/dialogue_understanding/generator/command_generator.py similarity index 97% rename from rasa/cdu/generator/command_generator.py rename to rasa/dialogue_understanding/generator/command_generator.py index 2a0e4b0e3e2a..3e87102061f7 100644 --- a/rasa/cdu/generator/command_generator.py +++ b/rasa/dialogue_understanding/generator/command_generator.py @@ -1,5 +1,5 @@ from typing import List, Optional -from rasa.cdu.commands import Command +from rasa.dialogue_understanding.commands import Command from rasa.shared.core.flows.flow import FlowsList from rasa.shared.core.trackers import DialogueStateTracker from rasa.shared.nlu.training_data.message import Message diff --git a/rasa/cdu/generator/command_prompt_template.jinja2 b/rasa/dialogue_understanding/generator/command_prompt_template.jinja2 similarity index 100% rename from rasa/cdu/generator/command_prompt_template.jinja2 rename to rasa/dialogue_understanding/generator/command_prompt_template.jinja2 diff --git a/rasa/cdu/generator/llm_command_generator.py b/rasa/dialogue_understanding/generator/llm_command_generator.py similarity index 98% rename from rasa/cdu/generator/llm_command_generator.py rename to rasa/dialogue_understanding/generator/llm_command_generator.py index 9a6bd14ac533..d4c4088c9d7a 100644 --- a/rasa/cdu/generator/llm_command_generator.py +++ b/rasa/dialogue_understanding/generator/llm_command_generator.py @@ -4,9 +4,9 @@ from jinja2 import Template import structlog -from rasa.cdu.stack.utils import top_flow_frame -from rasa.cdu.generator import CommandGenerator -from rasa.cdu.commands import ( +from rasa.dialogue_understanding.stack.utils import top_flow_frame +from rasa.dialogue_understanding.generator import CommandGenerator +from rasa.dialogue_understanding.commands import ( Command, ErrorCommand, SetSlotCommand, @@ -44,7 +44,7 @@ ) DEFAULT_COMMAND_PROMPT_TEMPLATE = importlib.resources.read_text( - "rasa.cdu.generator", "command_prompt_template.jinja2" + "rasa.dialogue_understanding.generator", "command_prompt_template.jinja2" ) structlogger = structlog.get_logger() diff --git a/rasa/cdu/generator/nlu_command_adapter.py b/rasa/dialogue_understanding/generator/nlu_command_adapter.py similarity index 100% rename from rasa/cdu/generator/nlu_command_adapter.py rename to rasa/dialogue_understanding/generator/nlu_command_adapter.py diff --git a/rasa/cdu/patterns/__init__.py b/rasa/dialogue_understanding/patterns/__init__.py similarity index 100% rename from rasa/cdu/patterns/__init__.py rename to rasa/dialogue_understanding/patterns/__init__.py diff --git a/rasa/cdu/patterns/cancel.py b/rasa/dialogue_understanding/patterns/cancel.py similarity index 95% rename from rasa/cdu/patterns/cancel.py rename to rasa/dialogue_understanding/patterns/cancel.py index 0a11d02c4f18..fa1eda6316c4 100644 --- a/rasa/cdu/patterns/cancel.py +++ b/rasa/dialogue_understanding/patterns/cancel.py @@ -4,10 +4,13 @@ from typing import Any, Dict, List, Optional import structlog -from rasa.cdu.stack.dialogue_stack import ( +from rasa.dialogue_understanding.stack.dialogue_stack import ( DialogueStack, ) -from rasa.cdu.stack.frames import PatternFlowStackFrame, BaseFlowStackFrame +from rasa.dialogue_understanding.stack.frames import ( + PatternFlowStackFrame, + BaseFlowStackFrame, +) from rasa.core.actions import action from rasa.core.channels.channel import OutputChannel from rasa.core.nlg.generator import NaturalLanguageGenerator diff --git a/rasa/cdu/patterns/clarify.py b/rasa/dialogue_understanding/patterns/clarify.py similarity index 96% rename from rasa/cdu/patterns/clarify.py rename to rasa/dialogue_understanding/patterns/clarify.py index ddc238e501e3..4a7b1df074f0 100644 --- a/rasa/cdu/patterns/clarify.py +++ b/rasa/dialogue_understanding/patterns/clarify.py @@ -4,10 +4,10 @@ from typing import Any, Dict, List, Optional import structlog -from rasa.cdu.stack.dialogue_stack import ( +from rasa.dialogue_understanding.stack.dialogue_stack import ( DialogueStack, ) -from rasa.cdu.stack.frames import PatternFlowStackFrame +from rasa.dialogue_understanding.stack.frames import PatternFlowStackFrame from rasa.core.actions import action from rasa.core.channels.channel import OutputChannel from rasa.core.nlg.generator import NaturalLanguageGenerator diff --git a/rasa/cdu/patterns/collect_information.py b/rasa/dialogue_understanding/patterns/collect_information.py similarity index 93% rename from rasa/cdu/patterns/collect_information.py rename to rasa/dialogue_understanding/patterns/collect_information.py index 9b8b70146d40..86442c6edc8b 100644 --- a/rasa/cdu/patterns/collect_information.py +++ b/rasa/dialogue_understanding/patterns/collect_information.py @@ -2,9 +2,9 @@ from dataclasses import dataclass from typing import Any, Dict, List -from rasa.cdu.stack.dialogue_stack import DialogueStackFrame +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStackFrame from rasa.shared.constants import RASA_DEFAULT_FLOW_PATTERN_PREFIX -from rasa.cdu.stack.frames import PatternFlowStackFrame +from rasa.dialogue_understanding.stack.frames import PatternFlowStackFrame FLOW_PATTERN_COLLECT_INFORMATION = ( RASA_DEFAULT_FLOW_PATTERN_PREFIX + "ask_collect_information" diff --git a/rasa/cdu/patterns/completed.py b/rasa/dialogue_understanding/patterns/completed.py similarity index 94% rename from rasa/cdu/patterns/completed.py rename to rasa/dialogue_understanding/patterns/completed.py index ff6a080f3c54..5852be45c1d8 100644 --- a/rasa/cdu/patterns/completed.py +++ b/rasa/dialogue_understanding/patterns/completed.py @@ -3,7 +3,7 @@ from dataclasses import dataclass from typing import Any, Dict from rasa.shared.constants import RASA_DEFAULT_FLOW_PATTERN_PREFIX -from rasa.cdu.stack.frames import PatternFlowStackFrame +from rasa.dialogue_understanding.stack.frames import PatternFlowStackFrame FLOW_PATTERN_COMPLETED = RASA_DEFAULT_FLOW_PATTERN_PREFIX + "completed" diff --git a/rasa/cdu/patterns/continue_interrupted.py b/rasa/dialogue_understanding/patterns/continue_interrupted.py similarity index 94% rename from rasa/cdu/patterns/continue_interrupted.py rename to rasa/dialogue_understanding/patterns/continue_interrupted.py index 5e66196cab57..1137408c8383 100644 --- a/rasa/cdu/patterns/continue_interrupted.py +++ b/rasa/dialogue_understanding/patterns/continue_interrupted.py @@ -3,7 +3,7 @@ from dataclasses import dataclass from typing import Any, Dict from rasa.shared.constants import RASA_DEFAULT_FLOW_PATTERN_PREFIX -from rasa.cdu.stack.frames import PatternFlowStackFrame +from rasa.dialogue_understanding.stack.frames import PatternFlowStackFrame FLOW_PATTERN_CONTINUE_INTERRUPTED = ( diff --git a/rasa/cdu/patterns/correction.py b/rasa/dialogue_understanding/patterns/correction.py similarity index 95% rename from rasa/cdu/patterns/correction.py rename to rasa/dialogue_understanding/patterns/correction.py index a258a4e7d6a9..e8626fa6ff20 100644 --- a/rasa/cdu/patterns/correction.py +++ b/rasa/dialogue_understanding/patterns/correction.py @@ -2,10 +2,10 @@ from dataclasses import dataclass, field from typing import Any, Dict, Text, List, Optional -from rasa.cdu.patterns.collect_information import ( +from rasa.dialogue_understanding.patterns.collect_information import ( CollectInformationPatternFlowStackFrame, ) -from rasa.cdu.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack from rasa.shared.constants import RASA_DEFAULT_FLOW_PATTERN_PREFIX from rasa.shared.core.constants import ( DIALOGUE_STACK_SLOT, @@ -19,7 +19,7 @@ import structlog from rasa.core.actions import action from rasa.core.channels import OutputChannel -from rasa.cdu.stack.frames import ( +from rasa.dialogue_understanding.stack.frames import ( BaseFlowStackFrame, PatternFlowStackFrame, ) diff --git a/rasa/cdu/patterns/default_flows_for_patterns.yml b/rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml similarity index 100% rename from rasa/cdu/patterns/default_flows_for_patterns.yml rename to rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml diff --git a/rasa/cdu/patterns/internal_error.py b/rasa/dialogue_understanding/patterns/internal_error.py similarity index 93% rename from rasa/cdu/patterns/internal_error.py rename to rasa/dialogue_understanding/patterns/internal_error.py index fe57d6be9c7e..405953d9cf06 100644 --- a/rasa/cdu/patterns/internal_error.py +++ b/rasa/dialogue_understanding/patterns/internal_error.py @@ -3,7 +3,7 @@ from rasa.shared.constants import RASA_DEFAULT_FLOW_PATTERN_PREFIX from dataclasses import dataclass from typing import Any, Dict -from rasa.cdu.stack.frames import PatternFlowStackFrame +from rasa.dialogue_understanding.stack.frames import PatternFlowStackFrame FLOW_PATTERN_INTERNAL_ERROR_ID = RASA_DEFAULT_FLOW_PATTERN_PREFIX + "internal_error" diff --git a/rasa/cdu/processor/__init__.py b/rasa/dialogue_understanding/processor/__init__.py similarity index 100% rename from rasa/cdu/processor/__init__.py rename to rasa/dialogue_understanding/processor/__init__.py diff --git a/rasa/cdu/processor/command_processor.py b/rasa/dialogue_understanding/processor/command_processor.py similarity index 95% rename from rasa/cdu/processor/command_processor.py rename to rasa/dialogue_understanding/processor/command_processor.py index c258b0255a9d..c9919900b448 100644 --- a/rasa/cdu/processor/command_processor.py +++ b/rasa/dialogue_understanding/processor/command_processor.py @@ -1,7 +1,7 @@ from typing import List, Optional, Type import structlog -from rasa.cdu.commands import ( +from rasa.dialogue_understanding.commands import ( CancelFlowCommand, Command, CorrectSlotsCommand, @@ -9,17 +9,20 @@ SetSlotCommand, FreeFormAnswerCommand, ) -from rasa.cdu.patterns.collect_information import ( +from rasa.dialogue_understanding.patterns.collect_information import ( CollectInformationPatternFlowStackFrame, ) -from rasa.cdu.patterns.correction import ( +from rasa.dialogue_understanding.patterns.correction import ( CorrectionPatternFlowStackFrame, ) -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames import ( +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames import ( BaseFlowStackFrame, ) -from rasa.cdu.stack.utils import filled_slots_for_active_flow, top_flow_frame +from rasa.dialogue_understanding.stack.utils import ( + filled_slots_for_active_flow, + top_flow_frame, +) from rasa.shared.core.events import Event, SlotSet from rasa.shared.core.flows.flow import ( FlowsList, diff --git a/rasa/cdu/processor/command_processor_component.py b/rasa/dialogue_understanding/processor/command_processor_component.py similarity index 92% rename from rasa/cdu/processor/command_processor_component.py rename to rasa/dialogue_understanding/processor/command_processor_component.py index 38ff56890f7f..e557ab2c83c8 100644 --- a/rasa/cdu/processor/command_processor_component.py +++ b/rasa/dialogue_understanding/processor/command_processor_component.py @@ -1,7 +1,7 @@ from __future__ import annotations from typing import Any, Dict, List, Text -from rasa.cdu.processor.command_processor import execute_commands +from rasa.dialogue_understanding.processor.command_processor import execute_commands from rasa.engine.graph import ExecutionContext, GraphComponent from rasa.engine.storage.resource import Resource diff --git a/rasa/cdu/stack/__init__.py b/rasa/dialogue_understanding/stack/__init__.py similarity index 100% rename from rasa/cdu/stack/__init__.py rename to rasa/dialogue_understanding/stack/__init__.py diff --git a/rasa/cdu/stack/dialogue_stack.py b/rasa/dialogue_understanding/stack/dialogue_stack.py similarity index 98% rename from rasa/cdu/stack/dialogue_stack.py rename to rasa/dialogue_understanding/stack/dialogue_stack.py index 9b18ed64e4cb..5059b919523d 100644 --- a/rasa/cdu/stack/dialogue_stack.py +++ b/rasa/dialogue_understanding/stack/dialogue_stack.py @@ -2,7 +2,7 @@ from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional -from rasa.cdu.stack.frames import DialogueStackFrame +from rasa.dialogue_understanding.stack.frames import DialogueStackFrame from rasa.shared.core.constants import ( DIALOGUE_STACK_SLOT, ) diff --git a/rasa/dialogue_understanding/stack/frames/__init__.py b/rasa/dialogue_understanding/stack/frames/__init__.py new file mode 100644 index 000000000000..57bdfa9ce178 --- /dev/null +++ b/rasa/dialogue_understanding/stack/frames/__init__.py @@ -0,0 +1,19 @@ +from rasa.dialogue_understanding.stack.frames.dialogue_stack_frame import ( + DialogueStackFrame, +) +from rasa.dialogue_understanding.stack.frames.flow_stack_frame import ( + UserFlowStackFrame, + BaseFlowStackFrame, +) +from rasa.dialogue_understanding.stack.frames.pattern_frame import PatternFlowStackFrame +from rasa.dialogue_understanding.stack.frames.search_frame import SearchStackFrame +from rasa.dialogue_understanding.stack.frames.chit_chat_frame import ChitChatStackFrame + +__all__ = [ + "DialogueStackFrame", + "BaseFlowStackFrame", + "PatternFlowStackFrame", + "UserFlowStackFrame", + "SearchStackFrame", + "ChitChatStackFrame", +] diff --git a/rasa/cdu/stack/frames/chit_chat_frame.py b/rasa/dialogue_understanding/stack/frames/chit_chat_frame.py similarity index 90% rename from rasa/cdu/stack/frames/chit_chat_frame.py rename to rasa/dialogue_understanding/stack/frames/chit_chat_frame.py index 42cf4af0482a..27e05583066b 100644 --- a/rasa/cdu/stack/frames/chit_chat_frame.py +++ b/rasa/dialogue_understanding/stack/frames/chit_chat_frame.py @@ -2,7 +2,7 @@ from dataclasses import dataclass from typing import Any, Dict -from rasa.cdu.stack.frames import DialogueStackFrame +from rasa.dialogue_understanding.stack.frames import DialogueStackFrame @dataclass diff --git a/rasa/cdu/stack/frames/dialogue_stack_frame.py b/rasa/dialogue_understanding/stack/frames/dialogue_stack_frame.py similarity index 100% rename from rasa/cdu/stack/frames/dialogue_stack_frame.py rename to rasa/dialogue_understanding/stack/frames/dialogue_stack_frame.py diff --git a/rasa/cdu/stack/frames/flow_stack_frame.py b/rasa/dialogue_understanding/stack/frames/flow_stack_frame.py similarity index 98% rename from rasa/cdu/stack/frames/flow_stack_frame.py rename to rasa/dialogue_understanding/stack/frames/flow_stack_frame.py index fa0064cccc12..ceeb4d5bfe39 100644 --- a/rasa/cdu/stack/frames/flow_stack_frame.py +++ b/rasa/dialogue_understanding/stack/frames/flow_stack_frame.py @@ -3,7 +3,7 @@ from enum import Enum from typing import Any, Dict, Optional -from rasa.cdu.stack.frames import DialogueStackFrame +from rasa.dialogue_understanding.stack.frames import DialogueStackFrame from rasa.shared.core.flows.flow import START_STEP, Flow, FlowStep, FlowsList from rasa.shared.exceptions import RasaException diff --git a/rasa/cdu/stack/frames/pattern_frame.py b/rasa/dialogue_understanding/stack/frames/pattern_frame.py similarity index 69% rename from rasa/cdu/stack/frames/pattern_frame.py rename to rasa/dialogue_understanding/stack/frames/pattern_frame.py index 3e7594b03994..54e10f2f688e 100644 --- a/rasa/cdu/stack/frames/pattern_frame.py +++ b/rasa/dialogue_understanding/stack/frames/pattern_frame.py @@ -1,6 +1,6 @@ from dataclasses import dataclass -from rasa.cdu.stack.frames import BaseFlowStackFrame +from rasa.dialogue_understanding.stack.frames import BaseFlowStackFrame @dataclass diff --git a/rasa/cdu/stack/frames/search_frame.py b/rasa/dialogue_understanding/stack/frames/search_frame.py similarity index 90% rename from rasa/cdu/stack/frames/search_frame.py rename to rasa/dialogue_understanding/stack/frames/search_frame.py index 68ea6c0c04c2..efa7aa0bd14e 100644 --- a/rasa/cdu/stack/frames/search_frame.py +++ b/rasa/dialogue_understanding/stack/frames/search_frame.py @@ -2,7 +2,7 @@ from dataclasses import dataclass from typing import Any, Dict -from rasa.cdu.stack.frames import DialogueStackFrame +from rasa.dialogue_understanding.stack.frames import DialogueStackFrame @dataclass diff --git a/rasa/cdu/stack/utils.py b/rasa/dialogue_understanding/stack/utils.py similarity index 92% rename from rasa/cdu/stack/utils.py rename to rasa/dialogue_understanding/stack/utils.py index 744f0de08e49..144638e2b71e 100644 --- a/rasa/cdu/stack/utils.py +++ b/rasa/dialogue_understanding/stack/utils.py @@ -1,10 +1,10 @@ from typing import Optional, Set -from rasa.cdu.patterns.collect_information import ( +from rasa.dialogue_understanding.patterns.collect_information import ( CollectInformationPatternFlowStackFrame, ) -from rasa.cdu.stack.frames import BaseFlowStackFrame -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames import UserFlowStackFrame +from rasa.dialogue_understanding.stack.frames import BaseFlowStackFrame +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames import UserFlowStackFrame from rasa.shared.core.flows.flow import FlowsList diff --git a/rasa/engine/recipes/default_components.py b/rasa/engine/recipes/default_components.py index 9d46707d9345..11c2212cc41f 100644 --- a/rasa/engine/recipes/default_components.py +++ b/rasa/engine/recipes/default_components.py @@ -1,7 +1,9 @@ from rasa.nlu.classifiers.diet_classifier import DIETClassifier from rasa.nlu.classifiers.fallback_classifier import FallbackClassifier from rasa.nlu.classifiers.keyword_intent_classifier import KeywordIntentClassifier -from rasa.cdu.generator.llm_command_generator import LLMCommandGenerator +from rasa.dialogue_understanding.generator.llm_command_generator import ( + LLMCommandGenerator, +) from rasa.nlu.classifiers.logistic_regression_classifier import ( LogisticRegressionClassifier, ) diff --git a/rasa/engine/recipes/default_recipe.py b/rasa/engine/recipes/default_recipe.py index 13153ab70a65..ca47bf658fbd 100644 --- a/rasa/engine/recipes/default_recipe.py +++ b/rasa/engine/recipes/default_recipe.py @@ -14,7 +14,9 @@ CoreFeaturizationCollector, ) from rasa.graph_components.providers.flows_provider import FlowsProvider -from rasa.cdu.processor.command_processor_component import CommandProcessorComponent +from rasa.dialogue_understanding.processor.command_processor_component import ( + CommandProcessorComponent, +) from rasa.plugin import plugin_manager from rasa.shared.exceptions import FileNotFoundException from rasa.core.policies.ensemble import DefaultPolicyPredictionEnsemble diff --git a/rasa/shared/importers/importer.py b/rasa/shared/importers/importer.py index 09a45aff359c..a03c92298940 100644 --- a/rasa/shared/importers/importer.py +++ b/rasa/shared/importers/importer.py @@ -391,7 +391,7 @@ def load_default_pattern_flows() -> FlowsList: from rasa.shared.core.flows.yaml_flows_io import YAMLFlowsReader default_flows_file = pkg_resources.resource_filename( - "rasa.cdu.patterns", DEFAULT_PATTERN_FLOWS_FILE_NAME + "rasa.dialogue_understanding.patterns", DEFAULT_PATTERN_FLOWS_FILE_NAME ) return YAMLFlowsReader.read_from_file(default_flows_file) @@ -400,7 +400,7 @@ def load_default_pattern_flows() -> FlowsList: def load_default_pattern_flows_domain() -> Domain: """Loads the default flows from the file system.""" default_flows_file = pkg_resources.resource_filename( - "rasa.cdu.patterns", DEFAULT_PATTERN_FLOWS_FILE_NAME + "rasa.dialogue_understanding.patterns", DEFAULT_PATTERN_FLOWS_FILE_NAME ) return Domain.from_path(default_flows_file) diff --git a/tests/cdu/commands/test_can_not_handle_command.py b/tests/cdu/commands/test_can_not_handle_command.py index 84f2df134b1d..d0aa676f020a 100644 --- a/tests/cdu/commands/test_can_not_handle_command.py +++ b/tests/cdu/commands/test_can_not_handle_command.py @@ -1,4 +1,6 @@ -from rasa.cdu.commands.can_not_handle_command import CannotHandleCommand +from rasa.dialogue_understanding.commands.can_not_handle_command import ( + CannotHandleCommand, +) from rasa.shared.core.events import UserUttered from rasa.shared.core.trackers import DialogueStateTracker diff --git a/tests/cdu/commands/test_cancel_flow_command.py b/tests/cdu/commands/test_cancel_flow_command.py index 58b290d217eb..0aa2ea74113a 100644 --- a/tests/cdu/commands/test_cancel_flow_command.py +++ b/tests/cdu/commands/test_cancel_flow_command.py @@ -1,10 +1,10 @@ import pytest -from rasa.cdu.commands.cancel_flow_command import CancelFlowCommand -from rasa.cdu.patterns.collect_information import ( +from rasa.dialogue_understanding.commands.cancel_flow_command import CancelFlowCommand +from rasa.dialogue_understanding.patterns.collect_information import ( CollectInformationPatternFlowStackFrame, ) -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames.flow_stack_frame import UserFlowStackFrame +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames.flow_stack_frame import UserFlowStackFrame from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import SlotSet from rasa.shared.core.trackers import DialogueStateTracker diff --git a/tests/cdu/commands/test_chit_chat_answer_command.py b/tests/cdu/commands/test_chit_chat_answer_command.py index e2a42bbfc4f4..b222f91780af 100644 --- a/tests/cdu/commands/test_chit_chat_answer_command.py +++ b/tests/cdu/commands/test_chit_chat_answer_command.py @@ -1,4 +1,6 @@ -from rasa.cdu.commands.chit_chat_answer_command import ChitChatAnswerCommand +from rasa.dialogue_understanding.commands.chit_chat_answer_command import ( + ChitChatAnswerCommand, +) from rasa.shared.core.events import SlotSet, UserUttered from rasa.shared.core.trackers import DialogueStateTracker diff --git a/tests/cdu/commands/test_clarify_command.py b/tests/cdu/commands/test_clarify_command.py index 47af776f8a5a..3dba7a707d1e 100644 --- a/tests/cdu/commands/test_clarify_command.py +++ b/tests/cdu/commands/test_clarify_command.py @@ -1,5 +1,5 @@ import pytest -from rasa.cdu.commands.clarify_command import ClarifyCommand +from rasa.dialogue_understanding.commands.clarify_command import ClarifyCommand from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import SlotSet from rasa.shared.core.trackers import DialogueStateTracker diff --git a/tests/cdu/commands/test_command.py b/tests/cdu/commands/test_command.py index a78eb367a28a..7235e23af7ca 100644 --- a/tests/cdu/commands/test_command.py +++ b/tests/cdu/commands/test_command.py @@ -1,6 +1,6 @@ import pytest -from rasa.cdu.commands.command import Command -from rasa.cdu.commands.set_slot_command import SetSlotCommand +from rasa.dialogue_understanding.commands.command import Command +from rasa.dialogue_understanding.commands.set_slot_command import SetSlotCommand def test_command_from_json(): diff --git a/tests/cdu/commands/test_correct_slots_command.py b/tests/cdu/commands/test_correct_slots_command.py index 5ce56eb8c8da..a0d5e8ef130d 100644 --- a/tests/cdu/commands/test_correct_slots_command.py +++ b/tests/cdu/commands/test_correct_slots_command.py @@ -1,12 +1,17 @@ from typing import Any, Dict, List import pytest -from rasa.cdu.commands.correct_slots_command import CorrectSlotsCommand, CorrectedSlot -from rasa.cdu.patterns.collect_information import ( +from rasa.dialogue_understanding.commands.correct_slots_command import ( + CorrectSlotsCommand, + CorrectedSlot, +) +from rasa.dialogue_understanding.patterns.collect_information import ( CollectInformationPatternFlowStackFrame, ) -from rasa.cdu.patterns.correction import CorrectionPatternFlowStackFrame -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames.flow_stack_frame import UserFlowStackFrame +from rasa.dialogue_understanding.patterns.correction import ( + CorrectionPatternFlowStackFrame, +) +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames.flow_stack_frame import UserFlowStackFrame from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import SlotSet from rasa.shared.core.trackers import DialogueStateTracker diff --git a/tests/cdu/commands/test_error_command.py b/tests/cdu/commands/test_error_command.py index 10e09157d736..187b4d37e98f 100644 --- a/tests/cdu/commands/test_error_command.py +++ b/tests/cdu/commands/test_error_command.py @@ -1,4 +1,4 @@ -from rasa.cdu.commands.error_command import ErrorCommand +from rasa.dialogue_understanding.commands.error_command import ErrorCommand from rasa.shared.core.events import SlotSet, UserUttered from rasa.shared.core.trackers import DialogueStateTracker diff --git a/tests/cdu/commands/test_human_handoff_command.py b/tests/cdu/commands/test_human_handoff_command.py index 3f9f0030a5fd..df4e274fbe28 100644 --- a/tests/cdu/commands/test_human_handoff_command.py +++ b/tests/cdu/commands/test_human_handoff_command.py @@ -1,4 +1,6 @@ -from rasa.cdu.commands.human_handoff_command import HumanHandoffCommand +from rasa.dialogue_understanding.commands.human_handoff_command import ( + HumanHandoffCommand, +) from rasa.shared.core.events import UserUttered from rasa.shared.core.trackers import DialogueStateTracker diff --git a/tests/cdu/commands/test_konwledge_answer_command.py b/tests/cdu/commands/test_konwledge_answer_command.py index 0ea12650df5e..6aa407f5e35e 100644 --- a/tests/cdu/commands/test_konwledge_answer_command.py +++ b/tests/cdu/commands/test_konwledge_answer_command.py @@ -1,4 +1,6 @@ -from rasa.cdu.commands.knowledge_answer_command import KnowledgeAnswerCommand +from rasa.dialogue_understanding.commands.knowledge_answer_command import ( + KnowledgeAnswerCommand, +) from rasa.shared.core.events import SlotSet, UserUttered from rasa.shared.core.trackers import DialogueStateTracker diff --git a/tests/cdu/commands/test_set_slot_command.py b/tests/cdu/commands/test_set_slot_command.py index 00443cc06024..84e3867c2c0c 100644 --- a/tests/cdu/commands/test_set_slot_command.py +++ b/tests/cdu/commands/test_set_slot_command.py @@ -1,5 +1,5 @@ import pytest -from rasa.cdu.commands.set_slot_command import SetSlotCommand +from rasa.dialogue_understanding.commands.set_slot_command import SetSlotCommand from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import SlotSet from rasa.shared.core.flows.flow import FlowsList diff --git a/tests/cdu/commands/test_start_flow_command.py b/tests/cdu/commands/test_start_flow_command.py index f220421e136e..2ac2895b44d1 100644 --- a/tests/cdu/commands/test_start_flow_command.py +++ b/tests/cdu/commands/test_start_flow_command.py @@ -1,5 +1,5 @@ import pytest -from rasa.cdu.commands.start_flow_command import StartFlowCommand +from rasa.dialogue_understanding.commands.start_flow_command import StartFlowCommand from rasa.shared.core.constants import DIALOGUE_STACK_SLOT from rasa.shared.core.events import SlotSet from rasa.shared.core.trackers import DialogueStateTracker diff --git a/tests/cdu/stack/frames/test_chit_chat_frame.py b/tests/cdu/stack/frames/test_chit_chat_frame.py index 6adb5a699a2d..7e74ad1c87ad 100644 --- a/tests/cdu/stack/frames/test_chit_chat_frame.py +++ b/tests/cdu/stack/frames/test_chit_chat_frame.py @@ -1,4 +1,4 @@ -from rasa.cdu.stack.frames.chit_chat_frame import ChitChatStackFrame +from rasa.dialogue_understanding.stack.frames.chit_chat_frame import ChitChatStackFrame def test_chit_chat_frame_type(): diff --git a/tests/cdu/stack/frames/test_dialogue_stack_frame.py b/tests/cdu/stack/frames/test_dialogue_stack_frame.py index dc367e2f204a..155791aca2f9 100644 --- a/tests/cdu/stack/frames/test_dialogue_stack_frame.py +++ b/tests/cdu/stack/frames/test_dialogue_stack_frame.py @@ -2,7 +2,7 @@ from typing import Any, Dict import pytest -from rasa.cdu.stack.frames.dialogue_stack_frame import ( +from rasa.dialogue_understanding.stack.frames.dialogue_stack_frame import ( DialogueStackFrame, InvalidStackFrameType, generate_stack_frame_id, diff --git a/tests/cdu/stack/frames/test_flow_frame.py b/tests/cdu/stack/frames/test_flow_frame.py index 2e9fa8fd1221..3cf75fc4c96d 100644 --- a/tests/cdu/stack/frames/test_flow_frame.py +++ b/tests/cdu/stack/frames/test_flow_frame.py @@ -1,5 +1,5 @@ import pytest -from rasa.cdu.stack.frames.flow_stack_frame import ( +from rasa.dialogue_understanding.stack.frames.flow_stack_frame import ( InvalidFlowIdException, InvalidFlowStackFrameType, InvalidFlowStepIdException, diff --git a/tests/cdu/stack/frames/test_search_frame.py b/tests/cdu/stack/frames/test_search_frame.py index 4e13118a29a7..249fc7e7697e 100644 --- a/tests/cdu/stack/frames/test_search_frame.py +++ b/tests/cdu/stack/frames/test_search_frame.py @@ -1,4 +1,4 @@ -from rasa.cdu.stack.frames.search_frame import SearchStackFrame +from rasa.dialogue_understanding.stack.frames.search_frame import SearchStackFrame def test_search_frame_type(): diff --git a/tests/cdu/stack/test_dialogue_stack.py b/tests/cdu/stack/test_dialogue_stack.py index c510f3626dbf..c5f36a3d0521 100644 --- a/tests/cdu/stack/test_dialogue_stack.py +++ b/tests/cdu/stack/test_dialogue_stack.py @@ -1,9 +1,9 @@ import dataclasses -from rasa.cdu.patterns.collect_information import ( +from rasa.dialogue_understanding.patterns.collect_information import ( CollectInformationPatternFlowStackFrame, ) -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames.flow_stack_frame import UserFlowStackFrame +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames.flow_stack_frame import UserFlowStackFrame def test_dialogue_stack_from_dict(): diff --git a/tests/cdu/stack/test_utils.py b/tests/cdu/stack/test_utils.py index 3b3adb8587aa..984be9ffc3b7 100644 --- a/tests/cdu/stack/test_utils.py +++ b/tests/cdu/stack/test_utils.py @@ -1,10 +1,10 @@ -from rasa.cdu.patterns.collect_information import ( +from rasa.dialogue_understanding.patterns.collect_information import ( CollectInformationPatternFlowStackFrame, ) -from rasa.cdu.stack.dialogue_stack import DialogueStack -from rasa.cdu.stack.frames.chit_chat_frame import ChitChatStackFrame -from rasa.cdu.stack.frames.flow_stack_frame import UserFlowStackFrame -from rasa.cdu.stack.utils import ( +from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack +from rasa.dialogue_understanding.stack.frames.chit_chat_frame import ChitChatStackFrame +from rasa.dialogue_understanding.stack.frames.flow_stack_frame import UserFlowStackFrame +from rasa.dialogue_understanding.stack.utils import ( filled_slots_for_active_flow, top_flow_frame, top_user_flow_frame,