diff --git a/.dockeringore b/.dockeringore new file mode 100644 index 0000000000000000000000000000000000000000..e05228d199fc6c51858791f6dee96024ffb06973 --- /dev/null +++ b/.dockeringore @@ -0,0 +1,52 @@ +# Ignore Python cache + +**pycache** +_.pyc +_.pyo + +# Ignore virtual environments + +venv/ +.env/ + +# Ignore logs and temporary files + +_.log +_.tmp +\*.swp + +# Ignore Docker-specific files + +Dockerfile +docker-compose.yml +.dockerignore + +# Ignore version control files + +.git +.gitignore + +# Ignore node_modules + +node_modules/ + +# Ignore build directories + +build/ +dist/ + +# Ignore database files + +db/ + +# Ignore IDE and editor specific files + +.vscode/ +.idea/ +_.sublime-project +_.sublime-workspace + +# Ignore OS generated files + +.DS_Store +Thumbs.db diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..df4a60e66aab4f75aee2491990ccb7320356679b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,35 +1,9 @@ -*.7z filter=lfs diff=lfs merge=lfs -text -*.arrow filter=lfs diff=lfs merge=lfs -text -*.bin filter=lfs diff=lfs merge=lfs -text -*.bz2 filter=lfs diff=lfs merge=lfs -text -*.ckpt filter=lfs diff=lfs merge=lfs -text -*.ftz filter=lfs diff=lfs merge=lfs -text -*.gz filter=lfs diff=lfs merge=lfs -text -*.h5 filter=lfs diff=lfs merge=lfs -text -*.joblib filter=lfs diff=lfs merge=lfs -text -*.lfs.* filter=lfs diff=lfs merge=lfs -text -*.mlmodel filter=lfs diff=lfs merge=lfs -text -*.model filter=lfs diff=lfs merge=lfs -text -*.msgpack filter=lfs diff=lfs merge=lfs -text -*.npy filter=lfs diff=lfs merge=lfs -text -*.npz filter=lfs diff=lfs merge=lfs -text -*.onnx filter=lfs diff=lfs merge=lfs -text -*.ot filter=lfs diff=lfs merge=lfs -text -*.parquet filter=lfs diff=lfs merge=lfs -text -*.pb filter=lfs diff=lfs merge=lfs -text -*.pickle filter=lfs diff=lfs merge=lfs -text -*.pkl filter=lfs diff=lfs merge=lfs -text -*.pt filter=lfs diff=lfs merge=lfs -text -*.pth filter=lfs diff=lfs merge=lfs -text -*.rar filter=lfs diff=lfs merge=lfs -text -*.safetensors filter=lfs diff=lfs merge=lfs -text -saved_model/**/* filter=lfs diff=lfs merge=lfs -text -*.tar.* filter=lfs diff=lfs merge=lfs -text -*.tar filter=lfs diff=lfs merge=lfs -text -*.tflite filter=lfs diff=lfs merge=lfs -text -*.tgz filter=lfs diff=lfs merge=lfs -text -*.wasm filter=lfs diff=lfs merge=lfs -text -*.xz filter=lfs diff=lfs merge=lfs -text -*.zip filter=lfs diff=lfs merge=lfs -text -*.zst filter=lfs diff=lfs merge=lfs -text -*tfevents* filter=lfs diff=lfs merge=lfs -text +# *.tar.gz filter=lfs diff=lfs merge=lfs -text +# \# filter=lfs diff=lfs merge=lfs -text +# Track filter=lfs diff=lfs merge=lfs -text +# .tar.gz filter=lfs diff=lfs merge=lfs -text +# files filter=lfs diff=lfs merge=lfs -text +# kubectl.exe filter=lfs diff=lfs merge=lfs -text +# app/models/*.tar.gz filter=lfs diff=lfs merge=lfs -text +*.tar.gz filter=lfs diff=lfs merge=lfs -text +app/resources/de.json.gz filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/check_file_size.yml b/.github/workflows/check_file_size.yml new file mode 100644 index 0000000000000000000000000000000000000000..621c071b7818b58b853c745a03af14776fe8dbd4 --- /dev/null +++ b/.github/workflows/check_file_size.yml @@ -0,0 +1,16 @@ +name: Check file size +on: # or directly `on: [push]` to run the action on every push on any branch + pull_request: + branches: [master] + + # to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + sync-to-hub: + runs-on: ubuntu-latest + steps: + - name: Check large files + uses: ActionsDesk/lfs-warning@v2.0 + with: + filesizelimit: 10485760 diff --git a/.github/workflows/huggingface.yml b/.github/workflows/huggingface.yml new file mode 100644 index 0000000000000000000000000000000000000000..e9895c20f49cb0898da9530e37724c7fc836882e --- /dev/null +++ b/.github/workflows/huggingface.yml @@ -0,0 +1,20 @@ +name: Sync to Hugging Face hub +on: + push: + branches: [master] + + # to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + sync-to-hub: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + lfs: true + - name: Push to hub + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} + run: git push -f https://HarshanaLF:$HF_TOKEN@huggingface.co/spaces/HarshanaLF/rasa-hotel-core master diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..1a454689cd6f523a1c01d9918c30b0c2774a675f --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Ignore models and database directories +app/models/ +/docker/db/ +/venv/ +/app/venv/ +# Ignore specific files and directories +.rasa/ +.keras/ +__pycache__/ +.config/ +.env + +# Ignore .tar.gz files in app/models directory +app/models/*.tar.gz diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000000000000000000000000000000000000..78e834a36993f2d0da75e4f17bd791c3d2f2e136 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,429 @@ +# This Pylint rcfile contains a best-effort configuration to uphold the +# best-practices and style described in the Google Python style guide: +# https://google.github.io/styleguide/pyguide.html +# +# Its canonical open-source location is: +# https://google.github.io/styleguide/pylintrc + +[MASTER] + +# Files or directories to be skipped. They should be base names, not paths. +ignore=third_party + +# Files or directories matching the regex patterns are skipped. The regex +# matches against base names, not paths. +ignore-patterns= + +# Pickle collected data for later comparisons. +persistent=no + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +# Use multiple processes to speed up Pylint. +jobs=4 + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED +confidence= + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +#enable= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" +disable=abstract-method, + apply-builtin, + arguments-differ, + attribute-defined-outside-init, + backtick, + bad-option-value, + basestring-builtin, + buffer-builtin, + c-extension-no-member, + consider-using-enumerate, + cmp-builtin, + cmp-method, + coerce-builtin, + coerce-method, + delslice-method, + div-method, + duplicate-code, + eq-without-hash, + execfile-builtin, + file-builtin, + filter-builtin-not-iterating, + fixme, + getslice-method, + global-statement, + hex-method, + idiv-method, + implicit-str-concat, + import-error, + import-self, + import-star-module-level, + inconsistent-return-statements, + input-builtin, + intern-builtin, + invalid-str-codec, + locally-disabled, + long-builtin, + long-suffix, + map-builtin-not-iterating, + misplaced-comparison-constant, + missing-function-docstring, + metaclass-assignment, + next-method-called, + next-method-defined, + no-absolute-import, + no-else-break, + no-else-continue, + no-else-raise, + no-else-return, + no-init, # added + no-member, + no-name-in-module, + no-self-use, + nonzero-method, + oct-method, + old-division, + old-ne-operator, + old-octal-literal, + old-raise-syntax, + parameter-unpacking, + print-statement, + raising-string, + range-builtin-not-iterating, + raw_input-builtin, + rdiv-method, + reduce-builtin, + relative-import, + reload-builtin, + round-builtin, + setslice-method, + signature-differs, + standarderror-builtin, + suppressed-message, + sys-max-int, + too-few-public-methods, + too-many-ancestors, + too-many-arguments, + too-many-boolean-expressions, + too-many-branches, + too-many-instance-attributes, + too-many-locals, + too-many-nested-blocks, + too-many-public-methods, + too-many-return-statements, + too-many-statements, + trailing-newlines, + unichr-builtin, + unicode-builtin, + unnecessary-pass, + unpacking-in-except, + useless-else-on-loop, + useless-object-inheritance, + useless-suppression, + using-cmp-argument, + wrong-import-order, + xrange-builtin, + zip-builtin-not-iterating, + + +[REPORTS] + +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html. You can also give a reporter class, eg +# mypackage.mymodule.MyReporterClass. +output-format=text + +# Tells whether to display a full report or only the messages +reports=no + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details +#msg-template= + + +[BASIC] + +# Good variable names which should always be accepted, separated by a comma +good-names=main,_ + +# Bad variable names which should always be refused, separated by a comma +bad-names= + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Include a hint for the correct naming format with invalid-name +include-naming-hint=no + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +property-classes=abc.abstractproperty,cached_property.cached_property,cached_property.threaded_cached_property,cached_property.cached_property_with_ttl,cached_property.threaded_cached_property_with_ttl + +# Regular expression matching correct function names +function-rgx=^(?:(?PsetUp|tearDown|setUpModule|tearDownModule)|(?P_?[A-Z][a-zA-Z0-9]*)|(?P_?[a-z][a-z0-9_]*))$ + +# Regular expression matching correct variable names +variable-rgx=^[a-z][a-z0-9_]*$ + +# Regular expression matching correct constant names +const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$ + +# Regular expression matching correct attribute names +attr-rgx=^_{0,2}[a-z][a-z0-9_]*$ + +# Regular expression matching correct argument names +argument-rgx=^[a-z][a-z0-9_]*$ + +# Regular expression matching correct class attribute names +class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$ + +# Regular expression matching correct inline iteration names +inlinevar-rgx=^[a-z][a-z0-9_]*$ + +# Regular expression matching correct class names +class-rgx=^_?[A-Z][a-zA-Z0-9]*$ + +# Regular expression matching correct module names +module-rgx=^(_?[a-z][a-z0-9_]*|__init__)$ + +# Regular expression matching correct method names +method-rgx=(?x)^(?:(?P_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P_{0,2}[a-z][a-z0-9_]*))$ + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=(__.*__|main|test.*|.*test|.*Test)$ + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=10 + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager,contextlib2.contextmanager + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis. It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + + +[FORMAT] + +# Maximum number of characters on a single line. +max-line-length=80 + +# TODO(https://github.com/PyCQA/pylint/issues/3352): Direct pylint to exempt +# lines made too long by directives to pytype. + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=(?x)( + ^\s*(\#\ )??$| + ^\s*(from\s+\S+\s+)?import\s+.+$) + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=yes + +# Maximum number of lines in a module +max-module-lines=99999 + +# String used as indentation unit. The internal Google style guide mandates 2 +# spaces. Google's externaly-published style guide says 4, consistent with +# PEP 8. Here, we use 2 spaces, for conformity with many open-sourced Google +# projects (like TensorFlow). +indent-string=' ' + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=TODO + + +[STRING] + +# This flag controls whether inconsistent-quotes generates a warning when the +# character used as a quote delimiter is used inconsistently within a module. +check-quote-consistency=yes + + +[VARIABLES] + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching the name of dummy variables (i.e. expectedly +# not used). +dummy-variables-rgx=^\*{0,2}(_$|unused_|dummy_) + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_,_cb + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six,six.moves,past.builtins,future.builtins,functools + + +[LOGGING] + +# Logging modules to check that the string format arguments are in logging +# function parameter format +logging-modules=logging,absl.logging,tensorflow.io.logging + + +[SIMILARITIES] + +# Minimum lines number of a similarity. +min-similarity-lines=4 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no + + +[SPELLING] + +# Spelling dictionary name. Available dictionaries: none. To make it working +# install python-enchant package. +spelling-dict= + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to indicated private dictionary in +# --spelling-private-dict-file option instead of raising a message. +spelling-store-unknown-words=no + + +[IMPORTS] + +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=regsub, + TERMIOS, + Bastion, + rexec, + sets + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant, absl + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict, + _fields, + _replace, + _source, + _make + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls, + class_ + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=builtins.StandardError, + builtins.Exception, + builtins.BaseException diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..122205a92eeaa1b11ae27de924e195c1300dc120 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Harshana Lakshara Fernando + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..e5dcb3f203da66d764d41c0542375df41d1b84d2 --- /dev/null +++ b/Makefile @@ -0,0 +1,108 @@ +# Determine the operating system +ifeq ($(OS),Windows_NT) + # Windows-specific commands + INIT_SCRIPT := scripts/init.bat + START_SCRIPT := scripts/start.bat + STOP_SCRIPT := scripts/stop.bat + SQL_SCRIPT := scripts/startSql.bat + RM := del /Q + RM_DIR := rmdir /S /Q +else + # Linux/macOS commands + INIT_SCRIPT := scripts/init.sh + START_SCRIPT := scripts/start.sh + STOP_SCRIPT := scripts/stop.sh + SQL_SCRIPT := scripts/startSql.sh + RM := rm -rf +endif + +# Common paths +DOCKER_COMPOSE := docker/docker-compose.yml +config_supervised := app/configs/config_supervised.yml +config_bert := app/configs/config_bert.yml +config_spacy := app/configs/config_spacy.yml +config_custom := app/configs/config_custom.yml +ACTION := app/actions +MODEL := app/models +DATA := app/data +ENDPOINT := app/endpoints.yml +DOMAIN := app/domain.yml + +# Phony targets +.PHONY: init docker-start docker-stop docker-up docker-down docker-rm docker-clean sql train train-nlu run-actions shell run validate help clean + +# Targets +init: ## Initialize permissions and folder structure + $(INIT_SCRIPT) + +docker-start: ## Start Docker containers + $(START_SCRIPT) + +docker-stop: ## Stop Docker containers + $(STOP_SCRIPT) + +docker-up: ## Bring up Docker containers + @echo "Starting Docker containers..." + docker-compose -f $(DOCKER_COMPOSE) up -d + +docker-down: ## Bring down Docker containers + @echo "Stopping Docker containers..." + docker-compose -f $(DOCKER_COMPOSE) down + +docker-rm: ## Remove Docker containers + @echo "Removing Docker containers..." + docker-compose -f $(DOCKER_COMPOSE) rm -f + +docker-clean-full: ## Clean Docker resources + @echo "Cleaning Docker resources..." + docker stop $(docker ps -aq) || true + docker rm $(docker ps -aq) || true + docker images -a + docker rmi -f $(docker images -aq) || true + docker network ls + docker network prune + docker volume ls + docker volume prune + docker system prune -a --volumes + docker system prune --volumes -f + +docker-clean: ## Clean Docker resources + @echo "Cleaning Docker resources..." + docker system prune --volumes -f + +sql: ## Start SQL database access + $(SQL_SCRIPT) + +train: ## Train the full Rasa model + rasa train --domain $(DOMAIN) --data $(DATA) --config $(config_supervised) --out $(MODEL) + +train-nlu: ## Train only the NLU model + rasa train nlu --nlu $(DATA)/nlu --config $(config_supervised) --out $(MODEL)/nlu + +run-actions: ## Run the action server + rasa run actions --actions $(ACTION) --cors "*" --debug + +shell: ## Run an interactive Rasa shell + $(MAKE) run-actions & + rasa shell -m $(MODEL) --endpoints $(ENDPOINT) + +run: ## Run the Rasa server with React web app + $(MAKE) run-actions & + rasa run --enable-api -m $(MODEL) --cors "*" --debug + +validate: ## Validate the Rasa files + rasa data validate --domain $(DOMAIN) --data $(DATA) --config $(config_supervised) + +clean: ## Clean up generated files and caches + @echo "Cleaning up generated files and caches..." + $(RM) $(MODEL)/* + $(RM_DIR) __pycache__ + $(RM_DIR) .rasa + $(RM_DIR) .keras + +help: ## Display help + @echo "Usage:" + @echo " make " + @echo "" + @echo "Targets:" + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..289905cb1b4c3a299ea6684d848ff4dfad926e9a --- /dev/null +++ b/README.md @@ -0,0 +1,168 @@ +# Hotel Assistant Chatbot + +Welcome to the Hotel Assistant Chatbot project! This repository contains a conversational AI powered by the Rasa framework, integrating Language Model capabilities from OpenAI. The chatbot assists users with various hotel-related queries, leveraging both structured data and natural language understanding. + +## Table of Contents + +- [Introduction](#introduction) +- [Installation](#installation) +- [Usage](#usage) + - [Training the Model](#training-the-model) + - [Running the Action Server](#running-the-action-server) + - [Interacting with the Bot](#interacting-with-the-bot) +- [Configuration](#configuration) +- [File Structure](#file-structure) +- [Makefile Commands](#makefile-commands) +- [Contributing](#contributing) +- [License](#license) + +## Introduction + +The Hotel Assistant Chatbot leverages state-of-the-art Natural Language Processing (NLP) techniques to provide an intelligent conversational interface for hotel-related inquiries. This chatbot is built using the Rasa framework, which combines rule-based dialogue management with machine learning models for natural language understanding (NLU). + +### Key Features + +- **NLP and Transformers**: Utilizes advanced NLP models and transformer architectures, including BERT and SpaCy, to understand and process user queries with high accuracy. +- **Custom Components**: Includes custom pipeline components, such as a spell-checker, to enhance user input handling and improve the overall chatbot performance. +- **Flexible and Extensible**: Designed to be easily extendable, allowing the integration of additional services and customization to fit specific hotel requirements. + +## Installation + +1. **Clone the repository:** + + ```sh + git clone https://github.com/your-username/hotel-assistant-bot.git + cd hotel-assistant-bot + ``` + +2. **Create and activate a virtual environment:** + + ```sh + python3 -m venv venv + source venv/bin/activate + ``` + +3. **Install dependencies:** + + ```sh + pip install -r requirements.txt + ``` + +## Usage + +### Training the Model + +To train the Rasa model with your current data, run: + +```sh +make train +``` + +This command will train the Rasa model using the domain, data, and configuration files, and save the trained model in the `models` directory. + +### Running the Action Server + +To start the action server, which handles custom actions, run: + +```sh +make run-actions +``` + +### Interacting with the Bot + +You can interact with the bot using Rasa Shell: + +```sh +make shell +``` + +This will start the action server and open the Rasa shell, allowing you to chat with the bot in the terminal. + +Alternatively, you can run the bot and interact with it via HTTP API: + +```sh +make run +``` + +## Configuration + +- **Domain File:** `configs/domain.yml` contains the intents, entities, slots, responses, and forms used by the bot. +- **Training Data:** `data` directory contains the NLU and Core training data. +- **Config File:** `configs/config.yml` specifies the pipeline and policies for training the model. +- **Endpoints File:** `configs/endpoints.yml` defines the endpoints for the action server and other external services. + +## File Structure + +```plaintext +hotel-assistant-rasa-bot/ +├── app/ +│ ├── data/ # Training data for Rasa +│ │ ├── nlu/ # NLU training data +│ │ ├── stories/ # Core training data (conversation stories) +│ │ └── rules/ # Rule-based data for conversation handling +│ ├── configs/ # Configuration files for Rasa and other services +│ │ ├── config_supervised.yml # Configuration for supervised learning +│ │ ├── config_custom.yml # Configuration using custom pipelines +│ │ ├── config_bert.yml # Configuration using BERT embeddings +│ │ └── config_spacy.yml # Configuration using SpaCy +│ ├── actions/ # Custom action server files +│ │ └── actions.py # Custom action implementation +│ ├── tests/ # Directory for testing scripts or unit tests +│ │ └── ... # Unit tests and testing scripts +│ ├── resources/ # Additional resources used in the project +│ │ └── ... # Any additional resource files +│ ├── domain.yml # Domain file defining intents, entities, and actions +│ ├── endpoints.yml # Endpoints configuration for Rasa and external services +│ ├── components/ # Custom pipeline components for Rasa +│ │ └── spell_checker.py # Custom spell-checker component +│ ├── requirements.txt # Python dependencies +│ └── deb-requirements.txt # Debian-based system dependencies +├── docker/ +│ ├── docker-compose.yml # Docker Compose configuration for deployment +│ ├── Dockerfile.rasa # Dockerfile for building the Rasa server image +│ └── Dockerfile.action # Dockerfile for building the action server image +├── scripts/ # Shell and batch scripts for automation +│ ├── init.sh # Initialization script for setting up directories +│ ├── init.bat # Batch file for setting up directories (Windows) +│ ├── start.sh # Script to build and start Docker containers +│ ├── start.bat # Batch file to build and start Docker containers (Windows) +│ ├── startSql.sh # Script to start SQL database access +│ ├── startSql.bat # Batch file to start SQL database access (Windows) +│ ├── stop.sh # Script to stop Docker containers +│ └── stop.bat # Batch file to stop Docker containers (Windows) +├── server.sh # Server start script +├── app.json # App configuration file +├── heroku.yml # Heroku deployment configuration +├── Makefile # Makefile for automating tasks and commands +├── LICENSE # License information for the project +└── README.md # Detailed documentation and instructions + +``` + +## Makefile Commands + +Here are some useful commands to manage and run your Hotel Assistant Chatbot: + +- **`make init`**: Initialize permissions and folder structure. +- **`make docker-start`**: Start Docker containers. +- **`make docker-stop`**: Stop Docker containers. +- **`make docker-up`**: Bring up Docker containers. +- **`make docker-down`**: Bring down Docker containers. +- **`make docker-rm`**: Remove Docker containers. +- **`make docker-clean`**: Clean Docker resources. +- **`make sql`**: Start SQL database access. +- **`make train`**: Train the full Rasa model. +- **`make train-nlu`**: Train only the NLU model. +- **`make run-actions`**: Start the action server for handling custom actions. +- **`make shell`**: Start the action server and open Rasa shell for interaction. +- **`make run`**: Start the action server and Rasa server with API enabled. +- **`make validate`**: Validate the Rasa configuration and training data. +- **`make help`**: Display help information with available targets. + +## Contributing + +Contributions are welcome! Please create a new issue or submit a pull request if you have any improvements or bug fixes. + +## License + +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. diff --git a/app/actions/__init__.py b/app/actions/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/actions/__pycache__/__init__.cpython-310.pyc b/app/actions/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..259556423eb45d29214671cf04ba288db997f505 Binary files /dev/null and b/app/actions/__pycache__/__init__.cpython-310.pyc differ diff --git a/app/actions/__pycache__/__init__.cpython-37.pyc b/app/actions/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dcee4623610abef7259f2f38e7b7d1e44e545081 Binary files /dev/null and b/app/actions/__pycache__/__init__.cpython-37.pyc differ diff --git a/app/actions/__pycache__/actions.cpython-310.pyc b/app/actions/__pycache__/actions.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cee0ca69c69e44a36ec59bf3b6119baed7d7b2ca Binary files /dev/null and b/app/actions/__pycache__/actions.cpython-310.pyc differ diff --git a/app/actions/__pycache__/actions.cpython-37.pyc b/app/actions/__pycache__/actions.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee20e070c8eef4df4e607634344951f9546196da Binary files /dev/null and b/app/actions/__pycache__/actions.cpython-37.pyc differ diff --git a/app/actions/actions.py b/app/actions/actions.py new file mode 100644 index 0000000000000000000000000000000000000000..6de4e307f3e7ccc88154343db1012a10aa59f250 --- /dev/null +++ b/app/actions/actions.py @@ -0,0 +1,256 @@ +from typing import Any, Text, Dict, List + +from rasa_sdk import Action, Tracker, FormValidationAction +from rasa_sdk.events import SlotSet, UserUtteranceReverted +from rasa_sdk.executor import CollectingDispatcher +from rasa_sdk.types import DomainDict + + +def repeat(tracker: Tracker, dispatcher: CollectingDispatcher): + user_ignore_count = 2 + count = 0 + tracker_list = [] + + while user_ignore_count > 0: + event = tracker.events[count].get("event") + if event == "user": + user_ignore_count = user_ignore_count - 1 + if event == "bot": + tracker_list.append(tracker.events[count]) + count = count - 1 + + tracker_list.reverse() + i = len(tracker_list) - 1 + + while i >= 0: + data = tracker_list[i].get("data") + if data: + if "buttons" in data: + dispatcher.utter_message( + text=tracker_list[i].get("text"), buttons=data["buttons"]) + else: + dispatcher.utter_message(text=tracker_list[i].get("text")) + break + i -= 1 + + +class ValidateBookRoomInfo(FormValidationAction): + def name(self) -> Text: + return "validate_form_book_room" + + async def required_slots( + self, + domain_slots: List[Text], + dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: DomainDict, + ) -> List[Text]: + return ["number", "room_type"] + + async def extract_number( + self, + dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: DomainDict, + ) -> Dict[Text, Any]: + return {"number": tracker.get_slot("number")} + + async def extract_room_type( + self, + dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: DomainDict, + ) -> Dict[Text, Any]: + return {"room_type": tracker.get_slot("room_type")} + + async def validate_number( + self, + value: Any, + dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: DomainDict, + ) -> Dict[Text, Any]: + return {"number": value} + + async def validate_room_type( + self, + value: Any, + dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: DomainDict, + ) -> Dict[Text, Any]: + return {"room_type": value} + + async def submit( + self, + dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: DomainDict, + ) -> List[Dict]: + dispatcher.utter_message( + template="utter_submit", + number=tracker.get_slot("number"), + room_type=tracker.get_slot("room_type") + ) + return [] + + +class ValidateBookRoomNumberInfo(FormValidationAction): + def name(self) -> Text: + return "validate_form_book_room_number" + + async def required_slots( + self, + domain_slots: List[Text], + dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: DomainDict, + ) -> List[Text]: + return ["room_type"] + + async def extract_room_type( + self, + dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: DomainDict, + ) -> Dict[Text, Any]: + return {"room_type": tracker.get_slot("room_type")} + + async def validate_room_type( + self, + value: Any, + dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: DomainDict, + ) -> Dict[Text, Any]: + return {"room_type": value} + + async def submit( + self, + dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: DomainDict, + ) -> List[Dict]: + dispatcher.utter_message( + template="utter_submit", + room_type=tracker.get_slot("room_type") + ) + return [] + + +class ResetSlots(Action): + def name(self): + return "action_reset_slots" + + async def run(self, dispatcher, tracker, domain): + return [SlotSet("number", None), SlotSet("room_type", None)] + + +class MyFallbackAction(Action): + def name(self): + return "action_my_fallback" + + async def run(self, dispatcher, tracker, domain): + dispatcher.utter_message(template="utter_fallback_message") + return [UserUtteranceReverted()] + + +class ActionCheckInTime(Action): + def name(self): + return "action_check_in_time" + + async def run(self, dispatcher, tracker, domain): + dispatcher.utter_message(template="utter_check_in_time") + repeat(tracker, dispatcher) + return [UserUtteranceReverted()] + + +class ActionCheckOutTime(Action): + def name(self): + return "action_check_out_time" + + async def run(self, dispatcher, tracker, domain): + dispatcher.utter_message(template="utter_check_out_time") + repeat(tracker, dispatcher) + return [UserUtteranceReverted()] + + +class ActionCancelReservation(Action): + def name(self): + return "action_cancel_reservation" + + async def run(self, dispatcher, tracker, domain): + dispatcher.utter_message(template="utter_cancel_reservation") + repeat(tracker, dispatcher) + return [UserUtteranceReverted()] + + +class ActionCancellationPolicy(Action): + def name(self): + return "action_cancellation_policy" + + async def run(self, dispatcher, tracker, domain): + dispatcher.utter_message(template="utter_cancellation_policy") + repeat(tracker, dispatcher) + return [UserUtteranceReverted()] + + +class ActionHaveRestaurant(Action): + def name(self): + return "action_have_restaurant" + + async def run(self, dispatcher, tracker, domain): + dispatcher.utter_message(template="utter_have_restaurant") + repeat(tracker, dispatcher) + return [UserUtteranceReverted()] + + +class ActionBreakfastAvail(Action): + def name(self): + return "action_breakfast_avail" + + async def run(self, dispatcher, tracker, domain): + dispatcher.utter_message(template="utter_breakfast_avail") + repeat(tracker, dispatcher) + return [UserUtteranceReverted()] + + +class ActionBreakfastTime(Action): + def name(self): + return "action_breakfast_time" + + async def run(self, dispatcher, tracker, domain): + dispatcher.utter_message(template="utter_breakfast_time") + repeat(tracker, dispatcher) + return [UserUtteranceReverted()] + + +class ActionRestaurantTime(Action): + def name(self): + return "action_restaurant_time" + + async def run(self, dispatcher, tracker, domain): + dispatcher.utter_message(template="utter_restaurant_time") + repeat(tracker, dispatcher) + return [UserUtteranceReverted()] + + +class ActionShowRoomImage(Action): + + def name(self) -> Text: + return "action_show_room_image" + + def run(self, dispatcher: CollectingDispatcher, + tracker: Tracker, + domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: + + room_type = tracker.get_slot('room_type') + + if room_type == "simple": + dispatcher.utter_message(text="Here is an image of our simple room.", image="url_to_simple_room_image.jpg") + elif room_type == "deluxe": + dispatcher.utter_message(text="Here is an image of our deluxe room.", image="url_to_deluxe_room_image.jpg") + else: + dispatcher.utter_message(text="Sorry, I don't have an image for that room type.") + + return [] \ No newline at end of file diff --git a/app/components/spell.py b/app/components/spell.py new file mode 100644 index 0000000000000000000000000000000000000000..fc5a51a80071e2fb580e118a03e87a2104e8ff43 --- /dev/null +++ b/app/components/spell.py @@ -0,0 +1,51 @@ +from rasa.nlu.components import Component +from rasa.nlu.training_data import Message +import typing +from typing import Any, Optional, Text, Dict + +if typing.TYPE_CHECKING: + from rasa.nlu.model import Metadata + +from spellchecker import SpellChecker + + +class SpellCheckerDE(Component): + """ + Spell checker for German language. + """ + + defaults = {} + language_list = ["de"] + + def __init__(self, component_config=None): + super(SpellCheckerDE, self).__init__(component_config) + + def process(self, message, **kwargs): + mt = message.text + txt = mt.translate( + mt.maketrans("", "", '!\"#$%&\'()*+,.:;<=>?@[\]^_`{|}~')) + words = txt.split(" ") + words = [word for word in words if word] + spell = SpellChecker(language=None) + spell.word_frequency.load_dictionary("resources/de.json.gz") + spell.word_frequency.load_text_file("resources/hotel_lex.txt") + + for word in words: + if word not in spell: + mt = mt.replace(word, spell.correction(word)) + + message.text = mt + + @classmethod + def load( + cls, + meta: Dict[Text, Any], + model_dir: Optional[Text] = None, + model_metadata: Optional["Metadata"] = None, + cached_component: Optional["Component"] = None, + **kwargs: Any + ) -> "Component": + if cached_component: + return cached_component + else: + return cls(meta) diff --git a/app/configs/config_bert.yml b/app/configs/config_bert.yml new file mode 100644 index 0000000000000000000000000000000000000000..1256d95be9a0d698e3458bc4fa803faa77fac6d5 --- /dev/null +++ b/app/configs/config_bert.yml @@ -0,0 +1,35 @@ +# Configuration for Rasa NLU. +# https://rasa.com/docs/rasa/nlu/components/ +language: "en" # your two-letter language code + +pipeline: + - name: HFTransformersNLP + # Name of the language model to use + model_name: "bert" + model_weights: "bert-base-german-cased" + - name: LanguageModelTokenizer + # Flag to check whether to split intents + "intent_tokenization_flag": False + "intent_split_symbol": "_" + - name: LanguageModelFeaturizer + - name: RegexFeaturizer + - name: LexicalSyntacticFeaturizer + - name: CountVectorsFeaturizer + - name: CountVectorsFeaturizer + analyzer: "char_wb" + min_ngram: 1 + max_ngram: 4 + - name: DIETClassifier + epochs: 300 + - name: EntitySynonymMapper + - name: ResponseSelector + epochs: 300 + +# Configuration for Rasa Core. +# https://rasa.com/docs/rasa/core/policies/ +policies: + - name: MemoizationPolicy + - name: TEDPolicy + max_history: 5 + epochs: 100 + - name: RulePolicy diff --git a/app/configs/config_custom.yml b/app/configs/config_custom.yml new file mode 100644 index 0000000000000000000000000000000000000000..6c8cfc838453c4245587962384c79a440b3b84c1 --- /dev/null +++ b/app/configs/config_custom.yml @@ -0,0 +1,66 @@ +# 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: 20240616-000849-devout-curry + +# Configuration for Rasa NLU. +# https://rasa.com/docs/rasa/nlu/components/ +language: "en" + +pipeline: + # - name: spell_checker.CorrectSpelling + - name: WhitespaceTokenizer + token_pattern: (?u)\b\w+\b + - name: RegexFeaturizer + - name: LexicalSyntacticFeaturizer + - name: CountVectorsFeaturizer + OOV_token: oov + - name: CountVectorsFeaturizer + analyzer: char_wb + min_ngram: 1 + max_ngram: 4 + - name: CountVectorsFeaturizer + analyzer: char + min_ngram: 3 + max_ngram: 5 + - name: DIETClassifier + epochs: 200 + ranking_length: 5 + - name: DucklingEntityExtractor + url: http://localhost:8000 + dimensions: + - email + - number + - amount-of-money + - name: EntitySynonymMapper + - name: ResponseSelector + retrieval_intent: out_of_scope + scale_loss: false + epochs: 100 + - name: ResponseSelector + retrieval_intent: faq + scale_loss: false + epochs: 100 + - name: ResponseSelector + retrieval_intent: chitchat + scale_loss: false + epochs: 100 + - name: FallbackClassifier + threshold: 0.7 + +policies: + - name: RulePolicy + core_fallback_threshold: 0.3 + core_fallback_action_name: "action_default_fallback" + enable_fallback_prediction: True + - max_history: 6 + name: AugmentedMemoizationPolicy + - name: TEDPolicy + max_history: 10 + epochs: 20 + batch_size: + - 32 + - 64 diff --git a/app/configs/config_spacy.yml b/app/configs/config_spacy.yml new file mode 100644 index 0000000000000000000000000000000000000000..d1002eb0ec01e4e54e899c13ecd71795a61f20a1 --- /dev/null +++ b/app/configs/config_spacy.yml @@ -0,0 +1,38 @@ +language: en +pipeline: + - name: spell.SpellCheckerDE + - name: SpacyNLP + - name: SpacyTokenizer + - name: SpacyFeaturizer + - name: RegexFeaturizer + - name: LexicalSyntacticFeaturizer + - name: CountVectorsFeaturizer + - name: CountVectorsFeaturizer + analyzer: char_wb + min_ngram: 1 + max_ngram: 4 + - name: DIETClassifier + epochs: 300 + - name: EntitySynonymMapper + +policies: + - name: FormPolicy + priority: 5 + - name: FallbackPolicy + priority: 4 + nlu_threshold: 0.3 + core_threshold: 0.3 + ambiguity_threshold: 0.1 + fallback_action_name: utter_fallback + - name: MemoizationPolicy + priority: 3 + - name: RulePolicy + core_fallback_threshold: 0.3 + core_fallback_action_name: "action_default_fallback" + enable_fallback_prediction: True + - name: TEDPolicy + priority: 1 + max_history: 8 + epochs: 200 + random_seed: 42 +assistant_id: 20240706-172914-animato-ocean diff --git a/app/configs/config_supervised.yml b/app/configs/config_supervised.yml new file mode 100644 index 0000000000000000000000000000000000000000..538dcd1e7d61994c18060e65718e0c09187c9172 --- /dev/null +++ b/app/configs/config_supervised.yml @@ -0,0 +1,28 @@ +# Configuration for Rasa NLU. +# https://rasa.com/docs/rasa/nlu/components/ +language: "en" # your two-letter language code + +pipeline: + - name: WhitespaceTokenizer + - name: RegexFeaturizer + - name: LexicalSyntacticFeaturizer + - name: CountVectorsFeaturizer + - name: CountVectorsFeaturizer + analyzer: "char_wb" + min_ngram: 1 + max_ngram: 4 + - name: DIETClassifier + epochs: 300 + - name: EntitySynonymMapper + - name: ResponseSelector + epochs: 300 + +# Configuration for Rasa Core. +# https://rasa.com/docs/rasa/core/policies/ +policies: + - name: MemoizationPolicy + - name: TEDPolicy + max_history: 5 + epochs: 100 + - name: RulePolicy +assistant_id: 20240707-075816-forgiving-parkway diff --git a/app/credentials.yml b/app/credentials.yml new file mode 100644 index 0000000000000000000000000000000000000000..e00995b42f883e68a4ac5ecebd99735893ae6750 --- /dev/null +++ b/app/credentials.yml @@ -0,0 +1,32 @@ +# This file contains the credentials for the voice & chat platforms +# which your bot is using. +# https://rasa.com/docs/rasa/user-guide/messaging-and-voice-channels/ + +rest: +# # you don't need to provide anything here - this channel doesn't +# # require any credentials + + +#facebook: +# verify: "" +# secret: "" +# page-access-token: "" + +#slack: +# slack_token: "" +# slack_channel: "" + +#socketio: +# user_message_evt: +# bot_message_evt: +# session_persistence: + +#mattermost: +# url: "https:///api/v4" +# token: "" +# webhook_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" diff --git a/app/data/nlu/nlu _hotel.yml b/app/data/nlu/nlu _hotel.yml new file mode 100644 index 0000000000000000000000000000000000000000..05237cc113e8c17191667d3b71ab88203ebcbfea --- /dev/null +++ b/app/data/nlu/nlu _hotel.yml @@ -0,0 +1,208 @@ +version: "3.1" +nlu: + - intent: open_days + examples: | + - when is the restaurant open? + - On what days the restaurant is open? + - days the restaurant open + + - intent: open_hours + examples: | + - At what time + - opened hours + - till what time are you open + - working hours + - At what time are you opened + - what are the working hours + + - intent: book_room + examples: | + - i want a book [1](number) [room](location) for my stay + - I want to book a [room](location) + - i want to book a [room](location) + - i would like to book a [room](location) + - need a [room](location) + - can you book a [room](location)? + - book [room](location) + - book the [room](location) + - book a [standard](room_type) [room](location) + - Book a [Room](location) + - Book [room](location) for my stay + - book [rooms](location) + - book the [rooms](location) + - book [room](location) + - book the [room](location) + - book a [room](location) + - Book a [Room](location) + - Book [room](location) + - book [2](number) [deluxe](room_type) [rooms](location) + - book the [rooms](location) + + - intent: book_number_room + examples: | + - i want to book (2)[number] [rooms](location) for my stay + - i would like to book [1](number) [room](location) + - I want to book [2](number) [rooms](location) + - book [2](number) [rooms](location) for me + - need [1](number) [room](location) + - book [1](number) [room](location) + - book [2](number) [rooms](location) + - need [2](number) [rooms](location) to book + + - intent: num_rooms + examples: | + - [2](number) + - [1](number) + + - intent: type_rooms + examples: | + - [standard](room_type) + - [deluxe](room_type) + + - intent: clean_room + examples: | + - can you ask for someone to clean the clean the [room](location)? + - request for [room](location) clean + - [room](location) cleaning + - i want to have my [room](location) cleaned + - could you send someone to clean the [room](location) + - send someone to clean the [room](location) + - need someone to clean the [room](location) + - i would like to request for [room](location) cleaning + - request [room](location) cleaning service + - can you send someone to clean the [room](location)? + - my [room](location) needs to be cleaned + - please send someone to clean my [room](location) + - i would like to have my [room](location) cleaned + + - intent: clean_room_now + examples: | + - urgently + - now + - could you send someone right now? + - send someone right now + - required now + - needed now + - send him now + - it is urgent + - please send someone right now + - the requirement is urgent + - can you send someone as soon as possible + - as soon as possible + + - intent: clean_room_relative + examples: | + - could you send someone after [2](number) hours? + - send someone after [3](number) hours + - schedule it after [5](number) hours + - send him around [2](number) hours later + - please send in [2](number) hours + + - intent: faq_check_in_time + examples: | + - what is the check-in time? + - what is the check in time? + - when is check-in? + - what are your check-in timings? + - check in timings? + - check in time + - what is the check-in time? + - what is the check in time? + - can you tell me your check-in timings? + - can you tell me your check in timings? + - i would like to know your check-in timings + - tell your check-in timings + - when can I check in? + - check-in? + - could you tell me when to check-in? + - i want to check in. can you tell me check in timing? + + - intent: faq_check_out_time + examples: | + - what is the check-out time? + - when is check-out? + - what are your check-out timings? + - check out timings? + - check out time + - what is the check-out time? + - what is the check out time? + - can you tell me your check-out timings? + - can you tell me your check out timings? + - i would like to know your check-out timings + - tell your check-out timings + - when can I check out? + - check-out? + - could you tell me when to check-out? + - i want to check out. can you tell me check out timings? + + - intent: faq_cancel_reservation + examples: | + - i want to cancel the reservation that i made + - cancel my reservation that i made earlier + - i would like to cancel my reservation + - cancel my reservation + - can you cancel my reservation? + - how do i cancel my reservation? + - can i cancel my reservation? + - please cancel my reservation + - i request you to cancel the reservation that i made + - it would be great if you could cancel my reservation + + - intent: faq_cancellation_policy + examples: | + - what is your cancellation policy? + - can you state your cancellation policy + - i would like to know your cancellation policy + - show me your cancellation policy + - do you have any cancellation policy? + - i want to see your cancellation policy + - where is your cancellation policy? + + - intent: faq_have_restaurant + examples: | + - does the hotel have a [restaurant](location)? + - do you have a [restaurant](location)? + - is there a [restaurant](location)? + - is there a [restaurant](location) in the hotel? + - tell me about the [restaurant](location) + - can you tell me about any [restaurant](location) in the hotel? + - are there [restaurants](location) in the hotel? + - number of [restaurants](location)? + - can i find [restaurants](location) here? + - i heard there is a [restaurant](location) also + - inform me about the [restaurant](location) + - where is [restaurant](location)? + + - intent: ask_room_image + examples: | + - Can you show me a picture of a [simple](room_type) room? + - I want to see an image of the [deluxe](room_type) room. + - Show me a picture of a [simple](room_type) room. + - Can I see a [deluxe](room_type) room image? + + - intent: faq_breakfast_avail + examples: | + - does the hotel offer breakfast? + - is there breakfast offered by the hotel? + - is breakfast facility available? + - is breakfast there? + - can i get breakfast here? + - do you provide breakfast? + - breakfast? + - do you serve breakfast? + - is breakfast available? + + - intent: faq_breakfast_time + examples: | + - what is the time for breakfast? + - time for doing breakfast? + - what are the breakfast timings? + - can you tell me about timings of breakfast? + - tell me about breakfast timings + - want to know about breakfast timings + - breakfast timings what are they? + - what is the time for breakfast? + - when is breakfast served? + - which time is the breakfast served? + - you serve breakfast at what time? + - what is the timing for breakfast? diff --git a/app/data/nlu/nlu _mood.yml b/app/data/nlu/nlu _mood.yml new file mode 100644 index 0000000000000000000000000000000000000000..cf0d90b6af54466999f0ef0c560c4354f78b6dbc --- /dev/null +++ b/app/data/nlu/nlu _mood.yml @@ -0,0 +1,88 @@ +version: "3.1" +nlu: + - intent: mood_great + examples: | + - perfect + - very good + - great + - amazing + - wonderful + - I am feeling very good + - I am great + - I'm good + - feeling like a king + - I am amazing + - I am going to save the world + - super stoked + - extremely good + - so so perfect + - so good + - so perfect + - fantastic + - excellent + - over the moon + - on cloud nine + - couldn't be better + - I'm on top of the world + - feeling wonderful + - feeling awesome + - in a good mood + - super happy + - full of joy + - I feel amazing + - everything is great + - loving life + - feeling ecstatic + - very pleased + - totally stoked + - just fabulous + - I feel awesome + - feeling unstoppable + + - intent: mood_unhappy + examples: | + - sad + - very sad + - unhappy + - bad + - very bad + - awful + - terrible + - not very good + - extremely sad + - so sad + - my day was horrible + - I am sad + - I don't feel very well + - I am disappointed + - super sad + - I'm so sad + - very sad + - not good + - so saad + - a little down + - grumpy + - feeling down + - feeling blue + - miserable + - depressed + - gloomy + - heartbroken + - down in the dumps + - not feeling great + - not in a good mood + - feeling terrible + - feeling awful + - not okay + - in a bad mood + - feeling upset + - feeling low + - I feel miserable + - everything is terrible + - feeling bummed out + - not happy + - pretty sad + - feeling hopeless + - just awful + - feeling rotten + - I feel awful diff --git a/app/data/nlu/nlu _out_of_scope.yml b/app/data/nlu/nlu _out_of_scope.yml new file mode 100644 index 0000000000000000000000000000000000000000..59f008f85b3aed3dd466d9bdf679826703ed0c28 --- /dev/null +++ b/app/data/nlu/nlu _out_of_scope.yml @@ -0,0 +1,527 @@ +version: "3.1" +nlu: + - intent: out_of_scope_non_english + examples: | + - Wie fange ich mit Rasa an? + - hilf mir beim start + - tschüssikowski + - ¿Qué pasa? + - ça va ? + - como te llamas + - wer bist Du? + - como inicio en rasa + - come stai? + - como estas + - de donde eres + - de que lugar eres? + - epdi iruka + - eres humana + - kalhmera sara ti kaneis + - kannst du auch deutsch? + - kannst du dies auch auf deutsch? + - oui je besoine de l'aide + - que puedes hacer? + - tu parles francais? + - tudo bom + - tu pagal + - kannst du mir helfen + - tu kaisi he + - こにちは + - 日本語分かる? + - chào + - 你好 + - I'm speaking a non-english language. + - 呵呵 + - 我该如何使用 + - 你懂中文吗? + - 您好 + - 你叫什么名字 + - 你是谁 + - 中文 + - kya hindi me bat kar sakate ho + - Dumme sara + - αστεία λές + - rasa codigo abierto + - 卧槽 + - ¿Cómo estás? + - ¿Qué haces? + - ¿Dónde vives? + - おはよう + - こんばんは + - どうもありがとう + - 私は元気です + - Salut + - Ça va bien, merci + - Comment tu t'appelles ? + - Guten Tag + - Wie geht's? + - Hilfe + - Ciao + - Buongiorno + - Grazie + - Come va? + - Dove abiti? + - Tudo bem? + - Como vai? + - Você fala inglês? + - Você fala português? + - 안녕하세요 + - 잘 지내세요? + - 어떻게 지내세요? + - 어떻게 도와드릴까요? + - 여보세요 + - bạn khỏe không + - Bạn tên là gì? + - Xin chào + - Как дела? + - Привет + - Здравствуйте + - Как тебя зовут? + - Ты говоришь по-русски? + - Нормально + - Хорошо + - Danke + - Merci + - Gracias + - ありがとう + - 고마워 + - 谢谢 + - Спасибо + - شكرا + - تشكرات + - متشکرم + - الشكر + - شکریہ + - धन्यवाद + - ধন্যবাদ + - நன்றி + - ಧನ್ಯವಾದ + - ధన్యవాదాలు + - நன்றி + + - intent: out_of_scope_other + examples: | + - I am asking you an out of scope question + - 4 + 2 = ? + - After registration I see that I have an available balance of 0.00000000. What does this balance represent? + - Are you ready? + - But you're an english site :( + - Can I ask you questions first? + - Can I die + - Can YouTube talk? + - Can you call me back ? + - Can you give me your datacenter's password + - Can you give me your datacenter's password? + - Can you make sandwiches? + - Can you please send me an uber + - Do I have to accept? + - Do you know + - Have we met before? + - HomeBase is advertised as a community. Is there a way to interact with other members of the community? + - How long does it take to set up a Rasa bot? + - I already told you! I'm a shitmuncher + - I am User + - I am an opioid addic + - I am an opioid addict + - I am hungry + - I am trying to build one, and did some research before, but I have not do hand-on work yet + - I can barely see this white text on light gray background ... + - I changed my mind + - I have installed it + - I ned a GP in 94301 + - I need a GP in 94301 + - I need a girl friend! + - I wan to buy a plane + - I wanna marry you + - I want a new laptop + - I want french cuisine + - I want to die + - I want to use pipe + - I will check + - I'm a shitmuncher + - Is Rasa really smart? + - Is this Goal-Oriented Chatbot? + - Is today saturday? + - Mail me the guide + - NLW + - Nice name + - Now? + - Recharge + - The Try it out is not working + - Today + - Try it out broken + - What day is it today? + - What did you eat yesterday? + - What do you prefer? + - What is todays date + - What is your hobbies? + - What makes you better than a human? + - What's 1 + 1? + - What's do YouTube do + - What's your backend system? + - Where am I right now? + - Where am I? + - Who ? + - Who are your customers + - Why don’t you answer? + - Why is my TRUST score set to 50 after I completed the registration process? + - Won't you ask me how I am? + - You'r blue. + - a tamed mouse will arrive at your doorstep in the next couple of days + - aRE YOU SINGLE + - again? + - alexa, order 5 tons of natrium chloride + - and make chicken noises into the phone + - are the newsletter worth the subscription? + - are u facebook + - are u, facebook? + - are you single? + - are you dev? + - are you russian? + - are you sick + - are you vegan + - better than you + - book a ticket + - but I just told you that :( + - but if rasa is open source why do you have a sales team + - buy one please + - buy groceries + - call me father + - can we keep chatting? + - can you cheer me up + - can you help me with the docs? + - can you help me with your docs + - can you help me with your docs? + - can you learn from our conversation? + - can you speak about politic ? + - can you understand ? + - cannot see + - chgfhgh + - chinese ok? + - colder + - common, just try + - connect to alexa + - cr + - custom service + - did i break you + - dinner + - do you believe in god? + - do you have a phone number? + - do you have your photo? + - do you know me + - do you know ras + - do you liek cheese? + - do you like football + - do you like movies + - do you sell vacuum robots? + - do you want to marry me? + - docs + - doctor + - everything + - example of a chatbot + - genocide + - get me a club mate + - give me a girl friend + - give me food + - go back + - google? + - great, I'd like to buy a house + - hang on let me find it + - help with my life + - hey little mama let em whisper in your ear + - hey, I contacted you a couple of days ago but didn't get any response, any news? + - how + - how about NYC + - how are the kids + - how can i get them? + - how can i test this + - how come you say ok ? + - how do you learn + - how good is Rasa + - how it compares to alexa + - how long have you been online? + - how long will the next version will launch? + - how many lines of codes + - how much is 10 + 89 ? + - how much is 10 + 89 + - how to get rasa studio + - how to go to newyork ? + - i am not a developer but need this for business + - i am qq + - i can't deal with _your_ request + - i do not care how are you + - i hope you will be better + - i immediately need help with implementing the coolest bot you can imagine + - i m looking for job + - i told you already + - i wanna party + - i want a non dripping ice cream + - i want caffe + - i want good flycam + - i want more of you in my life! + - i want to buy a roomba for my grandson + - i want to find new friends + - i want to find out what you can build with rasa + - i want to know current situtation in pakistan + - i want to see your happy customers + - i will tame a mouse for you + - is it a wasteland full of broken robot parts? + - is it allow to + - is rasa a studio? + - is rasa any good + - is that any of your business + - isn't the newsletter just spam? + - it's a pity + - i´m hungry + - license + - ljljl + - lunch + - lunch?? + - machine learning + - mail me the steps + - mascot means? + - more + - mountain + - my name k + - no wait go back i want a dripping ice cream but a cone that catches it so you can drink the ice cream later + - offer me lunch + - oh my god, not again! + - oh wait i gave you my work email address can i change it? + - ok one then + - on wiche nlp based system are you build? + - only that? + - order good + - personal or work? + - please hurry, i have deadline in two weeks to deliver the bot it is for very big company + - please play music + - rasa topics + - really? you're so touchy? + - refresh + - region with no. of records + - remember my name + - search wikipedia + - shitmuncher + - show me a picture of a chicken + - silly bot + - sing me a song + - so, I'm helping right now to training you? + - some thing else + - someone call the police i think the bot died + - sorry, i cannot rephrase + - sudo make me a sandwich + - tell me about yourself + - tell me more about next best action + - that doesn't sound like a joke + - that link doesn't work! + - the one that is better than you + - tricked ya + - turn off my stove + - umm + - wait a bit i am still reading + - what are contextual AI assistants and how different are they from chatbots? + - what are you doing now? + - what are your uses for universities + - what did you eat for lunch? + - what do oyu think about siri? + - what do you think abou siri? + - what do you think about [Stanley Ramirez](name)? + - what do you think of alexa + - what does your soul feel my friend + - what doing + - what else? + - what films do you like + - what i do after cd starter-pack-rasa-stack? + - what is a discourse? + - what is a mascot + - what is adlingo + - what is differance between bot and mascot? + - what is evolution ? + - what is google rcs + - what is machine learning + - what is nice? + - what is the capital of delhi + - what is the capital of india + - what is the current petrol price + - what is the day ? + - what is the real use case where we can use this one + - what is your address? + - what is your purpose + - what lnu mean? + - what the latest news ? + - what you ate today? + - what's 5 + 5 + - what's a newsletter? + - what's gingerale + - what's your wife doing this weekend + - what? + - whats that + - whats the sign + - when is the next train is coming? + - where do i get install files for mac? + - where is Oslo? + - where is mexico? + - wheres the party? + - which city are you talking about? + - which file is created first while developing chat bot + - which is the LNU asynchronism ? + - which kind + - who are the engineers at rasa? + - who are they? + - who is the MD of samsung bangalore ? + - who is the president of india ? + - who is your favourite robot? + - who let the dog out + - who was hitler + - who will anser my email? + - who's Bill Gates? + - whta you think about gdpr? + - why do you need that? + - why its called rasa ? + - will u kill me + - will u kill me? + - winter is already leaving + - with you recommend me? + - would you like some water + - yeah, my dog was drinking a couple of litres of water per day and tried drinking the swimming pool + - you already have that + - you can learn how to make a coffe + - you have children? + - you have job opening + - you lock sweety + - you should learn to count + - you will know it from the single red rose it carries between its teeth + - you're a woman + - ı am learning python + - CALL THE POLICE + - tertyryutyi + - wsdrcftvgybhnj + - why sky is blue? + - what kind of bird are you? + - contextua + - contextual + - talk to me about voulette + - voulette voulette + - Do you have a demo? + - Cars + - please voulette + - Out of scope question. + - i need money + - no, i need cash, money! Do you have it ? + - the beatles + - Hi i want to go palghar + - I want to go palghar + - your contry name + - you girl + - gsaf + - expert of rasa + - i want play ball + - flight catch up + - how do you like your coffee + - Can you get analytics on who I'm chatting with when I use Rasa + - coronavirus + - have you heard of corona? + - where do i type in commandy + - where to type in commands + - kiss me + - you have to + - what type of bot? + - sfasd + - asdkjasdhjkasd + - j bhbhj + - eshdtjfjfyk + - drhdtjfjfyj + - sudo reboot + - asdfgasd + - asdfgasdas + - Can you read my mind? + - What color is the sky? + - Do you have a favorite book? + - What's the meaning of life? + - Can you do my homework? + - Tell me a joke. + - Do you believe in aliens? + - How do you cook spaghetti? + - What's your favorite movie? + - Can you solve a Rubik's cube? + - What's your favorite color? + - How do you feel today? + - Do you dream? + - Can you play chess? + - Do you like pizza? + - Can you drive a car? + - What's the weather like on Mars? + - Do you have any pets? + - What's your favorite song? + - Can you swim? + - Do you like sports? + - Can you dance? + - What's your opinion on global warming? + - Do you have a family? + - Can you fly? + - What's your favorite animal? + - Can you make me a cup of coffee? + - Do you like video games? + - What's your favorite food? + - Can you paint? + - Do you know any magic tricks? + - Can you write a poem? + - What's your favorite book? + - Can you sing? + - Do you know how to play the guitar? + - What's your favorite holiday? + - Can you tell me a bedtime story? + - What's your favorite quote? + - Can you bake a cake? + - Do you like to travel? + - What's your favorite TV show? + - Can you sew? + - Do you believe in ghosts? + - What's your favorite drink? + - Can you build a robot? + - Do you have a nickname? + - What's your favorite city? + - Can you juggle? + - Do you like to read? + - What's your favorite ice cream flavor? + - Can you skateboard? + - Do you like gardening? + - What's your favorite flower? + - Can you knit? + - Do you like hiking? + - What's your favorite season? + - Can you play the piano? + - Do you like dancing? + - What's your favorite dessert? + - Can you play an instrument? + - Do you like puzzles? + - What's your favorite game? + - Can you surf? + - Do you like camping? + - What's your favorite fruit? + - Can you write code? + - Do you like fishing? + - What's your favorite vegetable? + - Can you climb trees? + - Do you like painting? + - What's your favorite hobby? + - Can you run fast? + - Do you like cooking? + - What's your favorite sport? + - Can you jump high? + - Do you like singing? + - What's your favorite subject? + - Can you fly a kite? + - Do you like skiing? + - What's your favorite planet? + - Can you ride a horse? + - Do you like animals? + - What's your favorite superhero? + - Can you solve puzzles? + - Do you like robots? + - What's your favorite time of day? + - Can you play soccer? + - Do you like swimming? + - What's your favorite bird? + - Can you play basketball? + - Do you like music? + - What's your favorite song? diff --git a/app/data/nlu/nlu _resturant.yml b/app/data/nlu/nlu _resturant.yml new file mode 100644 index 0000000000000000000000000000000000000000..857376d36489155e33513ff5b31a62680d56da1a --- /dev/null +++ b/app/data/nlu/nlu _resturant.yml @@ -0,0 +1,28 @@ +version: "3.1" +nlu: + - intent: food_categories + examples: | + - Food types in the restaurant + - what type of food do you have + - can you show me the food categories you have + - what categories of food do you have + - what categories do you serve at the restaurant + + - intent: faq_restaurant_time + examples: | + - what are timings of your [restaurant](location)? + - what is the time of the [restaurant](location)? + - timings of [restaurant](location) + - [restaurant](location) open time + - [restaurant](location) open timings + - [restaurant](location) timings + - till when [restaurant](location) remain open? + - till what time will the [restaurant](location) remain open? + - can you share the timings of [restaurant](location)? + + - intent: ask_food_items + examples: | + - foods? + - food items? + - food categories? + - food items available? diff --git a/app/data/nlu/nlu.yml b/app/data/nlu/nlu.yml new file mode 100644 index 0000000000000000000000000000000000000000..d7e6cf8f60535779a545163077717129b86ff781 --- /dev/null +++ b/app/data/nlu/nlu.yml @@ -0,0 +1,115 @@ +version: "3.1" +nlu: + - intent: greet + examples: | + - hey + - hello + - hi + - good morning + - good evening + - hey there + - hello there + - heyo + - let's go + - hey dude + - goodmorning + - goodevening + - good afternoon + - moin + + - intent: affirm + examples: | + - yes + - indeed + - of course + - that sounds good + - correct + - affirmative + - ok + - okay + - for sure + - yeah + - yes sure + + - intent: deny + examples: | + - no + - never + - I don't think so + - don't like that + - no way + - not really + - one more thing + - no man + - nope + + - intent: goodbye + examples: | + - have a nice day! + - take care! + - have fun! + - adios! + - hasta la vista + - see ya + - cu + - good by + - cee you later + - good night + - goodbye + - have a nice day + - see you around + - see you later + + - intent: bot_challenge + examples: | + - are you a bot? + - are you a human? + - am I talking to a bot? + - am I talking to a human? + + - synonym: room + examples: | + - rooms + - Room + - Rooms + + - synonym: restaurant + examples: | + - restaurants + - Restaurants + - resturant + - restaurante + - resteraunt + - Resturant + - Restaurante + - Resteraunt + - resturants + - restaurantes + - resteraunts + - Resturants + - Restaurantes + - Resteraunts + + - synonym: standard + examples: | + - simple + - simpl + - Standard + - standart + + - synonym: deluxe + examples: | + - lux + - luxur + - Lux + - Luxur + - Deluxe + - delux + + - regex: affirm + examples: | + - ^(Yes|yes)\s?[^\s]\*$ + + - regex: deny + examples: | + - ^((No|no|nope)\s?[^\s]_)|([^\s]_\s?(No|no))$ diff --git a/app/data/rules/rules _hotel.yml b/app/data/rules/rules _hotel.yml new file mode 100644 index 0000000000000000000000000000000000000000..e1d5eb10d2ce04887163dbadc2617582011b6932 --- /dev/null +++ b/app/data/rules/rules _hotel.yml @@ -0,0 +1,12 @@ +version: "3.1" + +rules: + - rule: open time + steps: + - intent: open_days + - action: utter_opendays + + - rule: open hours + steps: + - intent: open_hours + - action: utter_openhours diff --git a/app/data/rules/rules _mood.yml b/app/data/rules/rules _mood.yml new file mode 100644 index 0000000000000000000000000000000000000000..0dc9ffb1c4bdf826841a4350d7d9e7b5126215af --- /dev/null +++ b/app/data/rules/rules _mood.yml @@ -0,0 +1,12 @@ +version: "3.1" + +rules: + - rule: Say goodbye anytime the user says goodbye + steps: + - intent: goodbye + - action: utter_goodbye + + - rule: Greet the user + steps: + - intent: greet + - action: utter_greet diff --git a/app/data/rules/rules _out_of_scope.yml b/app/data/rules/rules _out_of_scope.yml new file mode 100644 index 0000000000000000000000000000000000000000..dc6b91bb70fdb2b2fdf16c6d4430b78bf339e5fb --- /dev/null +++ b/app/data/rules/rules _out_of_scope.yml @@ -0,0 +1,12 @@ +version: "3.1" + +rules: + - rule: handle non-english queries + steps: + - intent: out_of_scope_non_english + - action: utter_out_of_scope_non_english + + - rule: handle out of scope + steps: + - intent: out_of_scope_other + - action: utter_out_of_scope_other diff --git a/app/data/rules/rules _resturant.yml b/app/data/rules/rules _resturant.yml new file mode 100644 index 0000000000000000000000000000000000000000..b5c0993f024daefe4ac9c10f13b5f2346859924f --- /dev/null +++ b/app/data/rules/rules _resturant.yml @@ -0,0 +1,7 @@ +version: "3.1" + +rules: + - rule: food categories request + steps: + - intent: food_categories + - action: utter_show_food_categories diff --git a/app/data/rules/rules.yml b/app/data/rules/rules.yml new file mode 100644 index 0000000000000000000000000000000000000000..a8679d74345c9194cf6b4d88de4f465dad4ced03 --- /dev/null +++ b/app/data/rules/rules.yml @@ -0,0 +1,7 @@ +version: "3.1" + +rules: + - rule: Respond to bot challenge + steps: + - intent: bot_challenge + - action: utter_iamabot diff --git a/app/data/stories/stories _hotel.yml b/app/data/stories/stories _hotel.yml new file mode 100644 index 0000000000000000000000000000000000000000..60b5a5af71451311369f9e490c2556089834ab42 --- /dev/null +++ b/app/data/stories/stories _hotel.yml @@ -0,0 +1,322 @@ +version: "3.1" +stories: + - story: Book room deny path + steps: + - intent: greet + - action: utter_greet + - intent: book_room + entities: + - location: room + - action: form_book_room + - active_loop: form_book_room + - active_loop: null + - action: action_reset_slots + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Book number room path affirm 1 + steps: + - intent: greet + - action: utter_greet + - intent: book_number_room + entities: + - location: room + - number: "1" + - slot_was_set: + - number: "1" + - action: form_book_room_number + - active_loop: form_book_room_number + - active_loop: null + - action: action_reset_slots + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Book number room path deny 1 + steps: + - intent: greet + - action: utter_greet + - intent: book_number_room + entities: + - location: room + - number: "1" + - slot_was_set: + - number: "1" + - action: form_book_room_number + - active_loop: form_book_room_number + - active_loop: null + - action: action_reset_slots + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Book number room path affirm 2 + steps: + - intent: greet + - action: utter_greet + - intent: book_number_room + entities: + - location: room + - number: "2" + - slot_was_set: + - number: "2" + - action: form_book_room_number + - active_loop: form_book_room_number + - active_loop: null + - action: action_reset_slots + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Book number room path deny 2 + steps: + - intent: greet + - action: utter_greet + - intent: book_number_room + entities: + - location: room + - number: "2" + - slot_was_set: + - number: "2" + - action: form_book_room_number + - active_loop: form_book_room_number + - active_loop: null + - action: action_reset_slots + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Clean room now path affirm + steps: + - intent: greet + - action: utter_greet + - intent: clean_room + entities: + - location: room + - action: utter_clean_room + - intent: clean_room_now + - action: utter_clean_room_now + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Clean room now path deny + steps: + - intent: greet + - action: utter_greet + - intent: clean_room + entities: + - location: room + - action: utter_clean_room + - intent: clean_room_now + - action: utter_clean_room_now + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Clean room relative path affirm + steps: + - intent: greet + - action: utter_greet + - intent: clean_room + entities: + - location: room + - action: utter_clean_room + - intent: clean_room_relative + - action: utter_clean_room_relative + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Clean room relative path deny + steps: + - intent: greet + - action: utter_greet + - intent: clean_room + entities: + - location: room + - action: utter_clean_room + - intent: clean_room_relative + - action: utter_clean_room_relative + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Faq check in time affirm + steps: + - intent: greet + - action: utter_greet + - intent: faq_check_in_time + - action: utter_check_in_time + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Faq check in time deny + steps: + - intent: greet + - action: utter_greet + - intent: faq_check_in_time + - action: utter_check_in_time + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Faq check out time affirm + steps: + - intent: greet + - action: utter_greet + - intent: faq_check_out_time + - action: utter_check_out_time + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Faq check out time deny + steps: + - intent: greet + - action: utter_greet + - intent: faq_check_out_time + - action: utter_check_out_time + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Faq cancel reservation affirm + steps: + - intent: greet + - action: utter_greet + - intent: faq_cancel_reservation + - action: utter_cancel_reservation + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Faq cancel reservation deny + steps: + - intent: greet + - action: utter_greet + - intent: faq_cancel_reservation + - action: utter_cancel_reservation + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Faq cancellation policy affirm + steps: + - intent: greet + - action: utter_greet + - intent: faq_cancellation_policy + - action: utter_cancellation_policy + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Faq cancellation policy deny + steps: + - intent: greet + - action: utter_greet + - intent: faq_cancellation_policy + - action: utter_cancellation_policy + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Faq have restaurant path affirm + steps: + - intent: greet + - action: utter_greet + - intent: faq_have_restaurant + entities: + - location: restaurant + - action: utter_have_restaurant + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Faq have restaurant path deny + steps: + - intent: greet + - action: utter_greet + - intent: faq_have_restaurant + entities: + - location: restaurant + - action: utter_have_restaurant + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Faq breakfast availability affirm + steps: + - intent: greet + - action: utter_greet + - intent: faq_breakfast_avail + - action: utter_breakfast_avail + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Faq breakfast availability deny + steps: + - intent: greet + - action: utter_greet + - intent: faq_breakfast_avail + - action: utter_breakfast_avail + - action: utter_is_that_all + - intent: deny + - action: utter_deny_message + + - story: Faq breakfast time affirm + steps: + - intent: greet + - action: utter_greet + - intent: faq_breakfast_time + - action: utter_breakfast_time + - action: utter_is_that_all + - intent: affirm + - action: utter_goodbye + + - story: Faq breakfast time deny + steps: + - intent: greet + - action: utter_greet + - intent: faq_breakfast_time + - action: utter_breakfast_time + - action: utter_is_that_all + - intent: deny + - action: utter_d + + - story: book room path + steps: + - intent: book_room + - action: form_book_room + - active_loop: form_book_room + - intent: affirm + - action: utter_submit + - action: action_reset_slots + + - story: Check-in time + steps: + - intent: faq_check_in_time + - action: utter_faq_check_in_time + + - story: Check-out time + steps: + - intent: faq_check_out_time + - action: utter_faq_check_out_time + + - story: Number of rooms + steps: + - intent: num_rooms + - action: utter_ask_number + + - story: Type of rooms + steps: + - intent: type_rooms + - action: utter_ask_room_type + + - story: room image story + steps: + - intent: ask_room_image + - action: action_show_room_image diff --git a/app/data/stories/stories _mood.yml b/app/data/stories/stories _mood.yml new file mode 100644 index 0000000000000000000000000000000000000000..aacf937a3ebff16edc6b9c2375a8b5e84370d96a --- /dev/null +++ b/app/data/stories/stories _mood.yml @@ -0,0 +1,28 @@ +version: "3.1" +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 diff --git a/app/data/stories/stories.yml b/app/data/stories/stories.yml new file mode 100644 index 0000000000000000000000000000000000000000..3c0024d8d4af15cbcb16a8744f9eae5d7e33729b --- /dev/null +++ b/app/data/stories/stories.yml @@ -0,0 +1,6 @@ +version: "3.1" +stories: + - story: Fallback message story + steps: + - intent: nlu_fallback + - action: utter_fallback_message diff --git a/app/data/stories/stories_resturant.yml b/app/data/stories/stories_resturant.yml new file mode 100644 index 0000000000000000000000000000000000000000..3e5dc0e7c34b328b6702fc60e84459d2577391a3 --- /dev/null +++ b/app/data/stories/stories_resturant.yml @@ -0,0 +1,11 @@ +version: "3.1" +stories: + - story: Restaurant time + steps: + - intent: faq_restaurant_time + - action: utter_restaurant_time + + - story: Food items story + steps: + - intent: ask_food_items + - action: utter_food_items diff --git a/app/dev-requirements.txt.txt b/app/dev-requirements.txt.txt new file mode 100644 index 0000000000000000000000000000000000000000..8133e51bb9356d2792cc0ffbfbd8d169fade5677 --- /dev/null +++ b/app/dev-requirements.txt.txt @@ -0,0 +1 @@ +pylint==2.17.5 \ No newline at end of file diff --git a/app/domain.yml b/app/domain.yml new file mode 100644 index 0000000000000000000000000000000000000000..68822932dbc578a7b403c2aba3439d9d055f0c54 --- /dev/null +++ b/app/domain.yml @@ -0,0 +1,225 @@ +version: "3.1" + +session_config: + session_expiration_time: 60 + carry_over_slots_to_new_session: true + +intents: + - greet + - affirm + - deny + - goodbye + - nlu_fallback + - bot_challenge + + ############################## Mood ######################### + - mood_great + - mood_unhappy + + ############################## Hotel ######################## + - open_days + - open_hours + - book_room + - num_rooms + - type_rooms + - book_number_room + - clean_room + - clean_room_now + - clean_room_relative + - faq_check_in_time + - faq_check_out_time + - faq_cancel_reservation + - faq_cancellation_policy + - faq_have_restaurant + - faq_breakfast_avail + - faq_breakfast_time + - faq_restaurant_time + - ask_room_image + + ############################## Resturant ######################## + + - food_categories + - ask_food_items + + ############################## Out of scope ######################## + - out_of_scope_non_english + - out_of_scope_other + +entities: + - number + - location + - room_type + +slots: + number: + type: any + mappings: + - type: from_entity + entity: number + room_type: + type: any + mappings: + - type: from_entity + entity: room_type + # food_category: + # type: text + # mappings: + # - type: from_entity + # entity: food_category + # package: + # type: text + # mappings: + # - type: from_entity + # entity: package + +responses: + utter_greet: + - text: Hey! How can I help you? + - text: Hey there! How can I help you, today? + - text: Hey! How are you? + - text: "Hello! How can I assist you today?" + + utter_submit: + - text: "Your room(s) have been booked. Number of {room_type} rooms booked: {number}" + + utter_ask_number: + - buttons: + - payload: /num_rooms{"number":"1"} + title: "1" + - payload: /num_rooms{"number":"2"} + title: "2" + text: Select the number of rooms you want to book + + utter_ask_room_type: + - buttons: + - payload: /type_rooms{"room_type":"Simple"} + title: Simple + - payload: /type_rooms{"room_type":"Deluxe"} + title: Deluxe + text: Select from one of the room types + + utter_clean_room: + - text: When do you want to clean your room? + + utter_clean_room_now: + - text: Someone is being sent to your room ASAP! + + utter_clean_room_relative: + - text: Someone will be sent at your required time! + + utter_check_in_time: + - text: + Check-in time starts at 4 PM. Minimum check-in age is 21. Please contact + the reception for early check-in requests. + + utter_check_out_time: + - text: + Check-out time is 11 AM. Please contact the reception for late checkout + requests. + + utter_cancel_reservation: + - text: To cancel a reservation, select the “Reservations” link from the homepage. + - text: + On the Reservations page, under the heading ‘View, Change or Cancel a Reservation,’enter + your confirmation number, and either the last name on the reservation or the + last four digits of the credit card used to make the reservation. + + utter_cancellation_policy: + - text: + The booking deposit is refundable if the cancellation occurs at least 15 + days before arrival. For cancellations made after this limit, a penalty will + be imposed based on the cancellation policy. + + utter_have_restaurant: + - text: + Yes, the hotel has a restaurant called the Zephyr Bar. With our menu we + strive to reflect the historic art and the spirit of our neighborhood by offering + a glimpse into what makes our area unique. + + utter_breakfast_avail: + - text: The hotel provides its guests with a free made-to-order breakfast each morning. + + utter_breakfast_time: + - text: + Monday through Friday breakfast is 6 am to 9 am. On Saturday and Sunday, + we are open from 7 am to 10:30 am. + + utter_restaurant_time: + - text: Our restaurant serves a dazzling 24-hour menu. + + utter_is_that_all: + - text: Would that be all? + + utter_goodbye: + - text: Ok then! Have a nice day! + - text: "Goodbye! Have a great day." + + utter_deny_message: + - text: How can I help you? + + utter_fallback_message: + - text: Sorry, I did not understand. Can you rephrase? + + utter_faq_check_in_time: + - text: "Check-in time is at 2 PM." + utter_faq_check_out_time: + - text: "Check-out time is at 11 AM." + utter_d: + - text: "Your text here" + utter_iamabot: + - text: "I am a bot, powered by Rasa." + + utter_openhours: + - text: "We are opened in the afternoons from 12:00 p.m to 3:00 p.m and in the evenings from 7:30 p.m to 10:30 p.m" + + utter_opendays: + - text: "Our Restaurant is open for you everyday" + + utter_food_items: + - text: "The {category} types we have in our restaurant are....{food_items}" + utter_show_food_categories: + - text: "Here are some Sri Lankan food categories: kottu, rice, and other local dishes." + utter_happy: + - text: "I'm glad to hear that!" + - text: "Great to know you're happy!" + - text: "That’s wonderful!" + - text: "Awesome!" + + utter_cheer_up: + - text: "Cheer up! Everything will be okay." + - text: "Don't worry, things will get better." + - text: "Keep your chin up! Better days are coming." + - text: "Stay positive, things will improve." + + utter_did_that_help: + - text: "Did that help you?" + - text: "Is there anything else I can assist you with?" + - text: "Was this information useful?" + - text: "Hope that answered your question! Need any more help?" + utter_out_of_scope_non_english: + - text: "I only understand English, I'm sorry." + utter_out_of_scope_other: + - text: "I can't help you with that, I'm sorry." + +actions: + - action_show_food_categories + - action_reset_slots + - action_my_fallback + - action_check_in_time + - action_check_out_time + - action_cancel_reservation + - action_cancellation_policy + - action_have_restaurant + - action_breakfast_avail + - action_breakfast_time + - action_restaurant_time + - action_show_room_image + +forms: + form_book_room: + required_slots: + - number + - room_type + form_book_room_number: + required_slots: + - room_type diff --git a/app/endpoints.yml b/app/endpoints.yml new file mode 100644 index 0000000000000000000000000000000000000000..43783d579b2fd6cc9f0e9286c8fc9c782f054fd0 --- /dev/null +++ b/app/endpoints.yml @@ -0,0 +1,69 @@ +# This file contains the different endpoints your bot can use. + +# Server where the models are pulled from. +# https://rasa.com/docs/rasa/user-guide/configuring-http-api/#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/core/actions/#custom-actions/ + +# action_endpoint: +# url: "http://localhost:5055/webhook" + +# action_endpoint: +# url: "http://docker-action_server-1:5055/webhook" + +action_endpoint: + url: "http://action_server:5055/webhook" + +# Tracker store which is used to store the conversations. +# By default the conversations are stored in memory. +# https://rasa.com/docs/rasa/api/tracker-stores/ + +# if running locally wih shell command - sqlite is probably a good way to start clean +# tracker_store: +# type: SQL +# dialect: "sqlite" # the dialect used to interact with the db +# url: +# db: "rasa.db" # path to your db +# username: # +# password: # +# query: # optional dictionary to be added as a query string +# driver: my-driver + +# server based SQL database tracker store connectiing to the conversation logs +# run startsql.sh for connecting to the database via postgresql +tracker_store: + type: SQL + dialect: "postgresql" + url: ${DB_HOST} + port: ${DB_PORT} + username: ${DB_USER} + password: ${DB_PASSWORD} + db: ${DB_DATABASE} +#tracker_store: +# type: redis +# url: +# port: +# db: +# password: +# use_ssl: + +#tracker_store: +# type: mongod +# url: +# db: +# username: +# password: + +# Event broker which all conversation events should be streamed to. +# https://rasa.com/docs/rasa/api/event-brokers/ + +#event_broker: +# url: localhost +# username: username +# password: password +# queue: queue diff --git a/app/requirements.txt b/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f12695d7c1077fecdf3a27d9a77619f72030063 --- /dev/null +++ b/app/requirements.txt @@ -0,0 +1,3 @@ +pyspellchecker +regex +sqlalchemy<2.0 diff --git a/app/resources/de.json.gz b/app/resources/de.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..25dbea43f2fa102e9c8a91a76438cf2c3212cdcd --- /dev/null +++ b/app/resources/de.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:815df1e58f5073c7c64aa5e58874d16ce07ada5846594a931a8feef5e6b4d27d +size 238581 diff --git a/app/resources/hotel_lex.txt b/app/resources/hotel_lex.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd135a2a4966458ed4a2bb2295aaeee84901f83c --- /dev/null +++ b/app/resources/hotel_lex.txt @@ -0,0 +1,2 @@ +'lobby' +'hotelboy' diff --git a/app/tests/test_stories.yml b/app/tests/test_stories.yml new file mode 100644 index 0000000000000000000000000000000000000000..9e17f6ee86bb9cd7011a8a9feac810ddd8c0167d --- /dev/null +++ b/app/tests/test_stories.yml @@ -0,0 +1,20 @@ +version: "3.1" +stories: +- story: Happy path + steps: + - user: | + hi + intent: greet + - action: utter_greet + - user: | + I want to book a [room](location) + intent: book_room{"location":"room"} + - action: form_book_room + - active_loop: form_book_room + - active_loop: null + - action: action_reset_slots + - action: utter_is_that_all + - user: | + indeed + intent: affirm + - action: utter_goodbye diff --git a/docker/Dockerfile.action b/docker/Dockerfile.action new file mode 100644 index 0000000000000000000000000000000000000000..a0eacb8a6150bb33fc012d5fc172996eaa54a11c --- /dev/null +++ b/docker/Dockerfile.action @@ -0,0 +1,18 @@ +# Extend the official Rasa SDK image +FROM rasa/rasa-sdk:latest + +# Use subdirectory as working directory +WORKDIR /app + +# Copy any additional custom requirements, if necessary (uncomment next line) +# COPY requirements_actions.txt ./ + +# Change back to root user to install dependencies +USER root + +# Install extra requirements for actions code, if necessary (uncomment next line) +RUN python -m pip install --upgrade pip +# RUN pip install -r requirements_actions.txt + +# # Run Rasa actions server +CMD ["start", "--actions", "actions"]# Extend the official Rasa SDK image diff --git a/docker/Dockerfile.rasa b/docker/Dockerfile.rasa new file mode 100644 index 0000000000000000000000000000000000000000..6206a0c3ce8ef71b2f5f0039b6b8ed882d88fc90 --- /dev/null +++ b/docker/Dockerfile.rasa @@ -0,0 +1,24 @@ +# build upon the latest version of the rasa api +FROM rasa/rasa:latest + +# root permissions +USER root + +# Copy application code +COPY . /app +COPY ./app/requirements.txt ./ + +# Install spellchecking package and other requirements +RUN python -m pip install --upgrade pip +RUN pip install -r app/requirements.txt + +WORKDIR /app + +# Train the Rasa model +RUN rasa train --domain app/domain.yml --data app/data --out app/models --config app/configs/config_supervised.yml --augmentation 20 + +# By best practices, don't run the code with root user +USER 1001 + +# # Run Rasa +CMD ["run", "--enable-api", "--cors", "*"] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..a36ba58ec7dafb4da5ad99948bdc27eb85431392 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,74 @@ +version: '3.8' +services: + nginx: + image: nginx:latest + container_name: "rasa-nginx" + restart: "always" + ports: + - "80:80" + volumes: + - "../nginx/index.html:/usr/share/nginx/html/index.html" + - "../nginx/default.conf:/etc/nginx/conf.d/default.conf" + networks: + - rasa-network + + rasa: + image: rasa_custom:2.0 + build: + context: "../app" + container_name: "rasa" + restart: "always" + ports: + - "5005:5005" + volumes: + - "../app/data:/app/data" + - "../app/models:/app/models" + - "../app/credentials.yml:/app/credentials.yml" + - "../app/endpoints.yml:/app/endpoints.yml" + - "../app/domain.yml:/app/domain.yml" + - "../app/configs:/app/config" + environment: + DB_HOST: db + DB_PORT: "5432" # Replace with your PostgreSQL port + DB_USER: admin # Replace with your PostgreSQL username + DB_PASSWORD: admin # Replace with your PostgreSQL password + DB_DATABASE: rasa # Replace with your PostgreSQL database name + depends_on: + - db + networks: + - rasa-network + + action_server: + image: rasa_action:2.0 + build: + context: "../app/actions" + container_name: "rasa-actions" + restart: "always" + ports: + - "5055:5055" + volumes: + - "../app/actions:/app/actions" + networks: + - rasa-network + + db: + restart: always + image: "postgres:latest" # Use the latest PostgreSQL image + ports: + - "5432:5432" + environment: + POSTGRES_USER: "admin" # Set your desired username + POSTGRES_PASSWORD: "admin" # Set your desired password + POSTGRES_DB: "rasa" # Set your desired database name + volumes: + - ./db:/var/lib/postgresql/data # Persist data outside the container + healthcheck: + test: ["CMD-SHELL", "pg_isready -U admin"] + interval: 10s + timeout: 5s + retries: 5 + +networks: + rasa-network: + driver: bridge + diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000000000000000000000000000000000000..e7240edfd6c3eb5bfc335a4d74700aa6f715962e --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,42 @@ +server { + listen 80; + + # Proxy configuration + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_connect_timeout 7200; + proxy_send_timeout 7200; + + # widget + location / { + root /usr/share/nginx/html; + index index.html; + } + + # rasa core + location /core/ { + proxy_pass http://rasa:5005/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + # rasa actions + location /actions/ { + proxy_pass http://action_server:5055/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + # socket.io + location /socket.io/ { + proxy_pass http://rasa:5005; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-real-ip $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + } +} diff --git a/nginx/index.html b/nginx/index.html new file mode 100644 index 0000000000000000000000000000000000000000..d32dafceaeee5852bde14860133414d9f9f76b44 --- /dev/null +++ b/nginx/index.html @@ -0,0 +1,84 @@ + + + + + + + + LLM Powered Bot Responses & Prompt Management + + + + + + + +
+


