Skip to content

Instantly share code, notes, and snippets.

View JustinaPetr's full-sized avatar

Justina Petraityte JustinaPetr

View GitHub Profile
class RestaurantForm(FormAction):
"""Example of a custom form action"""
def name(self):
"""Unique identifier of the form"""
return "restaurant_form"
class RestaurantForm(FormAction):
"""Example of a custom form action"""
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
from custom import GoogleConnector
from rasa_core.utils import EndpointConfig
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
nlu_interpreter = RasaNLUInterpreter('./models/current/nlu_model')
agent = Agent.load('./models/current/dialogue', interpreter = nlu_interpreter, action_endpoint=action_endpoint)
input_channel = GoogleConnector()
def blueprint(self, on_new_message):
google_webhook = Blueprint('google_webhook', __name__)
@classmethod
def name(cls)
return ‘google_assistant’
class GoogleAssistant(InputChannel):
@classmethod
def name(cls):
def blueprint(self, on_new_message):
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from flask import Flask, Response, Blueprint, request, jsonify
from rasa_core.channels.channel import UserMessage, OutputChannel
from rasa_core.channels.channel import InputChannel
{
"actions": [
{
"description": "Default Welcome Intent",
"name": "MAIN",
"fulfillment": {
"conversationName": "welcome"
},
"intent": {
"name": "actions.intent.MAIN",
{
"actions": [
{
"description": "Default Welcome Intent",
"name": "MAIN",
"fulfillment": {
"conversationName": "<INSERT YOUR CONVERSATION NAME HERE>"
},
"intent": {
"name": "actions.intent.MAIN",
templates:
utter_greet:
- "Hey, how can I help you?"
utter_goodbye:
- "Talk to you later!"
- "Goodbye :("
- "Bye!"
utter_affirm:
- "Cool. Let me book the spot for you."
- "Glad to hear. I'll make an RSVP for you."