mirror of
https://github.com/pyt0xic/pablo-bot.git
synced 2024-11-22 02:09:27 +01:00
RASA Init
This commit is contained in:
parent
47e1cf85b3
commit
72b2097cad
0
actions/__init__.py
Normal file
0
actions/__init__.py
Normal file
27
actions/actions.py
Normal file
27
actions/actions.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
# This is a simple example for a custom action which utters "Hello World!"
|
||||||
|
|
||||||
|
# from typing import Any, Text, Dict, List
|
||||||
|
#
|
||||||
|
# from rasa_sdk import Action, Tracker
|
||||||
|
# from rasa_sdk.executor import CollectingDispatcher
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# class ActionHelloWorld(Action):
|
||||||
|
#
|
||||||
|
# def name(self) -> Text:
|
||||||
|
# return "action_hello_world"
|
||||||
|
#
|
||||||
|
# def run(self, dispatcher: CollectingDispatcher,
|
||||||
|
# tracker: Tracker,
|
||||||
|
# domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
|
||||||
|
#
|
||||||
|
# dispatcher.utter_message(text="Hello World!")
|
||||||
|
#
|
||||||
|
# return []
|
36
config.yml
Normal file
36
config.yml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# 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: 100
|
||||||
|
# - name: EntitySynonymMapper
|
||||||
|
# - name: ResponseSelector
|
||||||
|
# epochs: 100
|
||||||
|
# - name: FallbackClassifier
|
||||||
|
# threshold: 0.3
|
||||||
|
# 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: MemoizationPolicy
|
||||||
|
# - name: TEDPolicy
|
||||||
|
# max_history: 5
|
||||||
|
# epochs: 100
|
||||||
|
# - name: RulePolicy
|
33
credentials.yml
Normal file
33
credentials.yml
Normal file
@ -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 X. The entry represents credentials
|
||||||
|
# for the Rasa X "channel", i.e. Talk to your bot and Share with guest testers.
|
||||||
|
rasa:
|
||||||
|
url: "http://localhost:5002/api"
|
92
data/nlu.yml
Normal file
92
data/nlu.yml
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
version: "2.0"
|
||||||
|
|
||||||
|
nlu:
|
||||||
|
- intent: greet
|
||||||
|
examples: |
|
||||||
|
- hey
|
||||||
|
- hello
|
||||||
|
- hi
|
||||||
|
- hello there
|
||||||
|
- good morning
|
||||||
|
- good evening
|
||||||
|
- moin
|
||||||
|
- hey there
|
||||||
|
- let's go
|
||||||
|
- hey dude
|
||||||
|
- goodmorning
|
||||||
|
- goodevening
|
||||||
|
- good afternoon
|
||||||
|
|
||||||
|
- intent: goodbye
|
||||||
|
examples: |
|
||||||
|
- good afternoon
|
||||||
|
- cu
|
||||||
|
- good by
|
||||||
|
- cee you later
|
||||||
|
- good night
|
||||||
|
- bye
|
||||||
|
- goodbye
|
||||||
|
- have a nice day
|
||||||
|
- see you around
|
||||||
|
- bye bye
|
||||||
|
- see you later
|
||||||
|
|
||||||
|
- intent: affirm
|
||||||
|
examples: |
|
||||||
|
- yes
|
||||||
|
- y
|
||||||
|
- indeed
|
||||||
|
- of course
|
||||||
|
- that sounds good
|
||||||
|
- correct
|
||||||
|
|
||||||
|
- intent: deny
|
||||||
|
examples: |
|
||||||
|
- no
|
||||||
|
- n
|
||||||
|
- never
|
||||||
|
- I don't think so
|
||||||
|
- don't like that
|
||||||
|
- no way
|
||||||
|
- not really
|
||||||
|
|
||||||
|
- intent: mood_great
|
||||||
|
examples: |
|
||||||
|
- perfect
|
||||||
|
- great
|
||||||
|
- amazing
|
||||||
|
- feeling like a king
|
||||||
|
- wonderful
|
||||||
|
- I am feeling very good
|
||||||
|
- I am great
|
||||||
|
- I am amazing
|
||||||
|
- I am going to save the world
|
||||||
|
- super stoked
|
||||||
|
- extremely good
|
||||||
|
- so so perfect
|
||||||
|
- so good
|
||||||
|
- so perfect
|
||||||
|
|
||||||
|
- intent: mood_unhappy
|
||||||
|
examples: |
|
||||||
|
- my day was horrible
|
||||||
|
- I am sad
|
||||||
|
- I don't feel very well
|
||||||
|
- I am disappointed
|
||||||
|
- super sad
|
||||||
|
- I'm so sad
|
||||||
|
- sad
|
||||||
|
- very sad
|
||||||
|
- unhappy
|
||||||
|
- not good
|
||||||
|
- not very good
|
||||||
|
- extremly sad
|
||||||
|
- so saad
|
||||||
|
- so sad
|
||||||
|
|
||||||
|
- intent: bot_challenge
|
||||||
|
examples: |
|
||||||
|
- are you a bot?
|
||||||
|
- are you a human?
|
||||||
|
- am I talking to a bot?
|
||||||
|
- am I talking to a human?
|
13
data/rules.yml
Normal file
13
data/rules.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
version: "2.0"
|
||||||
|
|
||||||
|
rules:
|
||||||
|
|
||||||
|
- rule: Say goodbye anytime the user says goodbye
|
||||||
|
steps:
|
||||||
|
- intent: goodbye
|
||||||
|
- action: utter_goodbye
|
||||||
|
|
||||||
|
- rule: Say 'I am a bot' anytime the user challenges
|
||||||
|
steps:
|
||||||
|
- intent: bot_challenge
|
||||||
|
- action: utter_iamabot
|
30
data/stories.yml
Normal file
30
data/stories.yml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
version: "2.0"
|
||||||
|
|
||||||
|
stories:
|
||||||
|
|
||||||
|
- story: happy path
|
||||||
|
steps:
|
||||||
|
- intent: greet
|
||||||
|
- action: utter_greet
|
||||||
|
- intent: mood_great
|
||||||
|
- action: utter_happy
|
||||||
|
|
||||||
|
- story: sad path 1
|
||||||
|
steps:
|
||||||
|
- intent: greet
|
||||||
|
- action: utter_greet
|
||||||
|
- intent: mood_unhappy
|
||||||
|
- action: utter_cheer_up
|
||||||
|
- action: utter_did_that_help
|
||||||
|
- intent: affirm
|
||||||
|
- action: utter_happy
|
||||||
|
|
||||||
|
- story: sad path 2
|
||||||
|
steps:
|
||||||
|
- intent: greet
|
||||||
|
- action: utter_greet
|
||||||
|
- intent: mood_unhappy
|
||||||
|
- action: utter_cheer_up
|
||||||
|
- action: utter_did_that_help
|
||||||
|
- intent: deny
|
||||||
|
- action: utter_goodbye
|
34
domain.yml
Normal file
34
domain.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
version: "2.0"
|
||||||
|
|
||||||
|
intents:
|
||||||
|
- greet
|
||||||
|
- goodbye
|
||||||
|
- affirm
|
||||||
|
- deny
|
||||||
|
- mood_great
|
||||||
|
- mood_unhappy
|
||||||
|
- bot_challenge
|
||||||
|
|
||||||
|
responses:
|
||||||
|
utter_greet:
|
||||||
|
- text: "Hey! How are you?"
|
||||||
|
|
||||||
|
utter_cheer_up:
|
||||||
|
- text: "Here is something to cheer you up:"
|
||||||
|
image: "https://i.imgur.com/nGF1K8f.jpg"
|
||||||
|
|
||||||
|
utter_did_that_help:
|
||||||
|
- text: "Did that help you?"
|
||||||
|
|
||||||
|
utter_happy:
|
||||||
|
- text: "Great, carry on!"
|
||||||
|
|
||||||
|
utter_goodbye:
|
||||||
|
- text: "Bye"
|
||||||
|
|
||||||
|
utter_iamabot:
|
||||||
|
- text: "I am a bot, powered by Rasa."
|
||||||
|
|
||||||
|
session_config:
|
||||||
|
session_expiration_time: 60
|
||||||
|
carry_over_slots_to_new_session: true
|
42
endpoints.yml
Normal file
42
endpoints.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# This file contains the different endpoints your bot can use.
|
||||||
|
|
||||||
|
# Server where the models are pulled from.
|
||||||
|
# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server
|
||||||
|
|
||||||
|
#models:
|
||||||
|
# url: http://my-server.com/models/default_core@latest
|
||||||
|
# wait_time_between_pulls: 10 # [optional](default: 100)
|
||||||
|
|
||||||
|
# Server which runs your custom actions.
|
||||||
|
# https://rasa.com/docs/rasa/custom-actions
|
||||||
|
|
||||||
|
#action_endpoint:
|
||||||
|
# url: "http://localhost:5055/webhook"
|
||||||
|
|
||||||
|
# Tracker store which is used to store the conversations.
|
||||||
|
# By default the conversations are stored in memory.
|
||||||
|
# https://rasa.com/docs/rasa/tracker-stores
|
||||||
|
|
||||||
|
#tracker_store:
|
||||||
|
# type: redis
|
||||||
|
# url: <host of the redis instance, e.g. localhost>
|
||||||
|
# port: <port of your redis instance, usually 6379>
|
||||||
|
# db: <number of your database within redis, e.g. 0>
|
||||||
|
# password: <password used for authentication>
|
||||||
|
# use_ssl: <whether or not the communication is encrypted, default false>
|
||||||
|
|
||||||
|
#tracker_store:
|
||||||
|
# type: mongod
|
||||||
|
# url: <url to your mongo instance, e.g. mongodb://localhost:27017>
|
||||||
|
# db: <name of the db within your mongo instance, e.g. rasa>
|
||||||
|
# username: <username used for authentication>
|
||||||
|
# password: <password used for authentication>
|
||||||
|
|
||||||
|
# Event broker which all conversation events should be streamed to.
|
||||||
|
# https://rasa.com/docs/rasa/event-brokers
|
||||||
|
|
||||||
|
#event_broker:
|
||||||
|
# url: localhost
|
||||||
|
# username: username
|
||||||
|
# password: password
|
||||||
|
# queue: queue
|
91
tests/test_stories.yml
Normal file
91
tests/test_stories.yml
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#### This file contains tests to evaluate that your bot behaves as expected.
|
||||||
|
#### If you want to learn more, please see the docs: https://rasa.com/docs/rasa/testing-your-assistant
|
||||||
|
|
||||||
|
stories:
|
||||||
|
- story: happy path 1
|
||||||
|
steps:
|
||||||
|
- user: |
|
||||||
|
hello there!
|
||||||
|
intent: greet
|
||||||
|
- action: utter_greet
|
||||||
|
- user: |
|
||||||
|
amazing
|
||||||
|
intent: mood_great
|
||||||
|
- action: utter_happy
|
||||||
|
|
||||||
|
- story: happy path 2
|
||||||
|
steps:
|
||||||
|
- user: |
|
||||||
|
hello there!
|
||||||
|
intent: greet
|
||||||
|
- action: utter_greet
|
||||||
|
- user: |
|
||||||
|
amazing
|
||||||
|
intent: mood_great
|
||||||
|
- action: utter_happy
|
||||||
|
- user: |
|
||||||
|
bye-bye!
|
||||||
|
intent: goodbye
|
||||||
|
- action: utter_goodbye
|
||||||
|
|
||||||
|
- story: sad path 1
|
||||||
|
steps:
|
||||||
|
- user: |
|
||||||
|
hello
|
||||||
|
intent: greet
|
||||||
|
- action: utter_greet
|
||||||
|
- user: |
|
||||||
|
not good
|
||||||
|
intent: mood_unhappy
|
||||||
|
- action: utter_cheer_up
|
||||||
|
- action: utter_did_that_help
|
||||||
|
- user: |
|
||||||
|
yes
|
||||||
|
intent: affirm
|
||||||
|
- action: utter_happy
|
||||||
|
|
||||||
|
- story: sad path 2
|
||||||
|
steps:
|
||||||
|
- user: |
|
||||||
|
hello
|
||||||
|
intent: greet
|
||||||
|
- action: utter_greet
|
||||||
|
- user: |
|
||||||
|
not good
|
||||||
|
intent: mood_unhappy
|
||||||
|
- action: utter_cheer_up
|
||||||
|
- action: utter_did_that_help
|
||||||
|
- user: |
|
||||||
|
not really
|
||||||
|
intent: deny
|
||||||
|
- action: utter_goodbye
|
||||||
|
|
||||||
|
- story: sad path 3
|
||||||
|
steps:
|
||||||
|
- user: |
|
||||||
|
hi
|
||||||
|
intent: greet
|
||||||
|
- action: utter_greet
|
||||||
|
- user: |
|
||||||
|
very terrible
|
||||||
|
intent: mood_unhappy
|
||||||
|
- action: utter_cheer_up
|
||||||
|
- action: utter_did_that_help
|
||||||
|
- user: |
|
||||||
|
no
|
||||||
|
intent: deny
|
||||||
|
- action: utter_goodbye
|
||||||
|
|
||||||
|
- story: say goodbye
|
||||||
|
steps:
|
||||||
|
- user: |
|
||||||
|
bye-bye!
|
||||||
|
intent: goodbye
|
||||||
|
- action: utter_goodbye
|
||||||
|
|
||||||
|
- story: bot challenge
|
||||||
|
steps:
|
||||||
|
- user: |
|
||||||
|
are you a bot?
|
||||||
|
intent: bot_challenge
|
||||||
|
- action: utter_iamabot
|
Loading…
Reference in New Issue
Block a user