Git Product home page Git Product logo

microsoft / conversationlearner Goto Github PK

View Code? Open in Web Editor NEW
12.0 7.0 8.0 43.79 MB

Contains all packages for running ConversationLearner bots.

Home Page: https://www.microsoft.com/en-us/research/project/conversation-learner/

License: MIT License

JavaScript 6.88% CSS 2.75% HTML 34.71% TypeScript 35.96% Cool 11.90% C 7.45% Batchfile 0.02% Shell 0.02% SCSS 0.30%
react typescript botframework cognitive-services

conversationlearner's Introduction

ConversationLearner

CircleCI\

This repo contains 5 major components:

  1. Samples - Fully working bots using express, botbuilder, and the ConversationLearner SDK which demonstrate different use cases in code.
  2. SDK - Conversation Learner Software Development Kit. This acts as entry point and is intended to be included in your own bots.
  3. Administration UI - Provides graphical interface to manage, train, and test your bot.
  4. WebChat - Custom fork of standard WebChat which adds ability to load existing activities and show editing controls.
  5. Models - Contains shared code between the SDK and UI such as types and utilities.

Getting started

  1. Clone and build the repo
git clone https://github.com/Microsoft/ConversationLearner cl
cd cl
npm i
npx lerna bootstrap
npx lerna run build
  1. Start the bot

Create new .env file in the samples directory with your LUIS keys.

cd ./packages/samples
cp .env.example .env
<Add LUIS_AUTHORING_KEY and save>
npm start

You should see output similar to below (PORT may be different):

Adding /sdk routes
Adding /ui routes
Adding /directline routes
Server listening at: http://localhost:3978

Note the /ui /sdk and /directline routes are printed because we're running in development. These routes are not mounted in production.

  1. Run the UI

(Might need new terminal)

cd ./packages/ui
npm start

More Details about the SDK (Software Development Kit) package

The SDK includes contains 2 notable components:

  1. Express Router - The router is mounted to your server in development and used by the UI (above) during training
  2. Recognizer - Similar to other BotBuilder recognizers like LUIS the CL recognizer processes the given Bot context and returns results such as messages, adaptive cards, and more.

Using the SDK

Install @conversationlearner/sdk in consuming project:

npm install @conversationlearner/sdk --save-exact

Note: We recommend using --save-exact to lock the version since we are NOT following SemVer at this time. This can help prevent accidental package updates which may contain breaking changes if you are not using package-lock.json. We will move to following SemVer soon as we improve our release process.

Using the recognizer:

import { ConversationLearner, ICLOptions, ClientMemoryManager } from '@conversationlearner/sdk'

...

const sdkRouter = ConversationLearner.Init({
    CONVERSATION_LEARNER_SERVICE_URI: process.env.CONVERSATION_LEARNER_SERVICE_URI
})
if (isDevelopment) {
    server.use('/sdk', sdkRouter)
}

...

const cl = new ConversationLearner(modelId);

server.post('/api/messages', (req, res) => {
    adapter.processActivity(req, res, async context => {
        const result = await cl.recognize(context)
        
        if (result) {
            cl.SendResult(result);
        }
    })
})

Using the UI router.

Previously the UI was served separately and required to be run on a different port than your bot. Now the UI is included with your bot! The ui is availble at the /ui path of your bot url. The leaves the root / available for you to add a Bot landing page. There you can summarize your bot's purpose and capabilities to the user.

...
import { uiRouter } from '@conversationlearner/sdk'

...

"Mount the router at the root `/` as it internally has the /ui paths."
server.use(uiRouter)

...

server.listen(port)

conversationlearner's People

Contributors

adamtuliper avatar arincon avatar belvederehenrique avatar billba avatar danmarshall avatar eanders-ms avatar jasondwilliams avatar kant avatar larsliden avatar matthewshim-ms avatar mattmazzola avatar microsoft-github-operations[bot] avatar microsoftopensource avatar minervaen avatar msft-paulkim avatar msft-shahins avatar photodesignch avatar phui01 avatar pnwbrian avatar sdeskowronski avatar tpmsr avatar williamberryiii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.