Bot framework sdk

Bot framework sdk DEFAULT

Bot Framework

What's new with Bot Framework?

Bot Framework provides the most comprehensive experience for building conversation applications.

With the Bot Framework SDK, developers can build bots that converse free-form or with guided interactions including using simple text or rich cards that contain text, images, and action buttons.

Developers can model and build sophisticated conversation using their favorite programming languages including C#, JS, Python and Java or using Bot Framework Composer, an open-source, visual authoring canvas for developers and multi-disciplinary teams to design and build conversational experiences with Language Understanding, QnA Maker and sophisticated composition of bot replies (Language Generation).

Checkout the Bot Framework ecosystem section to learn more about other tooling and services related to the Bot Framework SDK.

Bot Framework SDK

Quicklinks

| Bot Framework Composer | C# Repo | JS Repo | Python Repo | Java Repo | BF CLI |

Bot Framework SDK v4

The Bot Framework SDK v4 is an open source SDK that enable developers to model and build sophisticated conversation using their favorite programming language.

Channels and Adapters

There are two ways to connect your bot to a client experience:

  • Azure Bot Service Channel - Language and SDK independent support via Azure Bot Service
  • Bot Framework SDK Adapter - A per language Adapter component

Community Open Source Projects

The following open source communities make various components available to extend your bot application, including adapters, recognizers, dialogs and middleware.

Questions and Help

If you have questions about Bot Framework SDK or using Azure Bot Service, we encourage you to reach out to the community and Azure Bot Service dev team for help.

See all of the available support options here.

Issues and feature requests

We track functional issues and features asks for the Bot Framework SDK, tools and Azure Bot Service in a variety of locations. If you have found an issue or have a feature request, please submit an issue to the below repositories.

ItemDescriptionLink
SDK v4 .NETcore bot runtime for .NET, connectors, middleware, dialogs, prompts, LUIS and QnAFile an issue
SDK v4 JavaScriptcore bot runtime for Typescript/Javascript, connectors, middleware, dialogs, prompts, LUIS and QnAFile an issue
SDK v4 Pythoncore bot runtime for Python, connectors, middleware, dialogs, prompts, LUIS and QnAFile an issue
SDK v4 Javacore bot runtime for Java, connectors, middleware, dialogs, prompts, LUIS and QnAFile an issue
Bot Framework Composerbot framework composer electron and web appFile an issue
Bot Framework CLIbot framework cli toolsFile an issue
Webchatbot framework web chat toolFile an issue

Prior releases

Bot Framework ecosystem

Bot Framework Composer

Bot Framework Composer is an integrated development tool for developers and multi-disciplinary teams to build bots and conversational experiences with the Microsoft Bot Framework. Within this tool, you'll find everything you need to build a sophisticated conversational experience.

Botkit

Botkit is a developer tool and SDK for building chat bots, apps and custom integrations for major messaging platforms. Botkit bots triggers, questions and replies. Developers can use this syntax to build dialogs - now cross compatible with the latest version of Bot Framework SDK.

In addition, Botkit brings with it 6 platform adapters allowing Javascript bot applications to communicate directly with messaging platforms: Slack, Webex Teams, Google Hangouts, Facebook Messenger, Twilio, and Web chat.

Botkit is part of Microsoft Bot Framework and is released under the MIT Open Source license

Bot Framework Virtual Assistant Solution Accelerator

The Bot Framework Solutions repository is home to the Virtual Assistant Solution Accelerator, which provides a set of templates, solution accelerators and skills to help build sophisticated conversational experiences.

  • Virtual Assistant. Customers and partners have a significant need to deliver a conversational assistant tailored to their brand, personalized to their users, and made available across a broad range of canvases and devices.

    This brings together all of the supporting components and greatly simplifies the creation of a new bot project including: basic conversational intents, Dispatch integration, QnA Maker, Application Insights and an automated deployment.

  • Skills. A library of re-usable conversational skill building-blocks enabling you to add functionality to a Bot. We currently provide: Calendar, Email, Task, Point of Interest, Automotive, Weather and News skills. Skills include LUIS models, Dialogs, and integration code delivered in source code form to customize and extend as required.

  • Analytics. Gain key insights into your bot’s health and behavior with the Bot Framework Analytics solutions, which includes: sample Application Insights queries, and Power BI dashboards to understand the full breadth of your bot’s conversations with users.

Azure Bot Service

