thisisishara commited on
Commit
38aab64
1 Parent(s): b45d46c

switch to rasa 2x

Browse files
.gitignore CHANGED
@@ -140,3 +140,4 @@ dmypy.json
140
  **models
141
  Dockerfile-test
142
  run.sh
 
 
140
  **models
141
  Dockerfile-test
142
  run.sh
143
+ rasa-assistant-3
Dockerfile CHANGED
@@ -1,48 +1,31 @@
1
- # Base image
2
- FROM python:3.10
3
 
4
- # Set the working directory
5
  USER root
6
- WORKDIR /app
7
-
8
- # Install NGINX
9
- RUN apt-get update && apt-get install -y nginx
10
-
11
- RUN mkdir -p /var/cache/nginx \
12
- /var/log/nginx \
13
- /var/lib/nginx
14
- RUN touch /var/run/nginx.pid
15
 
16
- RUN chown -R 777 /var/cache/nginx \
17
- /var/log/nginx \
18
- /var/lib/nginx \
19
- /var/run/nginx.pid
20
-
21
- # Copy nginx configuration
22
- COPY nginx.conf /etc/nginx/sites-available/default
23
 
24
- # Install dependencies
25
  COPY requirements.txt .
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
- # Copy the source code
29
- COPY ./rasa-assistant/* .
30
  COPY entrypoint.sh .
31
- COPY ./rasa-assistant/.config /.config
32
-
33
- RUN chmod -R 777 /etc/nginx/sites-available/default
34
  RUN mkdir models && mkdir .rasa && mkdir tests
35
- RUN chmod -R 777 .
36
- RUN chown -R 777 /var/lib/nginx
37
- RUN chown -R 777 /.config
38
 
39
  # Set the permissions for the entrypoint.sh script
40
  RUN chmod +x entrypoint.sh
41
 
42
  # Expose ports
43
- EXPOSE 80 7860 5055
44
 
45
- RUN rasa train --data ./data --config ./config.yml
46
 
47
  # Set the entrypoint script
48
- ENTRYPOINT ["/app/entrypoint.sh"]
 
1
+ # Extend the official Rasa SDK image
2
+ FROM rasa/rasa:2.2.8-full
3
 
4
+ # Change back to root user to install dependencies
5
  USER root
6
+ RUN apt-get --allow-releaseinfo-change update
7
+ RUN apt-get -y install software-properties-common
8
+ RUN apt-get --allow-releaseinfo-change update
9
+ RUN pip3 install --upgrade setuptools pip
 
 
 
 
 
10
 
11
+ # Use subdirectory as working directory
12
+ WORKDIR /app
 
 
 
 
 
13
 
 
14
  COPY requirements.txt .
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ # Copying training data
18
+ COPY ./rasa-assistant-2 .
19
  COPY entrypoint.sh .
 
 
 
20
  RUN mkdir models && mkdir .rasa && mkdir tests
 
 
 
21
 
22
  # Set the permissions for the entrypoint.sh script
23
  RUN chmod +x entrypoint.sh
24
 
25
  # Expose ports
26
+ EXPOSE 5005 5055
27
 
28
+ RUN rasa train
29
 
30
  # Set the entrypoint script
31
+ ENTRYPOINT ["/app/entrypoint.sh"]
README.md CHANGED
@@ -4,5 +4,6 @@ emoji: ⚡
4
  colorFrom: red
5
  colorTo: yellow
6
  sdk: docker
 
7
  pinned: false
8
  ---
 
4
  colorFrom: red
5
  colorTo: yellow
6
  sdk: docker
7
+ app_port: 5005
8
  pinned: false
9
  ---
entrypoint.sh CHANGED
@@ -1,11 +1,5 @@
1
  #!/bin/bash
2
 
3
- # Start NGINX in the background
4
- nginx -g 'daemon off;'
5
-
6
- # Trap the SIGTERM signal to gracefully stop NGINX
7
- trap 'nginx -s quit' SIGTERM
8
-
9
  # Start the Rasa server
10
  rasa run -m models --enable-api --cors "*" --debug --port 5005 &
11
 
 
1
  #!/bin/bash
2
 
 
 
 
 
 
 
3
  # Start the Rasa server
4
  rasa run -m models --enable-api --cors "*" --debug --port 5005 &
5
 
nginx.conf DELETED
@@ -1,53 +0,0 @@
1
- server {
2
- listen 7860 default_server;
3
- listen [::]:7860 default_server;
4
-
5
- server_name _;
6
-
7
- # Proxy configuration
8
- proxy_set_header Host $host;
9
- proxy_set_header X-Real-IP $remote_addr;
10
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
11
- proxy_connect_timeout 7200;
12
- proxy_send_timeout 7200;
13
- client_body_timeout 5h;
14
- proxy_read_timeout 5h;
15
-
16
- location / {
17
- # Serve Rasa
18
- proxy_pass http://localhost:5005;
19
- proxy_http_version 1.1;
20
- proxy_set_header Upgrade $http_upgrade;
21
- proxy_set_header Connection 'upgrade';
22
- proxy_set_header Host $host;
23
- proxy_set_header X-Real-IP $remote_addr;
24
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
25
- proxy_cache_bypass $http_upgrade;
26
- proxy_read_timeout 86400;
27
- proxy_redirect off;
28
- }
29
-
30
- location /socket.io/ {
31
- # Allow Socket.io Traffic
32
- proxy_pass http://localhost:5005;
33
- proxy_http_version 1.1;
34
- proxy_set_header Upgrade $http_upgrade;
35
- proxy_set_header Connection "upgrade";
36
- proxy_set_header X-real-ip $remote_addr;
37
- proxy_set_header X-Forwarded-For $remote_addr;
38
- }
39
-
40
- location /actions/ {
41
- # Serve Rasa Actions
42
- proxy_pass http://localhost:5055;
43
- proxy_http_version 1.1;
44
- proxy_set_header Upgrade $http_upgrade;
45
- proxy_set_header Connection 'upgrade';
46
- proxy_set_header Host $host;
47
- proxy_set_header X-Real-IP $remote_addr;
48
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
49
- proxy_cache_bypass $http_upgrade;
50
- proxy_read_timeout 86400;
51
- proxy_redirect off;
52
- }
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rasa-assistant/.config DELETED
File without changes
rasa-assistant/actions/__init__.py DELETED
File without changes
rasa-assistant/actions/actions.py DELETED
@@ -1,27 +0,0 @@
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 []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rasa-assistant/config.yml DELETED
@@ -1,50 +0,0 @@
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rasa-assistant/credentials.yml DELETED
@@ -1,33 +0,0 @@
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: user_uttered
22
- bot_message_evt: bot_uttered
23
- session_persistence: true
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"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rasa-assistant/data/nlu.yml DELETED
@@ -1,91 +0,0 @@
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?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rasa-assistant/data/rules.yml DELETED
@@ -1,13 +0,0 @@
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rasa-assistant/data/stories.yml DELETED
@@ -1,30 +0,0 @@
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rasa-assistant/domain.yml DELETED
@@ -1,34 +0,0 @@
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rasa-assistant/endpoints.yml DELETED
@@ -1,42 +0,0 @@
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 CHANGED
@@ -1,2 +1,2 @@
1
- rasa==3.6.2
2
- rasa-sdk==3.6.0
 
1
+ rasa==2.2.8
2
+ rasa-sdk==2.2.0