-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dm2' into ATO-1315-improve-yaml-…
…validation
- Loading branch information
Showing
41 changed files
with
575 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is a test prompt. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from typing import Optional, Dict, Any, List | ||
|
||
from rasa.core.actions.action import Action | ||
from rasa.core.channels import OutputChannel | ||
from rasa.core.nlg import NaturalLanguageGenerator | ||
from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack | ||
from rasa.dialogue_understanding.stack.frames import ChitChatStackFrame | ||
from rasa.shared.core.constants import ACTION_TRIGGER_CHITCHAT | ||
from rasa.shared.core.domain import Domain | ||
from rasa.shared.core.events import Event | ||
from rasa.shared.core.trackers import DialogueStateTracker | ||
|
||
|
||
class ActionTriggerChitchat(Action): | ||
"""Action which triggers a chitchat answer.""" | ||
|
||
def name(self) -> str: | ||
"""Return the name of the action.""" | ||
return ACTION_TRIGGER_CHITCHAT | ||
|
||
async def run( | ||
self, | ||
output_channel: OutputChannel, | ||
nlg: NaturalLanguageGenerator, | ||
tracker: DialogueStateTracker, | ||
domain: Domain, | ||
metadata: Optional[Dict[str, Any]] = None, | ||
) -> List[Event]: | ||
"""Run the predicate checks.""" | ||
dialogue_stack = DialogueStack.from_tracker(tracker) | ||
dialogue_stack.push(ChitChatStackFrame()) | ||
return [dialogue_stack.persist_as_event()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from typing import Optional, Dict, Any, List | ||
|
||
from rasa.core.actions.action import Action | ||
from rasa.core.channels import OutputChannel | ||
from rasa.core.nlg import NaturalLanguageGenerator | ||
from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack | ||
from rasa.dialogue_understanding.stack.frames import SearchStackFrame | ||
from rasa.shared.core.constants import ACTION_TRIGGER_SEARCH | ||
from rasa.shared.core.domain import Domain | ||
from rasa.shared.core.events import Event | ||
from rasa.shared.core.trackers import DialogueStateTracker | ||
|
||
|
||
class ActionTriggerSearch(Action): | ||
"""Action which triggers a search""" | ||
|
||
def name(self) -> str: | ||
"""Return the name of the action.""" | ||
return ACTION_TRIGGER_SEARCH | ||
|
||
async def run( | ||
self, | ||
output_channel: OutputChannel, | ||
nlg: NaturalLanguageGenerator, | ||
tracker: DialogueStateTracker, | ||
domain: Domain, | ||
metadata: Optional[Dict[str, Any]] = None, | ||
) -> List[Event]: | ||
"""Run the predicate checks.""" | ||
dialogue_stack = DialogueStack.from_tracker(tracker) | ||
dialogue_stack.push(SearchStackFrame()) | ||
return [dialogue_stack.persist_as_event()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
from typing import Any, Dict | ||
from rasa.shared.constants import RASA_DEFAULT_FLOW_PATTERN_PREFIX | ||
from rasa.dialogue_understanding.stack.frames import PatternFlowStackFrame | ||
|
||
|
||
FLOW_PATTERN_CHITCHAT = RASA_DEFAULT_FLOW_PATTERN_PREFIX + "chitchat" | ||
|
||
|
||
@dataclass | ||
class ChitchatPatternFlowStackFrame(PatternFlowStackFrame): | ||
"""A flow stack frame that gets added to respond to Chitchat.""" | ||
|
||
flow_id: str = FLOW_PATTERN_CHITCHAT | ||
"""The ID of the flow.""" | ||
|
||
@classmethod | ||
def type(cls) -> str: | ||
"""Returns the type of the frame.""" | ||
return FLOW_PATTERN_CHITCHAT | ||
|
||
@staticmethod | ||
def from_dict(data: Dict[str, Any]) -> ChitchatPatternFlowStackFrame: | ||
"""Creates a `DialogueStackFrame` from a dictionary. | ||
Args: | ||
data: The dictionary to create the `DialogueStackFrame` from. | ||
Returns: | ||
The created `DialogueStackFrame`. | ||
""" | ||
return ChitchatPatternFlowStackFrame( | ||
frame_id=data["frame_id"], | ||
step_id=data["step_id"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
from typing import Any, Dict | ||
from rasa.shared.constants import RASA_DEFAULT_FLOW_PATTERN_PREFIX | ||
from rasa.dialogue_understanding.stack.frames import PatternFlowStackFrame | ||
|
||
|
||
FLOW_PATTERN_SEARCH = RASA_DEFAULT_FLOW_PATTERN_PREFIX + "search" | ||
|
||
|
||
@dataclass | ||
class SearchPatternFlowStackFrame(PatternFlowStackFrame): | ||
"""A stack frame that gets added to respond to knowledge-oriented questions.""" | ||
|
||
flow_id: str = FLOW_PATTERN_SEARCH | ||
"""The ID of the flow.""" | ||
|
||
@classmethod | ||
def type(cls) -> str: | ||
"""Returns the type of the frame.""" | ||
return FLOW_PATTERN_SEARCH | ||
|
||
@staticmethod | ||
def from_dict(data: Dict[str, Any]) -> SearchPatternFlowStackFrame: | ||
"""Creates a `DialogueStackFrame` from a dictionary. | ||
Args: | ||
data: The dictionary to create the `DialogueStackFrame` from. | ||
Returns: | ||
The created `DialogueStackFrame`. | ||
""" | ||
return SearchPatternFlowStackFrame( | ||
frame_id=data["frame_id"], | ||
step_id=data["step_id"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.