Azure Bot Service enables you to host intelligent, enterprise-grade bots with complete ownership and control of your data. Developers can register and connect their bots to users on Skype, Microsoft Teams, Cortana, Web Chat, and more. [Docs]

  • Direct Line JS Client: If you want to use the Direct Line channel in Azure Bot Service and are not using the WebChat client, the Direct Line JS client can be used in your custom application. [Readme]
  • Direct Line Speech Channel: We are bringing together the Bot Framework and Microsoft's Speech Services to provide a channel that enables streamed speech and text bi-directionally from the client to the bot application. To sign up, add the 'Direct Line Speech' channel to your Azure Bot Service.
  • Better isolation for your Bot - Direct Line App Service Extension : The Direct Line App Service Extension can be deployed as part of a VNET, allowing IT administrators to have more control over conversation traffic and improved latency in conversations due to reduction in the number of hops. Get started with Direct Line App Service Extension here. A VNET lets you create your own private space in Azure and is crucial to your cloud network as it offers isolation, segmentation, and other key benefits.

Bot Framework Emulator

The Bot Framework Emulator is a cross-platform desktop application that allows bot developers to test and debug bots built using the Bot Framework SDK. You can use the Bot Framework Emulator to test bots running locally on your machine or to connect to bots running remotely. [Download latest | Docs]

Bot Framework Web Chat

The Bot Framework Web Chat is a highly customizable web-based client chat control for Azure Bot Service that provides the ability for users to interact with your bot directly in a web page. [Stable release | Docs | Samples]

Bot Framework CLI

The Bot Framework CLI Tools hosts the open source cross-platform Bot Framework CLI tool, designed to support building robust end-to-end development workflows. The Bot Framework CLI tool replaced the legacy standalone tools used to manage bots and related services. BF CLI aggregates the collection of cross-platform tools into one cohesive and consistent interface.

Related Services

Language Understanding

A machine learning-based service to build natural language experiences. Quickly create enterprise-ready, custom models that continuously improve. Language Understanding Service(LUIS) allows your application to understand what a person wants in their own words. [Docs | Add language understanding to your bot]

QnA Maker

QnA Maker is a cloud-based API service that creates a conversational, question-and-answer layer over your data. With QnA Maker, you can build, train and publish a simple question and answer bot based on FAQ URLs, structured documents, product manuals or editorial content in minutes. [Docs | Add qnamaker to your bot]

Dispatch

Dispatch tool lets you build language models that allow you to dispatch between disparate components (such as QnA, LUIS and custom code). [Readme]

Speech Services

Speech Services convert audio to text, perform speech translation and text-to-speech with the unified Speech services. With the speech services, you can integrate speech into your bot, create custom wake words, and author in multiple languages. [Docs]

Adaptive Cards

Adaptive Cards are an open standard for developers to exchange card content in a common and consistent way, and are used by Bot Framework developers to create great cross-channel conversatational experiences.

  • Open framework, native performance - A simple open card format enables an ecosystem of shared tooling, seamless integration between apps, and native cross-platform performance on any device.
  • Speech enabled from day one - We live in an exciting era where users can talk to their devices. Adaptive Cards embrace this new world and were designed from the ground up to support these new experiences.

Contributing

See our contributing guidelines.

Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at [email protected] You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

Copyright (c) Microsoft Corporation. All rights reserved.

Sours: https://github.com/microsoft/botframework-sdk

Microsoft Bot Builder V4 Templates

The Microsoft Bot Builder V4 Templates are available for .NET, and will let you quickly set up a conversational AI bot using core AI capabilities. They are available as a VSIX package.

About

Microsoft Bot Builder V4 Templates will help you build new conversational AI bots using the Microsoft Bot Framework v4.

Templates

There are three different template options. The table below can help guide which template is right for you.

TemplateDescription
Echo BotA good template if you want a little more than "Hello World!", but not much more. This template handles the very basics of sending messages to a bot, and having the bot process the messages by repeating them back to the user. This template produces a bot that simply "echoes" back to the user anything the user says to the bot.
Core BotOur most advanced template, the Core Bot template provides 6 core features every bot is likely to have. This template covers the core features of a Conversational-AI bot using LUIS. See the Core Bot Features table below for more details.
Core Bot with TestsOur Core Bot template plus a full unit test project. This template contains all the Core Bot features plus a complete set of unit tests showing how to unit test Core Bot using the Bot Framework Testing framework introduced in version 4.5 of Bot Framework.
Empty BotA good template if you are familiar with Bot Framework v4, and simple want a basic skeleton project. Also a good option if you want to take sample code from the documentation and paste it into a minimal bot in order to learn.

