Skip to content

Instantly share code, notes, and snippets.

@itsromiljain
itsromiljain / dialogue_model.py
Created April 4, 2019 03:40
Slack Integration code
import logging
from rasa_core import config
from rasa_core import utils
from rasa_core.channels.slack import SlackInput
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.utils import EndpointConfig
logfile = 'dialogue_model.log'
@itsromiljain
itsromiljain / actions.py
Created April 1, 2019 04:16
Action file to define Custom Actions
from rasa_core_sdk import Action
import requests
import json
class ActionGetNewst(Action):
def name(self):
return 'action_get_news'
@itsromiljain
itsromiljain / dialogue_model.py
Created April 1, 2019 03:53
Python file for Training and Running Rasa Core
import logging
from rasa_core import config
from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.utils import EndpointConfig
logfile = 'dialogue_model.log'
@itsromiljain
itsromiljain / endpoints.yml
Created March 31, 2019 06:59
Endpoint for Custom Action used by Rasa Core
action_endpoint:
url: "http://localhost:5055/webhook"
@itsromiljain
itsromiljain / policy.yml
Created March 30, 2019 23:58
Policies for Rasa Core
policies:
- name: KerasPolicy
epochs: 100
max_history: 3
- name: MemoizationPolicy
max_history: 3
- name: FallbackPolicy
nlu_threshold: 0.1
core_threshold: 0.2
fallback_action_name: 'utter_default'
@itsromiljain
itsromiljain / domain
Created March 30, 2019 23:26
Domain file for Rasa Core
slots:
category:
type: text
entities:
- category
intents:
- greet
- fine_ask
@itsromiljain
itsromiljain / stories
Created March 30, 2019 02:58
Dialog Management for Rasa Core
## fallback
- utter_default
## greeting path 1
* greet
- utter_greet
## fine path 1
* fine_normal
- utter_help
@itsromiljain
itsromiljain / nlu_output.log
Last active March 30, 2019 00:57
Output from the NLU
{'entities': [{'confidence': 0.7756870940230542,
'end': 39,
'entity': 'category',
'extractor': 'ner_crf',
'start': 34,
'value': 'world'}],
'intent': {'confidence': 0.7036955584872587, 'name': 'news'},
'intent_ranking': [{'confidence': 0.7036955584872587, 'name': 'news'},
{'confidence': 0.08354613362606624, 'name': 'bye'},
{'confidence': 0.07291869896872455, 'name': 'fine_ask'},
@itsromiljain
itsromiljain / nlu_model.py
Created March 30, 2019 00:18
Python file to train and run the Rasa NLU
import logging
import pprint
from rasa_nlu.training_data import load_data
from rasa_nlu import config
from rasa_nlu.model import Trainer
from rasa_nlu.model import Interpreter
from rasa_nlu.evaluate import run_evaluation
logfile = 'nlu_model.log'
@itsromiljain
itsromiljain / nlu_config.yml
Created March 30, 2019 00:16
Pipeline configuration for Rasa NLU
language: "en"
pipeline: "spacy_sklearn"