Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.rst

Python Bot Framework Wrapper

Description: Python wrapper and package for Bot Framework REST API and State REST API (not production ready, yet).

A snippet of a basic bot:

from pybotframework.botframework import BotFramework
from pybotframework.sklearn_connector import SklearnConnector

# Labels for ML model
target_names = ['neg', 'pos']

# Instatiate the connector to custom ML model
sklearn_lang_conn = SklearnConnector(model_file='sentiment.pkl',
                                     target_names=target_names)

# Instatiate the bot
my_app = BotFramework(connectors=[sklearn_lang_conn])

if __name__ == '__main__':
    """Run the Flask app"""
    my_app.run_server(host='0.0.0.0', port=3978, debug=True)

See the README in the examples folder for running a test bot.

Installation

Install the pybotframework package from this repository with

pip install .

or

python setup.py

Requirements for Examples

You will also need the following models and data:

Docker Instructions

To build and run the Docker image ensure you have Docker running. https://docs.docker.com/engine/installation/

Then set up the botframework emulator.

https://docs.microsoft.com/en-us/bot-framework/debug-bots-emulator

Make sure to go through the "Install and configure ngrok" settings (ensure you have ngrok installed - see Requirements above). Uncheck the "Bypass ngrok for local addresses" to enable the bot to talk with Docker.

Now build the Docker image on the command line.

cd <pybotframework base directory>

docker build .

docker images

Search for your Docker "Image ID" in the list

docker run -p 3978:3978 -id <image ID> python

docker ps

You should see your container ID running.

Now try to connect to the bot by entering the address in the Emulator: http://localhost:3978/api/messages

You should see the messages "User added!" and "Bot added!" This means that you are set up!

Links

You can’t perform that action at this time.