How to Choose a Template

TemplateWhen This Template is a Good Choice
Echo BotYou are new to Bot Framework v4 and want a working bot with minimal features.
Core BotYou understand some of the core concepts of Bot Framework v4 and are beyond the concepts introduced in the Echo Bot template. You're familiar with or are ready to learn concepts such as language understanding using LUIS, managing multi-turn conversations with Dialogs, handling user initiated Dialog interruptions, and using Adaptive Cards to welcome your users.
Core Bot with TestsThe Core Bot template plus a unit test project using the Bot Framework test framework introduced in version 4.5 of Bot Framework.
Empty BotYou are a seasoned Bot Framework v4 developer. You've built bots before, and want the minimum skeleton of a bot to help you get started.

Template Overview

Echo Bot Template

The Echo Bot template is slightly more than the a classic "Hello World!" example, but not by much. This template shows the basic structure of a bot, how a bot recieves messages from a user, and how a bot sends messages to a user. The bot will "echo" back to the user, what the user says to the bot. It is a good choice for first time, new to Bot Framework v4 developers.

Core Bot Template

The Core Bot template consists of set of core features most every bot is likely to have. Building off of the core message processing features found in the Echo Bot template, this template adds a number of more sophisticated features. The table below lists these features and provides links to additional documentation.

Core Bot FeaturesDescription
Send and receive messagesThe primary way your bot will communicate with users, and likewise receive communication, is through message activities. Some messages may simply consist of plain text, while others may contain richer content such as cards or attachments.
Proactive messaging using Adaptive CardsThe primary goal when creating any bot is to engage your user in a meaningful conversation. One of the best ways to achieve this goal is to ensure that from the moment a user first connects to your bot, they understand your bot’s main purpose and capabilities. We refer to this as "welcoming the user." The Core template uses an Adaptive Card to implement this behavior.
Language understanding using LUISThe ability to understand what your user means conversationally and contextually can be a difficult task, but can provide your bot a more natural conversation feel. Language Understanding, called LUIS, enables you to do just that so that your bot can recognize the intent of user messages, allow for more natural language from your user, and better direct the conversation flow.
Multi-turn conversation support using DialogsThe ability to manage conversations is an important part of the bot/user interation. Bot Framework introduces the concept of a Dialog to handle this conversational pattern. Dialog objects process inbound Activities and generate outbound responses. The business logic of the bot runs either directly or indirectly within Dialog classes.
Managing conversation stateA key to good bot design is to track the context of a conversation, so that your bot remembers things like the answers to previous questions.
How to handle user-initiated interruptionsWhile you may think that your users will follow your defined conversation flow step by step, chances are good that they will change their minds or ask a question in the middle of the process instead of answering the question. Handling interruptions means making sure your bot is prepared to handle situations like this.
How to unit test a botOptionally, the Core Bot with Tests template can generate a corresponding test project that shows how to use the testing framework introduced in Bot Framework version 4.5. The testing project provides a complete set of units tests for Core Bot. It shows how to write unit tests to test the various features of Core Bot.

Empty Bot Template

The Empty Bot template is the minimal skeleton code for a bot. It provides a stub implementation that displays a message to a newly connected user. It does not perform any additional actions. If you are experienced writing bots with Bot Framework v4 and want the minimum scaffolding, the Empty Bot template is for you.

Features by Template

FeatureEmpty BotEcho BotCore BotCore Bot with Tests
Generate code in JavaScript or TypesScriptXXXX
Support local development and testing using the Bot Framework Emulator v4XXXX
Core bot message processingXXX
Deploy your bot to Microsoft AzureXXX
Welcome new users using Adaptive Card technologyXX
Support AI-based greetings using LUISXX
Use Dialogs to manage more in-depth conversationsXX
Manage conversation stateXX
Handle user interruptionsXX
Unit test a bot using Bot Framework Testing frameworkX

Installation

Prerequisites

Install the template.

  • You can download Microsoft Bot Builder V4 Templates here. Click the file to install the extension into Visual Studio.

Usage

Creating a New Bot Project

In Visual Studio go to File > New > Project....