LLM Powered Bot Responses
& Prompt Management

+
+ +

By Ishara & Dinushi

+ +

Rasa LLM Community Challenge

+

27 July, 2023

+
+
+
+ + + + \ No newline at end of file diff --git a/scripts/init.bat b/scripts/init.bat new file mode 100644 index 0000000000000000000000000000000000000000..2a16b5f791396f342302bac12fc39f221dea2b08 --- /dev/null +++ b/scripts/init.bat @@ -0,0 +1,7 @@ +::cd .. +:: Initiate permissions and folder creations +mkdir scripts\models +icacls scripts\models /grant Everyone:(OI)(CI)F + +mkdir scripts\db +icacls scripts\db /grant Everyone:(OI)(CI)F diff --git a/scripts/init.sh b/scripts/init.sh new file mode 100644 index 0000000000000000000000000000000000000000..b47ff74c221e934a8ad50d71a63ba5b98ff71cdd --- /dev/null +++ b/scripts/init.sh @@ -0,0 +1,6 @@ +#cd .. +# initiate persmissions and folder recreations +mkdir -p models +chmod -R 777 models +mkdir -p db +chmod -R 777 db diff --git a/scripts/start.bat b/scripts/start.bat new file mode 100644 index 0000000000000000000000000000000000000000..8d2aafb2f3e33c4705541663ce0869a191ab1cdf --- /dev/null +++ b/scripts/start.bat @@ -0,0 +1,8 @@ +::cd .. +:: Build the Rasa and Action server Docker images + +docker build -t rasa_custom:2.0 -f .\docker\Dockerfile.rasa . +docker build -t rasa_action:2.0 -f .\docker\Dockerfile.action . + +:: Start the Docker containers using docker-compose +docker-compose -f .\docker\docker-compose.yml up -d diff --git a/scripts/start.sh b/scripts/start.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ff5ed72d37c1ca0f3a9d4fbeed2077e0cf81f3a --- /dev/null +++ b/scripts/start.sh @@ -0,0 +1,11 @@ +#!/bin/bash +#cd .. + +# Build the Rasa and Action server Docker images +docker build -t rasa_custom:2.0 -f ./docker/Dockerfile.rasa . +docker build -t rasa_action:2.0 -f ./docker/Dockerfile.action . + +# Start the Docker containers using docker-compose +docker-compose -f ./docker/docker-compose.yml up -d + +rasa run actions --actions app/actions --cors "*" \ No newline at end of file diff --git a/scripts/startSql.bat b/scripts/startSql.bat new file mode 100644 index 0000000000000000000000000000000000000000..b16d9c474158d2d00914f938d1382cee22289375 --- /dev/null +++ b/scripts/startSql.bat @@ -0,0 +1,5 @@ +:: startSql.bat +::cd .. +:: enter the database in db via psql for the given credentials +:: the password can be seen in the endpoints.yml or docker-compose.yml files +psql -h localhost -U admin rasa diff --git a/scripts/startSql.sh b/scripts/startSql.sh new file mode 100644 index 0000000000000000000000000000000000000000..81be6a267675c255151eb7928ad2b9e4f9900e2c --- /dev/null +++ b/scripts/startSql.sh @@ -0,0 +1,5 @@ +# enters the database in db via psql for the given credentials +# the password can be seen in the endpoints.yml or docker-compose.yml files +#cd .. +psql -h localhost -U admin rasa + diff --git a/scripts/stop.bat b/scripts/stop.bat new file mode 100644 index 0000000000000000000000000000000000000000..56ec5c3b9238530b4a37b199949add1f5306a27f --- /dev/null +++ b/scripts/stop.bat @@ -0,0 +1,8 @@ +:: Stop Docker containers +docker-compose -f .\docker\docker-compose.yml stop + +:: Remove Docker containers +::docker-compose -f .\docker\docker-compose.yml rm -f + +:: Clean up unused Docker resources +::docker system prune --volumes diff --git a/scripts/stop.sh b/scripts/stop.sh new file mode 100644 index 0000000000000000000000000000000000000000..8882127cb39767326fcd2a9a143cdb7ca284b38d --- /dev/null +++ b/scripts/stop.sh @@ -0,0 +1,10 @@ +#!/bin/bash +#cd .. +# Stop Docker containers +docker-compose -f ./docker/docker-compose.yml stop + +# Remove Docker containers +#docker-compose -f ./docker/docker-compose.yml rm -f + +# Clean up unused Docker resources +#docker system prune --volumes diff --git a/server.bat b/server.bat new file mode 100644 index 0000000000000000000000000000000000000000..d80894bb8ca3fc49dbd3e9ce637e22bff09ec280 --- /dev/null +++ b/server.bat @@ -0,0 +1,7 @@ +#!/bin/bash + +# Start the Rasa server +rasa run --enable-api --cors "*" + +# Start the action server +rasa run actions --actions app/actions --cors "*" diff --git a/server.sh b/server.sh new file mode 100644 index 0000000000000000000000000000000000000000..d80894bb8ca3fc49dbd3e9ce637e22bff09ec280 --- /dev/null +++ b/server.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Start the Rasa server +rasa run --enable-api --cors "*" + +# Start the action server +rasa run actions --actions app/actions --cors "*"