diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..038ca30
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,20 @@
+**/__pycache__/**
+**/dialogue/**
+**/apixu/**
+**/logs/**
+
+**/.idea/**
+
+test*
+
+**/envrionment.env
+
+# ignore keys, tokens files
+credentials.yml
+export_rasa_config.sh
+
+# local backup of PIP requirements
+requirements-rasa-weatherbot.txt
+
+# local scripts
+run-all-services.sh
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/README.md b/Full Code [Latest release of Rasa NLU and Rasa Core]/README.md
index f3358dd..a58451a 100644
--- a/Full Code [Latest release of Rasa NLU and Rasa Core]/README.md
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/README.md
@@ -1,58 +1,226 @@
-# Weatherbot Tutorial (using the latest release of Rasa NLU and Rasa Core)
-
-Rasa NLU and Rasa Core devs are doing an amazing job improving both of these libraries which results in code changes for one method or another. In fact, since I recorded a Wetherbot tutorial,
-there were quite a few changes which were introduced to Rasa NLU and Rasa Core. On 30th of August, Rasa v.0.11 was released with a lot of changes under the hood. This repo contains the updated weatherbot code compatible with the latest releases of Rasa Core and Rasa NLU.
-
-## How to use this repo
-
-The code of this repo differs quite significantly from the original video. This is how to use it:
-
-### Training the NLU model
-
-Training of the NLU model didn't change much from the way it was shown in the video. To train and test the model run:
-
-``` python nlu_model.py ```
-
-### Training the Rasa Core model
-
-The biggest change in how Rasa Core model works is that custom action 'action_weather' now needs to run on a separate server. That server has to be configured in a 'endpoints.yml' file. This is how to train and run the dialogue management model:
-1. Start the custom action server by running:
-
-``` python -m rasa_core_sdk.endpoint --actions actions ```
-
-2. Open a new terminal and train the Rasa Core model by running:
-
-``` python dialogue_management_model.py```
-
-3. Talk to the chatbot once it's loaded.
-
-### Starting the interactive training session:
+# Weatherbot Tutorial (using the latest release of Rasa NLU and Rasa Core)
+
+Rasa NLU and Rasa Core devs are doing an amazing job improving both of these libraries
+which results in code changes for one method or another. In fact, since I recorded
+a Wetherbot tutorial, there were quite a few changes which were introduced to Rasa NLU and Rasa Core. On 30th of August, Rasa v.0.11 was released with a lot of changes under the hood. This repo contains the updated weatherbot code compatible with the latest releases of Rasa Core and Rasa NLU.
+
+## How to use this repo
+
+The code of this repo differs quite significantly from the original video.
+The following explains the overall steps/flows:
+
+* Step-1: Training the NLU model
+* Step-2: (Initial) Training the Rasa Core model
+* Step-3: Optional -- (Interactive / Online) Training Session for the Rasa Core model
+* Step-4: Deploy Rasa Chat Bot (NLU + Core/Agent + Action) to work with Slack Chat.
+
+### Step-1: Training the NLU model
+
+Training of the NLU model didn't change much from the way it was shown in the video. To train and test the model run:
+
+```
+python nlu_model.py
+```
+
+### Step-2: (Initial) Training the Rasa Core model
+
+The biggest change in how Rasa Core model works is that custom action 'action_weather' now needs to run on a separate server. That server has to be configured in a 'endpoints.yml' file. This is how to train and run the dialogue management model:
+
+1. Start the custom action server by running:
+
+ ```
+ APIXU_KEY= python -m rasa_core_sdk.endpoint --actions actions
+ ```
+ or, if you already export Key and Token in each terminal above:
+
+ ```
+ python -m rasa_core_sdk.endpoint --actions actions
+ ```
+
+2. Open a new terminal and train the Rasa Core model by running:
+
+ ```
+ python dialogue_management_model.py
+ ```
+
+3. Talk to the chatbot once it's loaded to provide training with `intended / corrected behaviors` for the Rasa Core to learn from your correct answers that you provide. (To exit the interative/online training session, CTRL-C twice!)
+
+### Step-3: Optional -- (Interactive / Online) Training Session for the Rasa Core model
+
The process of running the interactive session is very similar to training the Rasa Core model:
-1. Make sure the custom actions server is running:
-
-``` python -m rasa_core_sdk.endpoint --actions actions ```
-
-2. Start the interactive training session by running:
-
-``` python train_interactive.py ```
-### Connecting a chatbot to Slack:
-1. Configure the slack app as shown in the video
-2. Make sure custom actions server is running
-3. Start the agent by running run_app.py file (don't forget to provide the slack_token)
-4. Start the ngrok on the port 5004
-5. Provide the url: https://your_ngrok_url/webhooks/slack/webhook to 'Event Subscriptions' page of the slack configuration.
-6. Talk to you bot.
+1. Make sure the custom actions server is running:
+
+ ```
+ python -m rasa_core_sdk.endpoint --actions actions
+ ```
+
+2. Start the interactive training session by running:
+
+ ```
+ python train_interactive.py
+ ```
+
+### Step-4: Deploy Rasa Chat Bot (NLU + Core/Agent + Action) to work with Slack Chat.
+
+1. Configure the slack app as shown in the video
+
+ * Study the Video: [From zero to hero: Creating a chatbot with Rasa NLU and Rasa Core](https://player.vimeo.com/video/254777331)
+ * See also the screenshots in ./doc folder
+ * Go to [apixu web site](https://www.apixu.com/) to
+ create API key `APIXU_KEY=` .
+ * Go to [SlackAPI](https://api.slack.com/) to
+ create "weatherbot" to get `Bot_User_OAuth_Access_Token=` for `run_app.py` to consume
+ * Go to [ngrok - secure introspectable tunnels to localhost](https://ngrok.com/) to
+ down and install ngrok.
+ * Open 3 extra Terminals for `Action, run_app.py, ngrok`
+ * Export `Key (obatined from Weather APIXU Key)` and
+ `Token (obtained from Slack Bot User)` in each terminal of those three terminals
+
+ Test Weather API (APIXU) with your `APIXU token` before you proceed:
+
+ ```
+ Current Weather
+ HTTP: http://api.apixu.com/v1/current.json?key=&q=Paris
+ HTTPS: https://api.apixu.com/v1/current.json?key=&q=Paris
+
+ Forecast Weather
+ HTTP: http://api.apixu.com/v1/forecast.json?key=&q=Paris
+ HTTPS: https://api.apixu.com/v1/forecast.json?key=&q=Paris
+ ```
+
+2. Run Dialogue (rasa-core) test
+
+```
+(Try the following and kill it when done testing)
+APIXU_KEY= python dialogue_management_model.py
+```
+
+or, if you already export Key and Token in each terminal above:
+
+```
+python dialogue_management_model.py
+```
+
+And, you will enter test conversation such as
+
+```
+Processed Story Blocks: 100%|██████████████████████████████████████| 10/10 [00:00<00:00, 1201.39it/s, # trackers=3]
+Processed Story Blocks: 100%|██████████████████████████████████████| 10/10 [00:00<00:00, 566.00it/s, # trackers=6]
+Processed Story Blocks: 100%|██████████████████████████████████████| 10/10 [00:00<00:00, 515.51it/s, # trackers=6]
+Processed actions: 39it [00:00, 11900.90it/s, # examples=39]
+2019-05-17 10:58:37.061541: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: FMA
+_________________________________________________________________
+Layer (type) Output Shape Param #
+=================================================================
+masking (Masking) (None, 3, 16) 0
+_________________________________________________________________
+lstm (LSTM) (None, 32) 6272
+_________________________________________________________________
+dense (Dense) (None, 11) 363
+_________________________________________________________________
+activation (Activation) (None, 11) 0
+=================================================================
+Total params: 6,635
+Trainable params: 6,635
+Non-trainable params: 0
+_________________________________________________________________
+
+... (ignored screen dump before)
+
+Epoch 298/300
+25/25 [==============================] - 0s 213us/step - loss: 0.3034 - acc: 0.9600
+Epoch 299/300
+25/25 [==============================] - 0s 319us/step - loss: 0.2905 - acc: 1.0000
+Epoch 300/300
+25/25 [==============================] - 0s 235us/step - loss: 0.2877 - acc: 0.9200
+Bot loaded. Type a message and press enter (use '/stop' to exit):
+Your input -> hello
+Hello! How can I help?
+127.0.0.1 - - [2019-05-17 10:58:52] "POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1" 200 222 0.248822
+Your input -> tell me the weather
+In what location?
+127.0.0.1 - - [2019-05-17 10:58:58] "POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1" 200 217 0.044651
+Your input -> in London
+It is currently Overcast in London at the moment. The temperature is 13.0 degrees, the humidity is 77% and the wind speed is 9.4 mph.
+127.0.0.1 - - [2019-05-17 10:59:02] "POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1" 200 333 0.329568
+Your input ->
+
+(CTRL+C twice to quit)
+```
+
+3. Make sure custom actions server is running
+
+ ```
+ APIXU_KEY= python -m rasa_core_sdk.endpoint --actions actions
+ ```
+
+ or, if you already export Key and Token in each terminal:
+
+ ```
+ python -m rasa_core_sdk.endpoint --actions actions
+ ```
+
+4. Start the agent by running run_app.py file (don't forget to provide the slack_token)
+
+ ```
+ Bot_User_OAuth_Access_Token= python run_app.py
+ ```
+
+ or, if you already export Key and Token in each terminal:
+
+ ```
+ python run_app.py
+ ```
+
+5. Start the ngrok on the port 5004
+
+ ```
+ ngrok http 5004
+ ```
+
+ And, you will see like below:
+
+ ```
+ ngrok by @inconshreveable (Ctrl+C to quit)
+ Session Status online Account Jim Kowalski (Plan: Free) Update update available (version 2.3.28, Ctrl-U to update) Version 2.3.27 Region United States (us) Web Interface http://127.0.0.1:4040 Forwarding http://92239ac7.ngrok.io -> http://localhost:5004 Forwarding https://92239ac7.ngrok.io -> http://localhost:5004
+ Connections ttl opn rt1 rt5 p50 p90
+ 0 0 0.00 0.00 0.00 0.00
+ ```
+
+ Then, open ngrok monitor URL using Web browser, Firefox or Chrome or any:
+
+ ```
+ http://127.0.0.1:4040
+ ```
+
+6. Provide the ngrok url to 'Event Subscriptions' page of the slack configuration.
+
+ ```
+ https:///webhooks/slack/webhook`
+ ```
+
+ And, test the connection for ngrok:
+
+ ```
+ http://localhost:5004/webhooks/slack/webhook
+ http:///webhooks/slack/webhook
+ ```
+
+ Now, it's ready for end-to-end test of the Rasa Chat Bot + Slack Chat integration with Weather API called by Rasa SDK Action.
+
+7. Talk to your Slack bot using Slack Chat, e.g.
+
+ ```
+ https://.slack.com/messages/
+ e.g.
+ https://openkbsorg.slack.com/messages/
+ ```
I will do my best to keep this repo up-to-date, but if you encounter any issues with using the code, please raise an issue or drop me a message :)
-Latest code update: 01/03/2019
-
-Latest compatible Rasa NLU version: 0.14.4
-Latest compatible Rasa Core version: 0.13.2
-
-
-
-
+Latest code update: 05/17/2019
+Latest compatible Rasa NLU version: 0.14.6
+Latest compatible Rasa Core version: 0.13.7
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/actions.py b/Full Code [Latest release of Rasa NLU and Rasa Core]/actions.py
index 795892c..3f07989 100644
--- a/Full Code [Latest release of Rasa NLU and Rasa Core]/actions.py
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/actions.py
@@ -5,27 +5,43 @@
from rasa_core_sdk import Action
from rasa_core_sdk.events import SlotSet
+import os
+
+
class ActionWeather(Action):
- def name(self):
- return 'action_weather'
-
- def run(self, dispatcher, tracker, domain):
- from apixu.client import ApixuClient
- api_key = '...' #your apixu key
- client = ApixuClient(api_key)
-
- loc = tracker.get_slot('location')
- current = client.getcurrent(q=loc)
-
- country = current['location']['country']
- city = current['location']['name']
- condition = current['current']['condition']['text']
- temperature_c = current['current']['temp_c']
- humidity = current['current']['humidity']
- wind_mph = current['current']['wind_mph']
+ def name(self):
+ return 'action_weather'
+
+ def run(self, dispatcher, tracker, domain):
+ from apixu.client import ApixuClient
+
+ # You need to provide APIXUKEY in file export_APIXU_KEY.sh since it won't be saved in GIT
+ #
+ # http://api.apixu.com/v1/current.json?key=&q=paris
+ try:
+ #print(os.environ)
+ print("APIXU_KEY=" + os.environ["APIXU_KEY"])
+ api_key = os.environ['APIXU_KEY']
+ # api_key = 'xxxx' #your apixu key
+ client = ApixuClient(api_key)
+ except KeyError:
+ print("Please set the environment variable APIXU_KEY")
+ os.sys.exit(1)
+
+ loc = tracker.get_slot('location')
+ current = client.current(q=loc)
+
+ country = current['location']['country']
+ city = current['location']['name']
+ condition = current['current']['condition']['text']
+ temperature_c = current['current']['temp_c']
+ humidity = current['current']['humidity']
+ wind_mph = current['current']['wind_mph']
- response = """It is currently {} in {} at the moment. The temperature is {} degrees, the humidity is {}% and the wind speed is {} mph.""".format(condition, city, temperature_c, humidity, wind_mph)
-
- dispatcher.utter_message(response)
- return [SlotSet('location',loc)]
+ response = """It is currently {} in {} at the moment.
+ The temperature is {} degrees, the humidity is {}% and the wind speed is {} mph."""\
+ .format(condition, city, temperature_c, humidity, wind_mph)
+
+ dispatcher.utter_message(response)
+ return [SlotSet('location',loc)]
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/dialogue_management_model.py b/Full Code [Latest release of Rasa NLU and Rasa Core]/dialogue_management_model.py
index b340ad8..09e43c6 100644
--- a/Full Code [Latest release of Rasa NLU and Rasa Core]/dialogue_management_model.py
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/dialogue_management_model.py
@@ -16,26 +16,34 @@
logger = logging.getLogger(__name__)
def train_dialogue(domain_file = 'weather_domain.yml',
- model_path = './models/dialogue',
- training_data_file = './data/stories.md'):
-
- agent = Agent(domain_file, policies = [MemoizationPolicy(), KerasPolicy(max_history=3, epochs=200, batch_size=50)])
- data = agent.load_data(training_data_file)
-
-
- agent.train(data)
-
- agent.persist(model_path)
- return agent
-
+ model_path = './models/dialogue',
+ training_data_file = './data/stories.md'):
+
+ agent = Agent(domain_file,
+ policies = [
+ MemoizationPolicy(),
+ KerasPolicy(
+ augmentation_factor = 50,
+ max_history=3,
+ epochs=300,
+ batch_size=50,
+ validation_split = 0.2)
+ ])
+ data = agent.load_data(training_data_file)
+
+ agent.train(data)
+
+ agent.persist(model_path)
+ return agent
+
def run_weather_bot(serve_forever=True):
- interpreter = RasaNLUInterpreter('./models/nlu/default/weathernlu')
- action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
- agent = Agent.load('./models/dialogue', interpreter=interpreter, action_endpoint=action_endpoint)
- rasa_core.run.serve_application(agent ,channel='cmdline')
-
- return agent
-
+ interpreter = RasaNLUInterpreter('./models/nlu/default/weathernlu')
+ action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
+ agent = Agent.load('./models/dialogue', interpreter=interpreter, action_endpoint=action_endpoint)
+ rasa_core.run.serve_application(agent ,channel='cmdline')
+
+ return agent
+
if __name__ == '__main__':
- train_dialogue()
- run_weather_bot()
+ train_dialogue()
+ run_weather_bot()
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Apps-Weather-icon2.png b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Apps-Weather-icon2.png
new file mode 100644
index 0000000..5dad668
Binary files /dev/null and b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Apps-Weather-icon2.png differ
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Rasa-Agent-via-ngrok-proxy-relay.png b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Rasa-Agent-via-ngrok-proxy-relay.png
new file mode 100644
index 0000000..ba91235
Binary files /dev/null and b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Rasa-Agent-via-ngrok-proxy-relay.png differ
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Rasa-Slack-integration-weather-bot.png b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Rasa-Slack-integration-weather-bot.png
new file mode 100644
index 0000000..6e3247d
Binary files /dev/null and b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Rasa-Slack-integration-weather-bot.png differ
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Slack-API-Suscribe-to-Bot-Events.png b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Slack-API-Suscribe-to-Bot-Events.png
new file mode 100644
index 0000000..afcf9f9
Binary files /dev/null and b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/Slack-API-Suscribe-to-Bot-Events.png differ
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/apixu_key_generate_example.png b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/apixu_key_generate_example.png
new file mode 100644
index 0000000..1ad2cd6
Binary files /dev/null and b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/apixu_key_generate_example.png differ
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/ngrok-proxy-monitor.png b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/ngrok-proxy-monitor.png
new file mode 100644
index 0000000..a3174c0
Binary files /dev/null and b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/ngrok-proxy-monitor.png differ
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/weatherbot-Rasa-Slack-conversations.png b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/weatherbot-Rasa-Slack-conversations.png
new file mode 100644
index 0000000..104328e
Binary files /dev/null and b/Full Code [Latest release of Rasa NLU and Rasa Core]/doc/weatherbot-Rasa-Slack-conversations.png differ
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_0_MemoizationPolicy/memorized_turns.json b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_0_MemoizationPolicy/memorized_turns.json
index 25ee0f7..4c8f452 100644
--- a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_0_MemoizationPolicy/memorized_turns.json
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_0_MemoizationPolicy/memorized_turns.json
@@ -3,12 +3,8 @@
"lookup": {
"eJyLzivNydFRQCari3PyS+Jz8pMTSzLz8+INrBQM9QxqgeIFRall8YnJYNHy1MSSjNQisJyOAlYdsQDw8iAM": 0,
"eJyLzivNydFRgJDVxTn5JfE5+cmJJZn5efEGVgqGega1QPGCotSy+MRksGh5amJJRmoRWE5HAZeOzLyS1LyS+PT8/JSkylSoYmRjcjKLgSrwmRILANZRNgc=": 8,
- "eJyLzivNydFRqC7OyS+Jz8lPTizJzM+LN7BSMNQzqAWKFxSllsUnJoNFy1MTSzJSi8ByOgq4dGTmlaTmlcSn5+enJFWmQhUjG5OTWQxUQbYppSUlqUVoElhNiQUAQBxMEg==": 0,
- "eJyLri7OyS+Jz8lPTizJzM+LN7BSMNQzqNVRqC4oSi2LT0wGi5anJpZkpBaB5XQUcOnIzCtJzSuJT8/PT0mqTIUqRjYmJ7MYqIJsU0pLSlKL0CQImVKUmlpClktiAV+yYTs=": 7,
- "eJyLri4oSi2LT0wuyczPiy9PTSzJSC2yUjDUM9BRKM7JL4nPyU9OBMsZgEVrdRSqM/NKUvNK4tPz81OSKlOhipGNycksBqog25TSkpLUIjQJQqYUpaaWUOoSdDOg7kASxmpCLACUiG9z": 0,
- "eJy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grVQGMySyrRVeM0PzEZrD8nsxiogCZGl6cmlmSkFhEwG2pKen5+SlJlKrkuxG0KJBxRJbCaEgsAc7eJAA==": 0,
"eJyLrs7MK0nNK4lPz89PSapMtVIw1DPQUSgoSi2LLy0pSS1CkyjOyS+Jz8lPTizJzM+LNwCL1uoo4DElMRmstDw1sSQjtYhSY3Iyi4EqyDaF3l6KBQBYBnlZ": 0,
"eJyLrs7MK0nNK4lPz89PSapMtVIw1DPQUSgoSi2LT0wuyczPiy9PTSzJSC2CyhTn5JfE5+QnJ4LlDMCitToKhI3JySwGqiDblNKSktQiNAmy3UI3L8UCAEyeeUk=": 8
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_1_KerasPolicy/keras_model.h5 b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_1_KerasPolicy/keras_model.h5
index c5a91fc..20a4f6d 100644
Binary files a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_1_KerasPolicy/keras_model.h5 and b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_1_KerasPolicy/keras_model.h5 differ
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_metadata.json b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_metadata.json
index 68b2886..895340b 100644
--- a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_metadata.json
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/dialogue/policy_metadata.json
@@ -26,8 +26,8 @@
"rasa_core.policies.memoization.MemoizationPolicy",
"rasa_core.policies.keras_policy.KerasPolicy"
],
- "trained_at": "20190125-164749",
- "rasa_core": "0.13.0",
+ "trained_at": "20190517-114518",
+ "rasa_core": "0.13.7",
"tensorflow": "1.12.0",
"sklearn": "0.20.2"
}
\ No newline at end of file
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/crf_model.pkl b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/crf_model.pkl
index 7841cc4..e6a306a 100644
Binary files a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/crf_model.pkl and b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/crf_model.pkl differ
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/intent_classifier_sklearn.pkl b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/intent_classifier_sklearn.pkl
index 53f3bfc..f0ada97 100644
Binary files a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/intent_classifier_sklearn.pkl and b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/intent_classifier_sklearn.pkl differ
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/metadata.json b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/metadata.json
index 88c58c1..890aed8 100644
--- a/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/metadata.json
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/models/nlu/default/weathernlu/metadata.json
@@ -82,6 +82,6 @@
}
],
"training_data": "training_data.json",
- "trained_at": "20190125-164210",
- "rasa_nlu_version": "0.14.1"
+ "trained_at": "20190517-113212",
+ "rasa_nlu_version": "0.14.6"
}
\ No newline at end of file
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/requirements.txt b/Full Code [Latest release of Rasa NLU and Rasa Core]/requirements.txt
index 4d3966f..c00bee3 100644
--- a/Full Code [Latest release of Rasa NLU and Rasa Core]/requirements.txt
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/requirements.txt
@@ -43,7 +43,7 @@ jsonschema==2.6.0
packaging==18.0
gevent==1.4.0
pytz==2018.9
-rasa_core_sdk~=0.12.1
+rasa_core_sdk~=0.12.2
pymongo==3.7.2
python-dateutil==2.7.5
rocketchat_API==0.6.25
@@ -55,9 +55,9 @@ python-socketio==3.1.1
pydot==1.4.1
keras-applications==1.0.6
keras-preprocessing==1.0.5
-protobuf==3.6.0
+protobuf>=3.6.1
###additional
pypandoc
-rasa_core
-git+https://github.com/apixu/apixu-python.git
\ No newline at end of file
+rasa_core==0.13.7
+git+https://github.com/apixu/apixu-python.git
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/run_app.py b/Full Code [Latest release of Rasa NLU and Rasa Core]/run_app.py
index 8533da3..17434e5 100644
--- a/Full Code [Latest release of Rasa NLU and Rasa Core]/run_app.py
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/run_app.py
@@ -1,15 +1,31 @@
from rasa_core.channels.slack import SlackInput
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
-import yaml
+
from rasa_core.utils import EndpointConfig
+import os
+
+try:
+ #print(os.environ)
+ print("Bot_User_OAuth_Access_Token=" + os.environ["Bot_User_OAuth_Access_Token"])
+ Bot_User_OAuth_Access_Token = os.environ['Bot_User_OAuth_Access_Token']
+except KeyError:
+ print("Please set the environment variable 'Bot_User_OAuth_Access_Token'")
+ os.sys.exit(1)
+
+#input_channel = SlackInput('xoxb...' #your bot user authentication token)
+input_channel = SlackInput(Bot_User_OAuth_Access_Token)
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/weathernlu')
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
-agent = Agent.load('./models/dialogue', interpreter = nlu_interpreter, action_endpoint = action_endpoint)
-input_channel = SlackInput('xoxb...' #your bot user authentication token
- )
+agent = Agent.load('./models/dialogue',
+ interpreter = nlu_interpreter,
+ action_endpoint = action_endpoint)
+
+# You need to setup Slack API's "Event Subscriptions" after you "grok http 5004" after this script running up:
+# 1.)
+# http://XXXXXXX.ngrok.io/webhooks/slack/webhook (watch out the routes and the grok's URL)
-agent.handle_channels([input_channel], 5004, serve_forever=True)
\ No newline at end of file
+agent.handle_channels([input_channel], 5004, serve_forever=True)
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/samples/printenv.py b/Full Code [Latest release of Rasa NLU and Rasa Core]/samples/printenv.py
new file mode 100644
index 0000000..4228c7e
--- /dev/null
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/samples/printenv.py
@@ -0,0 +1,10 @@
+import os
+
+if __name__ == '__main__':
+ try:
+ #print(os.environ)
+ #os.environ["APIXU_KEY"]
+ print("APIXU_KEY=" + os.environ["APIXU_KEY"])
+ except KeyError:
+ print("Please set the environment variable APIXU_KEY")
+ sys.exit(1)
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/setup-additional.sh b/Full Code [Latest release of Rasa NLU and Rasa Core]/setup-additional.sh
new file mode 100755
index 0000000..98831c4
--- /dev/null
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/setup-additional.sh
@@ -0,0 +1,4 @@
+#!/bin/bash -x
+
+python3 -m spacy download en
+
diff --git a/Full Code [Latest release of Rasa NLU and Rasa Core]/train_interactive.py b/Full Code [Latest release of Rasa NLU and Rasa Core]/train_interactive.py
index a6a690c..6ac051a 100644
--- a/Full Code [Latest release of Rasa NLU and Rasa Core]/train_interactive.py
+++ b/Full Code [Latest release of Rasa NLU and Rasa Core]/train_interactive.py
@@ -20,7 +20,7 @@ def run_weather_online(interpreter,
training_data_file='data/stories.md'):
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent(domain_file,
- policies=[MemoizationPolicy(max_history=2), KerasPolicy(max_history=3, epochs=3, batch_size=50)],
+ policies=[MemoizationPolicy(max_history=2), KerasPolicy(max_history=3, epochs=300, batch_size=50)],
interpreter=interpreter,
action_endpoint=action_endpoint)
diff --git a/Full Code/run_app.py b/Full Code/run_app.py
index 155f523..b2221f1 100644
--- a/Full Code/run_app.py
+++ b/Full Code/run_app.py
@@ -3,13 +3,36 @@
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_slack_connector import SlackInput
+import os
+
+# You need to provide APIXUKEY in file export_APIXU_KEY.sh since it won't be saved in GIT
+#
+# http://api.apixu.com/v1/current.json?key=&q=paris
+try:
+ #print(os.environ)
+ print("Bot_User_OAuth_Access_Token=" + os.environ["Bot_User_OAuth_Access_Token"])
+ Bot_User_OAuth_Access_Token = os.environ['Bot_User_OAuth_Access_Token']
+except KeyError:
+ print("Please set the environment variable 'Bot_User_OAuth_Access_Token'")
+ sys.exit(1)
+
+#input_channel = SlackInput('xoxb...' #your bot user authentication token)
+input_channel = SlackInput(Bot_User_OAuth_Access_Token)
+
+nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/weathernlu')
+action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
+
+agent = Agent.load('./models/dialogue',
+ interpreter = nlu_interpreter,
+ action_endpoint = action_endpoint)
+
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/weathernlu')
agent = Agent.load('./models/dialogue', interpreter = nlu_interpreter)
-input_channel = SlackInput('xoxp...', #app verification token
- 'xoxb...', # bot verification token
- '...', # slack verification token
- True)
+#input_channel = SlackInput('xoxp...', #app verification token
+# 'xoxb...', # bot verification token
+# '...', # slack verification token
+# True)
-agent.handle_channel(HttpInputChannel(5004, '/', input_channel))
\ No newline at end of file
+agent.handle_channel(HttpInputChannel(5004, '/', input_channel))
diff --git a/apixu-samples/apixu-current.py b/apixu-samples/apixu-current.py
new file mode 100644
index 0000000..4d571ac
--- /dev/null
+++ b/apixu-samples/apixu-current.py
@@ -0,0 +1,15 @@
+import os
+
+from apixu.client import ApixuClient
+
+api_key = os.environ['APIXU_KEY']
+#api_key = 'xxxx' #your apixu key
+client = ApixuClient(api_key)
+
+current = client.current(q='London')
+
+print(current['location']['name'])
+print(current['location']['region'])
+
+print(current['current']['last_updated_epoch'])
+