Select template of choice from Bot Builder v4 templates, then click OK.

Running Your Bot

Running Your Bot Locally

Visual Studio

  • Navigate to the folder containing the file and open it in Visual Studio.
  • Run the project (press key)

.NET Core CLI

  • Install the .NET Core CLI tools.
  • Using the command line, navigate to your project's root folder.
  • Type .

Testing the bot using Bot Framework Emulator

Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.

  • Install the Bot Framework Emulator version 4.3.0 or greater from here

Connect to the bot using Bot Framework Emulator

  • Launch Bot Framework Emulator
  • File -> Open Bot
  • Enter a Bot URL of

Deploy the bot to Azure

To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.

The deployment process assumes you have an account on Microsoft Azure and are able to log into the Microsoft Azure Portal.

If you are new to Microsoft Azure, please refer to Getting started with Azure for guidance on how to get started on Azure.

Logging Issues and Providing Feedback

Issues and feedback about the templates can be submitted through the project's GitHub issues page.

Sours: https://marketplace.visualstudio.com/items?itemName=BotBuilder.botbuilderv4
  1. Smp realm codes
  2. Pvp code fortnite
  3. Opera vpn extension
  4. Adjustable bracelet tutorial

Microsoft Bot Framework SDK 3 code on Azure Bot Service without migrating to SDK 4

Step 1 — Create a Linux Virtual Machine on any Cloud Service Provider like AWS, Azure, GCP or even on your local but publicly accessible server.

Step 2 — Install all the dependencies of Microsoft Bot Framework SDK 3, for example nodejs, botbuilder for sdk3 and restify.

Step 3 — Deploy your existing bot code by copying the complete source code into a directory location with proper permissions in linux machine

Step 4 — Execute your app.js file using either “node start” command or “node app.js” command

Step 5 — If there are errors associated with missing packages, then fix them else we are good to go.

Step 6 — Create a Azure Bot Service on Azure (you need to have a proper subscription for this)

Step 7 — Choose “Bot Channel Registration” for registering your bot.

Step 8 — Provide a bot endpoint. This is tricky when you do not have a proper domain name and a SSL certificate as it needs https and domain name in the endpoint. If you do have domain name then map that domain with your Linux Machine IP and set the endpoint for example https://mydomain/api/messages

Step 9 — If you do not have a domain name and a SSL certificate then get a free domain name from https://www.freenom.com/en/index.html?lang=en

Step 10 — For https use LetsEncrypt for a free one https://letsencrypt.org/

Step 11 — Configure your domain name mapping and https SSL certificate configuration so that you can provide endpoint in the Azure Bot Service Channel Registration

Step 12 — Get APP ID and Password and replace the same in your bot code

Step 13 — Create a Webchat channel and get URL and Secret

Step 14 — Test with Webchat. Everything should be working fine and you can interact with your chatbot using your existing SDK 3 code.

The above steps is just a dirty way of making things happen. It is recommended to migrate to SDK 4 for more features and future support.

Sours: https://chatbotslife.com/microsoft-bot-framework-sdk-3-code-on-azure-bot-service-without-migrating-to-sdk-4-14afa3300887

