thisisishara commited on
Commit
acccbe4
1 Parent(s): 50f3d89

init assistant

Browse files
.gitignore ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib64/
18
+ parts/
19
+ sdist/
20
+ var/
21
+ wheels/
22
+ pip-wheel-metadata/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+
53
+ # Translations
54
+ *.mo
55
+ *.pot
56
+
57
+ # Django stuff:
58
+ *.log
59
+ local_settings.py
60
+ db.sqlite3
61
+ db.sqlite3-journal
62
+
63
+ # Flask stuff:
64
+ instance/
65
+ .webassets-cache
66
+
67
+ # Scrapy stuff:
68
+ .scrapy
69
+
70
+ # Sphinx documentation
71
+ docs/_build/
72
+
73
+ # PyBuilder
74
+ target/
75
+
76
+ # Jupyter Notebook
77
+ .ipynb_checkpoints
78
+
79
+ # IPython
80
+ profile_default/
81
+ ipython_config.py
82
+
83
+ # pyenv
84
+ .python-version
85
+
86
+ # pipenv
87
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
88
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
89
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
90
+ # install all needed dependencies.
91
+ #Pipfile.lock
92
+
93
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
94
+ __pypackages__/
95
+
96
+ # Celery stuff
97
+ celerybeat-schedule
98
+ celerybeat.pid
99
+
100
+ # SageMath parsed files
101
+ *.sage.py
102
+
103
+ # Environments
104
+ .env
105
+ .venv
106
+ .venv*
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+ .venv*
113
+
114
+ # Spyder project settings
115
+ .spyderproject
116
+ .spyproject
117
+
118
+ # Rope project settings
119
+ .ropeproject
120
+
121
+ # mkdocs documentation
122
+ /site
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
131
+ .vscode/
132
+ .idea/
133
+
134
+ .DS_Store
135
+
136
+ *.pid
137
+
138
+ **.rasa
139
+ **tests
140
+ **models
141
+ Dockerfile-test
142
+ run.sh
Dockerfile ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base image
2
+ FROM python:3.10
3
+
4
+ # Set the working directory
5
+ WORKDIR /app
6
+
7
+ # Install NGINX
8
+ RUN apt-get update && apt-get install -y nginx
9
+
10
+ # Copy NGINX configuration
11
+ COPY nginx.conf /etc/nginx/nginx.conf
12
+
13
+ # Install dependencies
14
+ COPY requirements.txt .
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
+
17
+ # Copy the source code
18
+ COPY ./rasa-assistant/* .
19
+
20
+ # Expose ports
21
+ EXPOSE 80 7860 5055
22
+
23
+ CMD ["rasa", "train"]
24
+
25
+ # Set the entrypoint script
26
+ ENTRYPOINT ["/app/entrypoint.sh"]
README.md CHANGED
@@ -1,10 +1,8 @@
1
  ---
2
  title: Personal Rasa Ai Assistant
3
- emoji: 😻
4
- colorFrom: indigo
5
- colorTo: gray
6
  sdk: docker
7
  pinned: false
8
  ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Personal Rasa Ai Assistant
3
+ emoji:
4
+ colorFrom: red
5
+ colorTo: yellow
6
  sdk: docker
7
  pinned: false
8
  ---
 
 
entrypoint.sh ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
12
+ # Start the Rasa Actions server
13
+ rasa run actions --actions actions --debug --port 5055 &
14
+
15
+ # Wait for processes to finish
16
+ wait
nginx.conf ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/actions/__init__.py ADDED
File without changes
rasa-assistant/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 []
rasa-assistant/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
rasa-assistant/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: 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 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?
rasa-assistant/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
rasa-assistant/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
rasa-assistant/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
rasa-assistant/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,2 @@
 
 
 
1
+ rasa==3.6.2
2
+ rasa-sdk==3.6.0