Conversational AI solutions

Rating & reviews (0 reviews)
Study notes

Bot = application with a conversational interface.
Must be:
  • Discoverable (integrate in Teams, website)
  • Intuitive and easy to use
  • Available on the devices and platforms used by target public
  • Solve user problems with minimal use
  • Better experience than alternative.
Responsible AI
  • Respects relevant cultural norms and guards against misuse.
  • Reliable.
  • Treats people fairly.
  • Respect user privacy.
  • Handles data securely.
  • Accept responsibility operation and how it affects people.
Implement a Bot solutions in Azure:
  • Azure Bot Service - Dedicated cloud service.
  • Bot Framework Service - useREST API for handling bot activities.
  • Bot Framework SDK - usetools and libraries for end-to-end bot development that abstracts the REST interface - use programming languages.
Build a Bot- tools:
  • Power Virtual Agents
    Power Virtual Agents (PVA) is built on the Microsoft Power Platform, and enables users to build a chatbot without requiring any code.
  • Framework Composer
    App for developers to build, test, and publish your bot via an interactive interface.
    It is an app for developers to build, test, and publish your bot via an interactive interface.
  • Framework SDK
    Collection oflibraries and tools to build, test, publish, and manage conversational bots. The SDK can connect to other AI services, covers end-to-end bot development, and offers the most authoring flexibility.
1. Developing a Bot with the Bot Framework SDK

SDK - Extensive set of tools and libraries that software engineers can use to develop bots. The SDK is available for multiple programming languages, including Microsoft C# (.NET Core), Python, and JavaScript (Node.js)

Bot templates:
Are based on the Bot class defined in the Bot Framework SDK
  • Empty Bot - skeleton.
  • Echo Bot - a simple, sample. echo to messages.
  • Core Bot - comprehensive bot that includes common bot functionality (integration with the Language Understanding service)
Bot logic:
The Bot Framework Service notifies your bot's adapter when an activity occurs in a channel by calling its Process Activity method, and the adapter creates a contextfor the turn and calls the bot's Turn Handler methodto invoke the appropriate logic for the activity.

The logic for processing the activity can be implemented in multiple ways. The Bot Framework SDK provides classes that can help you build bots that manage conversations using:
  • Activity handlers
    Event methods that you can override to handle different kinds of activities.
    For simple bots, implement an event-driven conversation model in which the events are triggered by activities: users joining the conversation, message being received.
    Activity occurs - Bot Framework Service calls the bot adapter's Process Activity function, passing the activity details - adapter creates a turn context for the activity and passes it to the bot's turn handler, which calls the individual, event-specific activity handler.
    Activitieshandled by ActivityHandlerbase class:
    • Message received
    • Members joined the conversation
    • Members left the conversation
    • Message reaction received
    • Bot installed
  • Dialogs
    More complex patterns for handling stateful, multi-turn conversations - conversational flows where you need to store statebetween turns.
    • Component dialogs
      dialog that can contain other dialogs, defined in its dialog set
      each step to be a prompt dialog so that conversational flow consists of gathering input data from the user sequentially. Each step must be completed before passing the output onto the next step
    • Adaptive dialogs
      Container dialog in which the flow is more flexible, allowing for interruptions, cancellations, and context switchesat any point in the conversation
      There is a recognizer that analyzes natural language inputand detects intents, which can be mapped to triggers that change the flow of the conversation.
Deploy Bot
  • Create the Azure resource
  • Register an Azure app
  • Create a bot application service
  • Prepare your bot for deployment
  • Deploy your bot as a web app
  • Test and configure in the Azure portal

2. Create a Bot with the Bot Framework Composer
Bot Framework Composer is a visual designer that lets you quickly and easily build sophisticated conversational bots without writing code

Pros - compared with SDK
  • Visual design - development more accessible.
  • Save time - fewer steps to set up your environment.
  • Visualize Dialogs - easy guide the conversation.
  • Triggers - easily created
  • Enables saving of pieces of data to various scopes to remember things between dialogs or sessions.
  • Test your bot directly inside Composer via embedded Web Chat.
Any bot interaction begins with a main dialogin which the bot welcomesa user and establishes the initial conversation,and then triggers child dialogs.
Dialogs:
  • Have a flexible conversation flow, allowing for interruptions, cancellations, and context switches at any point in the conversation.
  • Consists of:
    • One or more actions - define the flow of message activities in the dialog (sending a message, prompting the user for input, asking a question, etc.)
    • Trigger -invokes the dialog logic for certain conditions or based on intent detected.
    • Recognizer -invokes the which interprets user input to determine semantic intent.
  • Has memory in which values are stored as properties.
    Properties can be defined at various scopes
    • user scope (variables that store information for the lifetime of the user session with the bot, such as user.greeted)
    • dialog scope (variables that persist for the lifetime of the dialog, such as dialog.response).
  • Adaptive - has ability to adapt to any kind of interruption to the conversational flow,
Interruption= when the recognizeridentifies input that fires a trigger, signaling a conversational context change.
The ability to handle interruptions is configurable for each user input action, under the Prompt Configurations tab of the action.

Provide good user experience - how you present the bot:
  • Text - a typical interaction
    Do not assume user know something. be very precise in what you ask, take out any ambiguity.
  • Buttons - presenting the user with buttons from which to select options.
  • Images - enhance the user experience
  • Cards - allow you to present your users
The Bot Framework Composer interface includes a Response Editor that can generate the appropriate language generation code for you, making it easier to create conversational responses.

Hands-On Bot Framework Composer, Login to view

Hands-On Bot Framework SDK, Login to view

References