Intregrating Rasa Webchat with custom python functions - python

I want to give custom responses to the user on the webchat platform based on external python code. Also I want to retrieve all the user responses and process them to construct said custom responses. How do i connect rasa-webchat with my python code?
Whenever the user says something to the chatbot, i want to trigger a function that uses the intent classification results from rasa and also a few other functions to construct custom bot response.

i bumped into this when i was looking for some Rasa reference. This might help you on crafting your own custom responses.
For integration with webchat, this
forum might be useful. The video tutorial will guide you step by step on how to integrate the webchat with your Rasa model.
Have fun exploring !

Related

Difference beetween using pyTelegramBotAPI and Telegram Bot API

I'm new to python and telegram bot programming, and I have been programming a telegram bot using pyTelegramBotAPI because the tutorials I followed used it, but I can't find no information on the internet about a definition/description about pyTelegramBotAPI and why should I use it instead of Telegram Bot API.
Can someone help me with these questions? I literally couldn't find these information on the internet. Thanks
pyTelegramBotAPI is a python implementation of the Telegram Bot API.
You're not choosing to use pyTelegramBotAPI instead of the Telegram Bot API - rather you're choosing to use pyTelegramBotAPI for the Telegram Bot API. This is one of numerous Python implementations and Python is just one of many languages that implementations are written in. If you really want, you can operate a Telegram Bot using shell commands.
In general terms, an implementation of a HTTP-based API written in a particular language simplifies building your program by allowing you to specify your ID's and credentials, and then simply calling functions to get things done, instead of having to engineer every call and include the paramaters manually or repetitively. It also takes care of constructing the requests and passing the paramaters in a compatible format to the server, while it may also provide some additional parsing to the paramaters provided to the abstracted functions.
Reasons you may wish to use pyTelegramBotAPI:
You like the features and functionality of pyTelegramBotAPI. I.e. You're looking for a framework for a project like one of these
You want a Python implementation of the Telegram Bot API without having to build it from scratch yourself.
You want a fairly comprehensive and extensible implementation of the Telegram Bot API (true at the time of writing this)
The Documentation explains what you need to be aware of, and how certain aspects translate to the API. I.e, there's a paragraph explaining the convention of method names has been modified to more idiomatic Python;
Methods
All API methods are located in the TeleBot class. They are renamed to
follow common Python naming conventions. E.g. getMe is renamed to
get_me and sendMessage to send_message.
There's also a note about the renaming of from to from_user
Reasons you may not want to use pyTelegramBotAPI
As mentioned above, pyTelegramBotAPI is maintained and updated regularly at the time of writing this. However, there's never a guarantee that code written by someone else will always be maintained in either it's original form or forked off and taken in a new direction.
You may choose against using something like this if:
Python is unavailable in your environment
You require an extremely simple and lightweight use of a bot and could maintain it quicker by referring directly to the official Telegram API reference.
You are looking to integrate to another project using a different language.
You aren't confident in extending the the code to suit your requirements.

How to provide selection options as response in ChatterBot

I am creating a chat bot using python chatter bot library. I am able to train the chat bot in the English language. Next thing I want to accomplish is to build a chat bot to provide selection options to the user for filtering the data.
Example:
Request from user is Book a movie ticket.
I want to display the response as 3 buttons
In which time slot you want to book a movie ticket ?
a. Morning
b. Afternoon
c. Evening.
Is there any feature in Python ChatterBot to send back selection options as response to the user.
You can't get that type of response using GuntherCox's chatterbot Library considering the last stable version.
Read the following documentation to know more: Documentation Link
Else you can raise a issue and also here is their code base for your consideration to look deep down into it: Github Link
If you want intent and entity based chatbot you can look into Snips-nlu and Rasa.
https://github.com/snipsco/snips-nlu
https://github.com/RasaHQ/rasa
So far what I have seen is that chatterbot can only provide static responses. Snips has module for generating json dataset from yaml file where you can define intents, entities, multiple slots etc.
https://snips-nlu.readthedocs.io/en/latest/dataset.html
Rasa can provide what you are looking for. Provide response options based question. Provides easy training, HTTP API, python SDK etc.
https://rasa.com/docs/rasa/user-guide/rasa-tutorial/
Finally, this is a tool for generating training data for snips, rasa and others.
https://rasa.com/docs/rasa/user-guide/rasa-tutorial/

How to integrate an external NLP technique to Dialogflow?

I would like to use Dialogflow interface to create a voice assisted chatbot.
Still, I would like to be able to add my own components to it.
How can this be done ? If I have a python script with an NLP technique I'd want to add to my chatbot.
Dialogflow is mainly about NER and let's say I want to add TFIDF and text simplification to what's retrieved in my document.
I looked at the documentation and couldn't find anything on the subject.
you can use a Webhook: each intent is 'forwarded' to your webhook (ie custom app or script) and you have full access to the text provided by the user as well as the DialogFlow contexts/entities.
In your webhook you can can do what you want, including modifying the response to the user.
Hope it helps.
Beppe

How to put my DialogFlow chatbot with python on line?

I am developing a chatbot using DialogFlow, as my natural language processing handler, and Python as my client.
My application aims to talk with a human in a python environment (I am currently using a Jupyter Notebook), send the request to DialogFlow, get the response, then calculate the data using some python libraries and show the results to the user.
All the process described above is already working.
Now I must to find a way that lets the people uses my chatbot on line.
Here is my problem, I don't know how to model this.
I think I should put my chatbot in a webpage and make it communicate with my python application stored in a server.
Did anybody make something similar?
Given your current architecture, you'll have to do the following:
Write a client for your chatbot in HTML and JavaScript
Write a server in Python that contains your application logic and makes the API calls to Dialogflow
This is a pretty normal architecture for a web application. Given that you're using Python, you might find Flask or Django helpful.
There should be plenty of samples out there that can help you figure out what to do; I just found this blog post that demonstrates how to build a simple chat client/server with Flask and websockets.
If you're willing to change your architecture so that the user interacts directly with Dialogflow, and all of your application logic lives in the Dialogflow fulfillment webhook, you can make use of Dialogflow's Web Demo integration that provides a pre-built chat widget you can embed into an HTML page.

contextual conversation in chat bot using python

So I am making a chat bot. Things like Intent classification,entity extraction and dialog generation are almost done.The conversations are stateless and now i am stuck at implementing context in conversation(meaning chat bot can remember what the user said and respond accordingly ).
Is there any python library to do that?
If not can anyone guide me how can i do that?
I want the context management to be almost same as IBM Watson Conversation.
Thanks
At the present time, deep learning is the state of the art and Tensorflow is the great technology to take advantage of deep learning.
This is an amazing chatbot framework to build a conversational model for your custom chat bot. You should edit this JSON file to create your conversational intents. Moreover, you can edit the JSON file dynamically according to user's messages or information which are shared by user. You can create and develop an architecture for it so you can reach the stateless conversation system.
For example, you can analyze each messages of users by NLP and update the JSON file.
As a summary, you can develop an architecture by using this chatbot framework to create the stateless conversation system.

Categories

Resources