npm

  • Bot Builder is a framework for building rich bots on virtually any platform.

    botframework

    published 4.14.1 • 3 months agopublished 4.14.1 3 months ago
  • Connects bots to the Microsoft Bot Connector Service.

    botframework

    published 0.9.6 • 6 years agopublished 0.9.6 6 years ago
  • An open-source location picker control for Microsoft Bot Framework powered by Bing's Maps REST services. This control makes the process of collecting and validating the user's desired location in a conversation easy and reliable.

    kgrashad

    published 2.0.0 • 4 years agopublished 2.0.0 4 years ago
  • Node dependencies for Bot Builder core library. Bot Builder is a toolkit for building rich bots on virtually any platform.

    botframework

    published 4.0.0-alpha2 • 4 years agopublished 4.0.0-alpha2 4 years ago
  • Luis client package for Luis query API

    botframework

    published 4.0.0-preview1.2 • 3 years agopublished 4.0.0-preview1.2 3 years ago
  • Cognitive services extensions for Microsoft BotBuilder.

    botframework

    published 4.14.1 • 3 months agopublished 4.14.1 3 months ago
  • Microsoft BotBuilder tools for working with choices.

    botframework

    published 4.0.0-preview1.2 • 3 years agopublished 4.0.0-preview1.2 3 years ago
  • A dialog stack based conversation manager for Microsoft BotBuilder.

    botframework

    published 4.14.1 • 3 months agopublished 4.14.1 3 months ago
  • Tool for parsing chat files and outputting replayable activities

    botframework

    published 1.2.4 • 2 years agopublished 1.2.4 2 years ago
  • Tooling for connectivity with LUIS APIs

    botframework

    published 2.6.2 • 2 years agopublished 2.6.2 2 years ago
  • Core components for Microsoft Bot Builder. Components in this library can run either in a browser or on the server.

    botframework

    published 4.14.1 • 3 months agopublished 4.14.1 3 months ago
  • Common middleware and related abstractions for the Bot Builder core library.

    botframework

    published 4.0.0-preview1.2 • 3 years agopublished 4.0.0-preview1.2 3 years ago
  • Lightweight prompt system for Bot Builder v4.

    botframework

    published 4.0.0-preview1.2 • 3 years agopublished 4.0.0-preview1.2 3 years ago
  • Sours: https://www.npmjs.com/~botframework

    Framework sdk bot

    What is the Bot Framework SDK?

    • 6 minutes to read

    APPLIES TO: SDK v4

    The Bot Framework, along with the Azure Bot Service, provides tools to build, test, deploy, and manage intelligent bots, all in one place. The Bot Framework includes a modular and extensible SDK for building bots, as well as tools, templates, and related AI services. With this framework, developers can create bots that use speech, understand natural language, handle questions and answers, and more.

    What is a bot?

    Bots provide an experience that feels less like using a computer and more like dealing with a person - or at least an intelligent robot. They can be used to shift simple, repetitive tasks, such as taking a dinner reservation or gathering profile information, on to automated systems that may no longer require direct human intervention. Users converse with a bot using text, interactive cards, and speech. A bot interaction can be a quick question and answer, or it can be a sophisticated conversation that intelligently provides access to services.

    A bot can be thought of as a web application that has a conversational interface. A user connects to a bot though a channel such as Facebook, Slack, or Microsoft Teams.

    • The bot reasons about input and performs relevant tasks. This can include asking the user for additional information or accessing services on behalf of the user.
    • The bot performs recognition on the user's input to interpret what the user is asking for or saying.
    • The bot generates responses to send to the user to communicate what the bot is doing or has done.
    • Depending on how the bot is configured and how it is registered with the channel, users can interact with the bot through text or speech, and the conversation might include images and video.

    A remote bot interacts with a user on a device via text, speech, images, or video

    Bots are a lot like modern web applications, living on the internet and using APIs to send and receive messages. What's in a bot varies widely depending on what kind of bot it is. Modern bot software relies on a stack of technology and tools to deliver increasingly complex experiences on a wide variety of platforms. However, a simple bot could just receive a message and echo it back to the user with very little code involved.

    Bots can do the same things other types of software can do - read and write files, use databases and APIs, and do the regular computational tasks. What makes bots unique is their use of mechanisms generally reserved for human-to-human communication.

    The Azure Bot Service and the Bot Framework offer:

    • The Bot Framework SDK for developing bots
    • Bot Framework Tools to cover end-to-end bot development workflow
    • Bot Framework Service (BFS) to send and receive messages and events between bots and channels
    • Bot deployment and channel configuration in Azure

    Additionally, bots may use other Azure services, such as:

    • Azure Cognitive Services to build intelligent applications
    • Azure Storage for cloud storage solution

    How to build a bot

    Azure Bot Service and the Bot Framework offer an integrated set of tools and services to facilitate this process. Choose your favorite development environment or command line tools to create your bot. SDKs exist for C#, Java, JavaScript, Typescript, and Python. We provide tools for various stages of bot development to help you design and build bots.

    Bot Overview

    Plan

    As with any type of software, having a thorough understanding of the goals, processes and user needs is important to the process of creating a successful bot. Before writing code, review the bot design guidelines for best practices and identify the needs for your bot. You can create a simple bot or include more sophisticated capabilities such as speech, natural language understanding, and question answering.

    Build

    Your bot is a web service that implements a conversational interface and communicates with the Bot Framework Service to send and receive messages and events. Bot Framework Service is one of the components of the Azure Bot Service and Bot Framework. You can create bots in any number of environments and languages. You can Create a bot for local development.

    As part of the Azure Bot Service and Bot Framework, we offer additional components you can use to extend your bot's functionality:

    FeatureDescriptionLink
    Add natural language processingEnable your bot to understand natural language, understand spelling errors, use speech, and recognize the user's intentHow to use LUIS
    Answer questionsAdd a knowledge base to answer questions users ask in a more natural, conversational wayHow to use QnA Maker
    Manage multiple modelsIf using more than one model, such as for LUIS and QnA Maker, intelligently determine when to use which one during your bot's conversationOrchestrator
    Add cards and buttonsEnhance the user experience with media other than text, such as graphics, menus, and cardsHow to add cards

    Note

    The table above is not a comprehensive list. Explore the articles on the left, starting with sending messages, for more bot functionality.

    Additionally, we provide command line tools to help you to create, manage, and test bot assets. These tools can configure LUIS apps, build a QnA knowledge base, build models to route between components, mock a conversation, and more. You can find more details in the command line tools README.

    You also have access to a variety of samples that showcase many of the capabilities available through the SDK. These are great for developers looking for a more feature-rich starting point.

    Test

    Bots are complex apps with a lot of different parts working together. Like any other complex app, this can lead to some interesting bugs or cause your bot to behave differently than expected. Before publishing, test your bot. We provide several ways to test bots before they are released for use:

    • Test your bot locally with the emulator. The Bot Framework Emulator is a stand-alone app that not only provides a chat interface but also debugging and interrogation tools to help understand how and why your bot does what it does. The Emulator can be run locally alongside your in-development bot application.

    • Test your bot on the web. Once configured through the Azure portal your bot can also be reached through a web chat interface. The web chat interface is a great way to grant access to your bot to testers and other people who do not have direct access to the bot's running code.

    • Unit Test your bot with the current Bot Framework SDK.

    Publish

    When you are ready for your bot to be available on the web, publish your bot to Azure or to your own web service or data center. Having an address on the public internet is the first step to your bot coming to life on your site, or inside chat channels.

    Connect

    Connect your bot to channels such as Facebook, Messenger, Kik, Slack, Microsoft Teams, Telegram, text/SMS, and Twilio. Bot Framework does most of the work necessary to send and receive messages from all of these different platforms - your bot application receives a unified, normalized stream of messages regardless of the number and type of channels it is connected to. For information on adding channels, see channels topic.

    Evaluate

    Use the data collected in Azure portal to identify opportunities to improve the capabilities and performance of your bot. You can get service-level and instrumentation data like traffic, latency, and integrations. Analytics also provides conversation-level reporting on user, message, and channel data. For more information, see how to gather analytics.

    Next steps

    Check out these case studies of bots or click on the link below to create a bot.

    Sours: https://docs.microsoft.com/en-us/azure/bot-service/bot-service-overview
    Azure Bot Service Tutorial - Create Chatbots in minutes

    Create a Bot with the Bot Framework SDK

    Bots are software agents that can participate in conversational dialogs with human users. The Microsoft Bot Framework provides a comprehensive platform for building bots that can be delivered as cloud services through the Azure Bot Service.

    In this exercise, you’ll use the Microsoft Bot Framework SDK to create and deploy a bot.

    Before you start

    Let’s start by preparing the environment for bot development.

    Update the Bot Framework Emulator

    You’re going to use the Bot Framework SDK to create your bot, and the Bot Framework Emulator to test it. The Bot Framework Emulator is updated regularly, so let’s make sure you have the latest version installed.

    Note: Updates may include changes to the user interface that affect the instructions in this exercise.

    1. Start the Bot Framework Emulator, and if you are prompted to install an update, do so for the currently logged in user. If you are not prompted automatically, use the Check for update option on the Help menu to check for updates.
    2. After installing any available update, close the Bot Framework Emulator until you need it again later.

    Clone the repository for this course

    If you have not already cloned AI-102-AIEngineer code repository to the environment where you’re working on this lab, follow these steps to do so. Otherwise, open the cloned folder in Visual Studio Code.

    1. Start Visual Studio Code.
    2. Open the palette (SHIFT+CTRL+P) and run a Git: Clone command to clone the repository to a local folder (it doesn’t matter which folder).
    3. When the repository has been cloned, open the folder in Visual Studio Code.
    4. Wait while additional files are installed to support the C# code projects in the repo.

      Note: If you are prompted to add required assets to build and debug, select Not Now.

    Create a bot

    You can use the Bot Framework SDK to create a bot based on a template, and then customize the code to meet your specific requirements.

    Note: In this exercise, you can choose to use either C# or Python. In the steps below, perform the actions appropriate for your preferred language.

    1. In Visual Studio Code, in the Explorer pane, browse to the 13-bot-framework folder and expand the C-Sharp or Python folder depending on your language preference.
    2. Right-click the folder for your chosen language and open an integrated terminal.
    3. In the terminal, run the following commands to install the bot templates and packages you need:

    C#

    Python

    1. After the templates and packages have been installed, run the following command to create a bot based on the EchoBot template:

    C#

    Python

    If you’re using Python, when prompted by cookiecutter, enter the following details:

    • bot_name: TimeBot
    • bot_description: A bot for our times
    1. In the terminal pane, enter the following commands to change the current directory to the TimeBot folder list the code files that have been generated for your bot:

    Test the bot in the Bot Framework Emulator

    You’ve created a bot based on the EchoBot template. Now you can run it locally and test it by using the Bot Framework Emulator (which should be installed on your system).

    1. In the terminal pane, ensure that the current directory is the TimeBot folder containing your bot code files, and then enter the following command to start your bot running locally.

    C#

    Python

    When the bot starts, note the endpoint at which it is running is shown. This should be similar to http://localhost:3978.

    1. Start the Bot Framework Emulator, and open your bot by specifying the endpoint with the /api/messages path appended, like this:

    2. After the conversation is opened in a Live chat pane, wait for the message Hello and welcome!.
    3. Enter a message such as Hello and view the response from the bot, which should echo back the message you entered.
    4. Close the Bot Framework Emulator and return to Visual Studio Code, then in the terminal window, enter CTRL+C to stop the bot.

    Modify the bot code

    You’ve created a bot that echoes the user’s input back to them. It’s not particularly useful, but serves to illustrate the basic flow of a conversational dialog. A conversation with a bot consists of a sequence of activities, in which text, graphics, or user interface cards are used to exchange information. The bot begins the conversation with a greeting, which is the result of a conversation update activity that is triggered when a user initializes a chat session with the bot. Then the conversation consists of a sequence of further activities in which the user and bot take it in turns to send messages.

    1. In Visual Studio Code, open the following code file for your bot:
      • C#: TimeBot/Bots/EchoBot.cs
      • Python: TimeBot/bot.py

      Note that the code in this file consists of activity handler functions; one for the Member Added conversation update activity (when someone joins the chat session) and another for the Message activity (when a message is received). The conversation is based on the concept of turns, in which each turn represents an interaction in which the bot receives, processes, and responds to an activity. The turn context is used to track information about the activity being processed in the current turn.

    2. At the top of the code file, add the following namespace import statement:

    C#

    Python

    1. Modify the activity handler function for the Message activity to match the following code:

    C#

    Python

    1. Save your changes, and then in the terminal pane, ensure that the current directory is the TimeBot folder containing your bot code files, and then enter the following command to start your bot running locally.

    C#

    Python

    As before, when the bot starts, note the endpoint at which it is running is shown.

    1. Start the Bot Framework Emulator, and open your bot by specifying the endpoint with the /api/messages path appended, like this:

    2. After the conversation is opened in a Live chat pane, wait for the message Hello and welcome!.
    3. Enter a message such as Hello and view the response from the bot, which should be Ask me what the time is.
    4. Enter What is the time? and view the response.

      The bot now responds to the query “What is the time?” by displaying the local time where the bot is running. For any other query, it prompts the user to ask it what the time is. This is a very limited bot, which could be improved through integration with the Language Understanding service and additional custom code, but it serves as a working example of how you can build a solution with the Bot Framework SDK by extending a bot created from a template.

    5. Close the Bot Framework Emulator and return to Visual Studio Code, then in the terminal window, enter CTRL+C to stop the bot.

    More information

    To learn more about the Bot Framework, view the Bot Framework documentation.

    Sours: https://microsoftlearning.github.io/AI-102-AIEngineer/Instructions/13-bot-framework.html

    You will also like:

    Rubber sausage with five seats with a traction force in the form of a motor boat. After paying the "tax" I sat down and immediately felt something that made me turn around. Turning around, I almost fell - she was sitting behind. I felt sick and not bad at the same time.



    4408 4409 4410 4411 4412