Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass NLU pipeline when message is /intent or /intent + entities - [ENG 286] #12480

Merged
merged 17 commits into from
Jun 22, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions rasa/core/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,17 @@
import rasa.core.actions.action
import rasa.shared.core.trackers
from rasa.shared.core.trackers import DialogueStateTracker, EventVerbosity
from rasa.shared.core.training_data.story_reader.yaml_story_reader import (
YAMLStoryReader,
)
from rasa.shared.nlu.constants import (
ENTITIES,
INTENT,
INTENT_NAME_KEY,
PREDICTED_CONFIDENCE_KEY,
TEXT,
)
from rasa.shared.nlu.training_data.message import Message
from rasa.utils.endpoints import EndpointConfig

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -682,8 +686,23 @@ async def parse_message(
if self.http_interpreter:
parse_data = await self.http_interpreter.parse(message)
else:
parse_data = self._parse_message_with_graph(message, only_output_properties)

msg = YAMLStoryReader.unpack_regex_message(
message=Message({TEXT: message.text})
)
# Intent is not explicitly present. Pass message to graph.
if msg.data.get(INTENT) is None:
parse_data = self._parse_message_with_graph(
message, only_output_properties
)
else:
parse_data = {
TEXT: "",
INTENT: {INTENT_NAME_KEY: None, PREDICTED_CONFIDENCE_KEY: 0.0},
ENTITIES: [],
}
parse_data.update(
msg.as_dict(only_output_properties=only_output_properties)
)
logger.debug(
"Received user message '{}' with intent '{}' "
"and entities '{}'".format(
Expand Down