-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06c17db
commit f89487d
Showing
11 changed files
with
855 additions
and
0 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,9 @@ | ||
.rasa/ | ||
.rasa/cache/ | ||
.vscode/ | ||
*.dot | ||
*.pyc | ||
models/ | ||
*.db | ||
.rasa/cache/cache.db | ||
actions/__pycache__/ |
Empty file.
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,79 @@ | ||
# This files contains your custom actions which can be used to run | ||
# custom Python code. | ||
# | ||
# See this guide on how to implement these action: | ||
# https://rasa.com/docs/rasa/custom-actions | ||
|
||
from typing import Any, Text, Dict, List | ||
|
||
from rasa_sdk import Action, Tracker, FormValidationAction | ||
from rasa_sdk.types import DomainDict | ||
from rasa_sdk.executor import CollectingDispatcher | ||
from rasa_sdk.events import SlotSet, Restarted | ||
|
||
|
||
class ValidateSimpleOrderForm(FormValidationAction): | ||
|
||
def name(self) -> Text: | ||
return "validate_simple_order_form" | ||
|
||
def __init__(self) -> None: | ||
self.valid_locations = ["living_shelf", "dining_room","reading_room"] | ||
self.valid_objects = ["pringles","windex_bottle","soup","tshirt","spatula"] | ||
|
||
def validate_places( | ||
self, | ||
value: Text, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: DomainDict, | ||
) -> Dict[Text, Any]: | ||
if value.lower() not in self.valid_locations: | ||
# dispatcher.utter_message("Sorry, I don't recognize that location.") | ||
|
||
dispatcher.utter_message(template="utter_ask_places_again") | ||
return {"places": None} | ||
return {"places": value} | ||
|
||
def validate_order( | ||
self, | ||
value: Text, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: DomainDict, | ||
) -> Dict[Text, Any]: | ||
if value.lower() not in self.valid_objects: | ||
# dispatcher.utter_message("Sorry, I don't recognize that object.") | ||
dispatcher.utter_message(template="utter_ask_order_again") | ||
return {"order": None} | ||
return {"order": value} | ||
|
||
class ActionCustomFallback(Action): | ||
def name(self) -> Text: | ||
return "action_fallback_response" | ||
|
||
def run( | ||
self, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: | ||
# Send a message to the user | ||
dispatcher.utter_message(template="utter_fallback") | ||
|
||
# Return an empty list | ||
return[] | ||
|
||
class ActionClearSlot(Action): | ||
def name(self) -> Text: | ||
return "action_clear_slots" | ||
|
||
def run( | ||
self, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: Dict[Text, Any] | ||
) -> List[Dict[Text, Any]]: | ||
# add all the slots you wish to clear, here: | ||
# TODO: can also use return [AllSlotsReset()] if always clearing all slots. | ||
return [SlotSet("order", None), SlotSet("places",None), SlotSet("confirmation", None)] | ||
|
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,55 @@ | ||
# The config recipe. | ||
# https://rasa.com/docs/rasa/model-configuration/ | ||
|
||
recipe: default.v1 | ||
|
||
# The assistant project unique identifier | ||
# This default value must be replaced with a unique assistant name within your deployment | ||
assistant_id: 20230424-150104-jovial-pan | ||
|
||
# Configuration for Rasa NLU. | ||
# https://rasa.com/docs/rasa/nlu/components/ | ||
language: en | ||
|
||
pipeline: | ||
# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model. | ||
# # If you'd like to customize it, uncomment and adjust the pipeline. | ||
# # See https://rasa.com/docs/rasa/tuning-your-model for more information. | ||
- name: WhitespaceTokenizer | ||
- name: RegexFeaturizer | ||
- name: LexicalSyntacticFeaturizer | ||
- name: CountVectorsFeaturizer | ||
- name: CountVectorsFeaturizer | ||
analyzer: "char_wb" | ||
min_ngram: 1 | ||
max_ngram: 4 | ||
- name: DIETClassifier | ||
epochs: 300 | ||
constrain_similarities: True | ||
- name: EntitySynonymMapper | ||
- name: ResponseSelector | ||
epochs: 100 | ||
constrain_similarities: True | ||
- name: FallbackClassifier | ||
threshold: 0.7 | ||
ambiguity_threshold: 0.1 | ||
|
||
|
||
|
||
# Configuration for Rasa Core. | ||
# https://rasa.com/docs/rasa/core/policies/ | ||
policies: | ||
# # No configuration for policies was provided. The following default policies were used to train your model. | ||
# # If you'd like to customize them, uncomment and adjust the policies. | ||
# # See https://rasa.com/docs/rasa/policies for more information. | ||
|
||
- name: AugmentedMemoizationPolicy | ||
- name: RulePolicy | ||
core_fallback_action_name: "action_fallback_response" | ||
- name: UnexpecTEDIntentPolicy | ||
max_history: 5 | ||
epochs: 100 | ||
- name: TEDPolicy | ||
max_history: 5 | ||
epochs: 100 | ||
constrain_similarities: true |
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,33 @@ | ||
# This file contains the credentials for the voice & chat platforms | ||
# which your bot is using. | ||
# https://rasa.com/docs/rasa/messaging-and-voice-channels | ||
|
||
rest: | ||
# # you don't need to provide anything here - this channel doesn't | ||
# # require any credentials | ||
|
||
|
||
#facebook: | ||
# verify: "<verify>" | ||
# secret: "<your secret>" | ||
# page-access-token: "<your page access token>" | ||
|
||
#slack: | ||
# slack_token: "<your slack token>" | ||
# slack_channel: "<the slack channel>" | ||
# slack_signing_secret: "<your slack signing secret>" | ||
|
||
#socketio: | ||
# user_message_evt: <event name for user message> | ||
# bot_message_evt: <event name for bot messages> | ||
# session_persistence: <true/false> | ||
|
||
#mattermost: | ||
# url: "https://<mattermost instance>/api/v4" | ||
# token: "<bot token>" | ||
# webhook_url: "<callback URL>" | ||
|
||
# This entry is needed if you are using Rasa Enterprise. The entry represents credentials | ||
# for the Rasa Enterprise "channel", i.e. Talk to your bot and Share with guest testers. | ||
rasa: | ||
url: "http://localhost:5002/api" |
Oops, something went wrong.