Commit
•
a2a29d4
1
Parent(s):
6315d3f
Upload 15 files (#1)
Browse files- Upload 15 files (e9319f4665d89ba6eadb39a5d7768edf6d56c56b)
Co-authored-by: Anand <[email protected]>
- Dockerfile +39 -0
- README.md +4 -4
- actions/__init__.py +0 -0
- actions/__pycache__/__init__.cpython-310.pyc +0 -0
- actions/__pycache__/actions.cpython-310.pyc +0 -0
- actions/actions.py +27 -0
- compose.yaml +49 -0
- config.yml +50 -0
- credentials.yml +33 -0
- data/nlu.yml +91 -0
- data/rules.yml +13 -0
- data/stories.yml +30 -0
- domain.yml +34 -0
- endpoints.yml +42 -0
- requirements.txt +1 -0
Dockerfile
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# syntax=docker/dockerfile:1
|
2 |
+
|
3 |
+
# Comments are provided throughout this file to help you get started.
|
4 |
+
# If you need more help, visit the Dockerfile reference guide at
|
5 |
+
# https://docs.docker.com/engine/reference/builder/
|
6 |
+
|
7 |
+
ARG PYTHON_VERSION=3.8
|
8 |
+
FROM python:${PYTHON_VERSION}-slim as base
|
9 |
+
|
10 |
+
# Copy the requirements file into the container.
|
11 |
+
COPY requirements.txt .
|
12 |
+
|
13 |
+
# Install the dependencies from the requirements file.
|
14 |
+
RUN python -m pip install --no-cache-dir -r requirements.txt
|
15 |
+
|
16 |
+
# Prevents Python from writing pyc files.
|
17 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
18 |
+
|
19 |
+
# Keeps Python from buffering stdout and stderr to avoid situations where
|
20 |
+
# the application crashes without emitting any logs due to buffering.
|
21 |
+
ENV PYTHONUNBUFFERED=1
|
22 |
+
|
23 |
+
WORKDIR /app
|
24 |
+
# Copy the source code into the container.
|
25 |
+
COPY . .
|
26 |
+
|
27 |
+
# Create a non-privileged user that the app will run under.
|
28 |
+
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
|
29 |
+
# Switch to the non-privileged user to run the application.
|
30 |
+
USER 1001
|
31 |
+
|
32 |
+
# set entrypoint for interactive shells
|
33 |
+
ENTRYPOINT [ "rasa" ]
|
34 |
+
|
35 |
+
# Expose the port that the application listens on.
|
36 |
+
EXPOSE 7860
|
37 |
+
|
38 |
+
# Run the application.
|
39 |
+
CMD ["run","--enable-api","--port","7860"]
|
README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
---
|
2 |
-
title: Omdena Ng Lagos
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
---
|
|
|
1 |
---
|
2 |
+
title: Omdena Ng Lagos Comunity Chat Model
|
3 |
+
emoji: 📉
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: indigo
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
---
|
actions/__init__.py
ADDED
File without changes
|
actions/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (181 Bytes). View file
|
|
actions/__pycache__/actions.cpython-310.pyc
ADDED
Binary file (180 Bytes). View file
|
|
actions/actions.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This files contains your custom actions which can be used to run
|
2 |
+
# custom Python code.
|
3 |
+
#
|
4 |
+
# See this guide on how to implement these action:
|
5 |
+
# https://rasa.com/docs/rasa/custom-actions
|
6 |
+
|
7 |
+
|
8 |
+
# This is a simple example for a custom action which utters "Hello World!"
|
9 |
+
|
10 |
+
# from typing import Any, Text, Dict, List
|
11 |
+
#
|
12 |
+
# from rasa_sdk import Action, Tracker
|
13 |
+
# from rasa_sdk.executor import CollectingDispatcher
|
14 |
+
#
|
15 |
+
#
|
16 |
+
# class ActionHelloWorld(Action):
|
17 |
+
#
|
18 |
+
# def name(self) -> Text:
|
19 |
+
# return "action_hello_world"
|
20 |
+
#
|
21 |
+
# def run(self, dispatcher: CollectingDispatcher,
|
22 |
+
# tracker: Tracker,
|
23 |
+
# domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
|
24 |
+
#
|
25 |
+
# dispatcher.utter_message(text="Hello World!")
|
26 |
+
#
|
27 |
+
# return []
|
compose.yaml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Comments are provided throughout this file to help you get started.
|
2 |
+
# If you need more help, visit the Docker compose reference guide at
|
3 |
+
# https://docs.docker.com/compose/compose-file/
|
4 |
+
|
5 |
+
# Here the instructions define your application as a service called "server".
|
6 |
+
# This service is built from the Dockerfile in the current directory.
|
7 |
+
# You can add other services your application may depend on here, such as a
|
8 |
+
# database or a cache. For examples, see the Awesome Compose repository:
|
9 |
+
# https://github.com/docker/awesome-compose
|
10 |
+
services:
|
11 |
+
server:
|
12 |
+
build:
|
13 |
+
context: .
|
14 |
+
ports:
|
15 |
+
- 7860:7860
|
16 |
+
|
17 |
+
# The commented out section below is an example of how to define a PostgreSQL
|
18 |
+
# database that your application can use. `depends_on` tells Docker Compose to
|
19 |
+
# start the database before your application. The `db-data` volume persists the
|
20 |
+
# database data between container restarts. The `db-password` secret is used
|
21 |
+
# to set the database password. You must create `db/password.txt` and add
|
22 |
+
# a password of your choosing to it before running `docker compose up`.
|
23 |
+
# depends_on:
|
24 |
+
# db:
|
25 |
+
# condition: service_healthy
|
26 |
+
# db:
|
27 |
+
# image: postgres
|
28 |
+
# restart: always
|
29 |
+
# user: postgres
|
30 |
+
# secrets:
|
31 |
+
# - db-password
|
32 |
+
# volumes:
|
33 |
+
# - db-data:/var/lib/postgresql/data
|
34 |
+
# environment:
|
35 |
+
# - POSTGRES_DB=example
|
36 |
+
# - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
|
37 |
+
# expose:
|
38 |
+
# - 5432
|
39 |
+
# healthcheck:
|
40 |
+
# test: [ "CMD", "pg_isready" ]
|
41 |
+
# interval: 10s
|
42 |
+
# timeout: 5s
|
43 |
+
# retries: 5
|
44 |
+
# volumes:
|
45 |
+
# db-data:
|
46 |
+
# secrets:
|
47 |
+
# db-password:
|
48 |
+
# file: db/password.txt
|
49 |
+
|
config.yml
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# The config recipe.
|
2 |
+
# https://rasa.com/docs/rasa/model-configuration/
|
3 |
+
recipe: default.v1
|
4 |
+
|
5 |
+
# The assistant project unique identifier
|
6 |
+
# This default value must be replaced with a unique assistant name within your deployment
|
7 |
+
assistant_id: placeholder_default
|
8 |
+
|
9 |
+
# Configuration for Rasa NLU.
|
10 |
+
# https://rasa.com/docs/rasa/nlu/components/
|
11 |
+
language: en
|
12 |
+
|
13 |
+
pipeline:
|
14 |
+
# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
|
15 |
+
# # If you'd like to customize it, uncomment and adjust the pipeline.
|
16 |
+
# # See https://rasa.com/docs/rasa/tuning-your-model for more information.
|
17 |
+
# - name: WhitespaceTokenizer
|
18 |
+
# - name: RegexFeaturizer
|
19 |
+
# - name: LexicalSyntacticFeaturizer
|
20 |
+
# - name: CountVectorsFeaturizer
|
21 |
+
# - name: CountVectorsFeaturizer
|
22 |
+
# analyzer: char_wb
|
23 |
+
# min_ngram: 1
|
24 |
+
# max_ngram: 4
|
25 |
+
# - name: DIETClassifier
|
26 |
+
# epochs: 100
|
27 |
+
# constrain_similarities: true
|
28 |
+
# - name: EntitySynonymMapper
|
29 |
+
# - name: ResponseSelector
|
30 |
+
# epochs: 100
|
31 |
+
# constrain_similarities: true
|
32 |
+
# - name: FallbackClassifier
|
33 |
+
# threshold: 0.3
|
34 |
+
# ambiguity_threshold: 0.1
|
35 |
+
|
36 |
+
# Configuration for Rasa Core.
|
37 |
+
# https://rasa.com/docs/rasa/core/policies/
|
38 |
+
policies:
|
39 |
+
# # No configuration for policies was provided. The following default policies were used to train your model.
|
40 |
+
# # If you'd like to customize them, uncomment and adjust the policies.
|
41 |
+
# # See https://rasa.com/docs/rasa/policies for more information.
|
42 |
+
# - name: MemoizationPolicy
|
43 |
+
# - name: RulePolicy
|
44 |
+
# - name: UnexpecTEDIntentPolicy
|
45 |
+
# max_history: 5
|
46 |
+
# epochs: 100
|
47 |
+
# - name: TEDPolicy
|
48 |
+
# max_history: 5
|
49 |
+
# epochs: 100
|
50 |
+
# constrain_similarities: true
|
credentials.yml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file contains the credentials for the voice & chat platforms
|
2 |
+
# which your bot is using.
|
3 |
+
# https://rasa.com/docs/rasa/messaging-and-voice-channels
|
4 |
+
|
5 |
+
rest:
|
6 |
+
# # you don't need to provide anything here - this channel doesn't
|
7 |
+
# # require any credentials
|
8 |
+
|
9 |
+
|
10 |
+
#facebook:
|
11 |
+
# verify: "<verify>"
|
12 |
+
# secret: "<your secret>"
|
13 |
+
# page-access-token: "<your page access token>"
|
14 |
+
|
15 |
+
#slack:
|
16 |
+
# slack_token: "<your slack token>"
|
17 |
+
# slack_channel: "<the slack channel>"
|
18 |
+
# slack_signing_secret: "<your slack signing secret>"
|
19 |
+
|
20 |
+
#socketio:
|
21 |
+
# user_message_evt: <event name for user message>
|
22 |
+
# bot_message_evt: <event name for bot messages>
|
23 |
+
# session_persistence: <true/false>
|
24 |
+
|
25 |
+
#mattermost:
|
26 |
+
# url: "https://<mattermost instance>/api/v4"
|
27 |
+
# token: "<bot token>"
|
28 |
+
# webhook_url: "<callback URL>"
|
29 |
+
|
30 |
+
# This entry is needed if you are using Rasa Enterprise. The entry represents credentials
|
31 |
+
# for the Rasa Enterprise "channel", i.e. Talk to your bot and Share with guest testers.
|
32 |
+
rasa:
|
33 |
+
url: "http://localhost:5002/api"
|
data/nlu.yml
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: "3.1"
|
2 |
+
|
3 |
+
nlu:
|
4 |
+
- intent: greet
|
5 |
+
examples: |
|
6 |
+
- hey
|
7 |
+
- hello
|
8 |
+
- hi
|
9 |
+
- hello there
|
10 |
+
- good morning
|
11 |
+
- good evening
|
12 |
+
- moin
|
13 |
+
- hey there
|
14 |
+
- let's go
|
15 |
+
- hey dude
|
16 |
+
- goodmorning
|
17 |
+
- goodevening
|
18 |
+
- good afternoon
|
19 |
+
|
20 |
+
- intent: goodbye
|
21 |
+
examples: |
|
22 |
+
- cu
|
23 |
+
- good by
|
24 |
+
- cee you later
|
25 |
+
- good night
|
26 |
+
- bye
|
27 |
+
- goodbye
|
28 |
+
- have a nice day
|
29 |
+
- see you around
|
30 |
+
- bye bye
|
31 |
+
- see you later
|
32 |
+
|
33 |
+
- intent: affirm
|
34 |
+
examples: |
|
35 |
+
- yes
|
36 |
+
- y
|
37 |
+
- indeed
|
38 |
+
- of course
|
39 |
+
- that sounds good
|
40 |
+
- correct
|
41 |
+
|
42 |
+
- intent: deny
|
43 |
+
examples: |
|
44 |
+
- no
|
45 |
+
- n
|
46 |
+
- never
|
47 |
+
- I don't think so
|
48 |
+
- don't like that
|
49 |
+
- no way
|
50 |
+
- not really
|
51 |
+
|
52 |
+
- intent: mood_great
|
53 |
+
examples: |
|
54 |
+
- perfect
|
55 |
+
- great
|
56 |
+
- amazing
|
57 |
+
- feeling like a king
|
58 |
+
- wonderful
|
59 |
+
- I am feeling very good
|
60 |
+
- I am great
|
61 |
+
- I am amazing
|
62 |
+
- I am going to save the world
|
63 |
+
- super stoked
|
64 |
+
- extremely good
|
65 |
+
- so so perfect
|
66 |
+
- so good
|
67 |
+
- so perfect
|
68 |
+
|
69 |
+
- intent: mood_unhappy
|
70 |
+
examples: |
|
71 |
+
- my day was horrible
|
72 |
+
- I am sad
|
73 |
+
- I don't feel very well
|
74 |
+
- I am disappointed
|
75 |
+
- super sad
|
76 |
+
- I'm so sad
|
77 |
+
- sad
|
78 |
+
- very sad
|
79 |
+
- unhappy
|
80 |
+
- not good
|
81 |
+
- not very good
|
82 |
+
- extremly sad
|
83 |
+
- so saad
|
84 |
+
- so sad
|
85 |
+
|
86 |
+
- intent: bot_challenge
|
87 |
+
examples: |
|
88 |
+
- are you a bot?
|
89 |
+
- are you a human?
|
90 |
+
- am I talking to a bot?
|
91 |
+
- am I talking to a human?
|
data/rules.yml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: "3.1"
|
2 |
+
|
3 |
+
rules:
|
4 |
+
|
5 |
+
- rule: Say goodbye anytime the user says goodbye
|
6 |
+
steps:
|
7 |
+
- intent: goodbye
|
8 |
+
- action: utter_goodbye
|
9 |
+
|
10 |
+
- rule: Say 'I am a bot' anytime the user challenges
|
11 |
+
steps:
|
12 |
+
- intent: bot_challenge
|
13 |
+
- action: utter_iamabot
|
data/stories.yml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: "3.1"
|
2 |
+
|
3 |
+
stories:
|
4 |
+
|
5 |
+
- story: happy path
|
6 |
+
steps:
|
7 |
+
- intent: greet
|
8 |
+
- action: utter_greet
|
9 |
+
- intent: mood_great
|
10 |
+
- action: utter_happy
|
11 |
+
|
12 |
+
- story: sad path 1
|
13 |
+
steps:
|
14 |
+
- intent: greet
|
15 |
+
- action: utter_greet
|
16 |
+
- intent: mood_unhappy
|
17 |
+
- action: utter_cheer_up
|
18 |
+
- action: utter_did_that_help
|
19 |
+
- intent: affirm
|
20 |
+
- action: utter_happy
|
21 |
+
|
22 |
+
- story: sad path 2
|
23 |
+
steps:
|
24 |
+
- intent: greet
|
25 |
+
- action: utter_greet
|
26 |
+
- intent: mood_unhappy
|
27 |
+
- action: utter_cheer_up
|
28 |
+
- action: utter_did_that_help
|
29 |
+
- intent: deny
|
30 |
+
- action: utter_goodbye
|
domain.yml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: "3.1"
|
2 |
+
|
3 |
+
intents:
|
4 |
+
- greet
|
5 |
+
- goodbye
|
6 |
+
- affirm
|
7 |
+
- deny
|
8 |
+
- mood_great
|
9 |
+
- mood_unhappy
|
10 |
+
- bot_challenge
|
11 |
+
|
12 |
+
responses:
|
13 |
+
utter_greet:
|
14 |
+
- text: "Hey! How are you?"
|
15 |
+
|
16 |
+
utter_cheer_up:
|
17 |
+
- text: "Here is something to cheer you up:"
|
18 |
+
image: "https://i.imgur.com/nGF1K8f.jpg"
|
19 |
+
|
20 |
+
utter_did_that_help:
|
21 |
+
- text: "Did that help you?"
|
22 |
+
|
23 |
+
utter_happy:
|
24 |
+
- text: "Great, carry on!"
|
25 |
+
|
26 |
+
utter_goodbye:
|
27 |
+
- text: "Bye"
|
28 |
+
|
29 |
+
utter_iamabot:
|
30 |
+
- text: "I am a bot, powered by Rasa."
|
31 |
+
|
32 |
+
session_config:
|
33 |
+
session_expiration_time: 60
|
34 |
+
carry_over_slots_to_new_session: true
|
endpoints.yml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file contains the different endpoints your bot can use.
|
2 |
+
|
3 |
+
# Server where the models are pulled from.
|
4 |
+
# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server
|
5 |
+
|
6 |
+
#models:
|
7 |
+
# url: http://my-server.com/models/default_core@latest
|
8 |
+
# wait_time_between_pulls: 10 # [optional](default: 100)
|
9 |
+
|
10 |
+
# Server which runs your custom actions.
|
11 |
+
# https://rasa.com/docs/rasa/custom-actions
|
12 |
+
|
13 |
+
#action_endpoint:
|
14 |
+
# url: "http://localhost:5055/webhook"
|
15 |
+
|
16 |
+
# Tracker store which is used to store the conversations.
|
17 |
+
# By default the conversations are stored in memory.
|
18 |
+
# https://rasa.com/docs/rasa/tracker-stores
|
19 |
+
|
20 |
+
#tracker_store:
|
21 |
+
# type: redis
|
22 |
+
# url: <host of the redis instance, e.g. localhost>
|
23 |
+
# port: <port of your redis instance, usually 6379>
|
24 |
+
# db: <number of your database within redis, e.g. 0>
|
25 |
+
# password: <password used for authentication>
|
26 |
+
# use_ssl: <whether or not the communication is encrypted, default false>
|
27 |
+
|
28 |
+
#tracker_store:
|
29 |
+
# type: mongod
|
30 |
+
# url: <url to your mongo instance, e.g. mongodb://localhost:27017>
|
31 |
+
# db: <name of the db within your mongo instance, e.g. rasa>
|
32 |
+
# username: <username used for authentication>
|
33 |
+
# password: <password used for authentication>
|
34 |
+
|
35 |
+
# Event broker which all conversation events should be streamed to.
|
36 |
+
# https://rasa.com/docs/rasa/event-brokers
|
37 |
+
|
38 |
+
#event_broker:
|
39 |
+
# url: localhost
|
40 |
+
# username: username
|
41 |
+
# password: password
|
42 |
+
# queue: queue
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
rasa
|