%3CLINGO-SUB%20id%3D%22lingo-sub-2139570%22%20slang%3D%22en-US%22%3EHello%2C%20bot!%20Conversational%20AI%20on%20Microsoft%20Platform%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2139570%22%20slang%3D%22en-US%22%3E%3CDIV%3EDuring%20the%20pandemic%2C%20we%20all%20found%20ourselves%20in%20isolation%2C%20and%20relying%20more%20and%20more%20on%20effective%20electronic%20means%20of%20communication.%20The%20amount%20of%20digital%20conversations%20increased%20dramatically%2C%20and%20we%20need%20to%20rely%20on%20bots%20to%20help%20us%20handle%20some%20of%20those%20conversations.%20In%20this%20blog%20post%2C%20I%20give%20brief%20overview%20of%20conversational%20AI%20on%20Microsoft%20platform%20and%20show%20you%20how%20to%20build%20a%20simple%20educational%20bot%20to%20help%20students%20learn.%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EIf%20you%20prefer%20video%20content%2C%20here%20is%20a%20great%20video%20to%20get%20you%20started%2C%20from%20our%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Foverview%2Fai-platform%2Fdev-resources%2F%3FOCID%3DAID3029145%26amp%3BWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAI%20Developer%20Resources%3C%2FA%3E%20page%3A%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CBR%20%2F%3E%3CDIV%20class%3D%22video-embed-center%20video-embed%22%3E%3CIFRAME%20class%3D%22embedly-embed%22%20src%3D%22https%3A%2F%2Fcdn.embedly.com%2Fwidgets%2Fmedia.html%3Fsrc%3Dhttps%253A%252F%252Fwww.youtube.com%252Fembed%252FNh3S_sljkpI%26amp%3Bdisplay_name%3DYouTube%26amp%3Burl%3Dhttps%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253DNh3S_sljkpI%26amp%3Bimage%3Dhttp%253A%252F%252Fi.ytimg.com%252Fvi%252FNh3S_sljkpI%252Fhqdefault.jpg%26amp%3Bkey%3Db0d40caa4f094c68be7c29880b16f56e%26amp%3Btype%3Dtext%252Fhtml%26amp%3Bschema%3Dyoutube%22%20width%3D%22200%22%20height%3D%22112%22%20scrolling%3D%22no%22%20title%3D%22YouTube%20embed%22%20frameborder%3D%220%22%20allow%3D%22autoplay%3B%20fullscreen%22%20allowfullscreen%3D%22true%22%3E%3C%2FIFRAME%3E%3C%2FDIV%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CH1%20id%3D%22do-we-need-bots-and-when%22%20id%3D%22toc-hId-1271780957%22%20id%3D%22toc-hId-1271806963%22%3EDo%20We%20Need%20Bots%2C%20and%20When%3F%3C%2FH1%3E%0A%3CP%3EMany%20people%20believe%20that%20in%20the%20future%20we%20will%20be%20interacting%20with%20computers%20using%20speech%2C%20in%20the%20same%20way%20we%20interact%20between%20each%20other.%20While%20the%20future%20is%20still%20vague%2C%20we%20can%20already%20benefit%20from%20conversational%20interfaces%20in%20many%20areas%2C%20for%20example%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIn%20user%20support%2C%20which%20has%20traditionally%20been%20based%20on%20interpersonal%20communication%2C%20automated%20chat-bots%20can%20solve%20a%20lot%20of%20routine%20problems%20for%20the%20users%2C%20leaving%20human%20specialists%20for%20solving%20only%20unusual%20cases.%3C%2FLI%3E%0A%3CLI%3EDuring%20surgical%20operation%2C%20when%20hands-free%20interaction%20is%20essential.%20From%20personal%20experience%2C%20I%20find%20it%20personally%20more%20convenient%20to%20set%20morning%20alarm%20and%20%E2%80%9Cgood%20night%E2%80%9D%20music%20through%20voice%20assistant%20before%20going%20to%20sleep.%3C%2FLI%3E%0A%3CLI%3EAutomating%20some%20functions%20in%20interpersonal%20communication.%20My%20favorite%20example%20is%20a%20chat-bot%20that%20you%20can%20add%20to%20a%20group%20chat%20when%20organizing%20a%20party%2C%20and%20it%20will%20track%20how%20much%20money%20each%20of%20the%20participants%20spent%20on%20the%20preparation.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAt%20the%20current%20state%20of%20development%20of%20conversational%20AI%20technologies%2C%20a%20chat%20bot%20will%20not%20replace%20a%20human%2C%20and%20it%20will%20not%20pass%20Turing%20test.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CEM%3E%3CFONT%20size%3D%224%22%3EIn%20practice%2C%20chat%20bots%20act%20as%20an%20advanced%20version%20of%20a%20command%20line%2C%20in%20which%20you%20do%20not%20need%20to%20know%20exact%20commands%20to%20perform%20an%20action.%3C%2FFONT%3E%3C%2FEM%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3EThus%2C%20successful%20bot%20applications%20will%20not%20try%20to%20pretend%20to%20be%20a%20human%2C%20because%20such%20behavior%20is%20likely%20to%20cause%20some%20user%20dissatisfaction%20in%20the%20future.%20It%20is%20one%20of%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fai%2Fai-lab-conversational-ai%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eresponsible%20conversational%20AI%20principles%3C%2FA%3E%2C%20which%20you%20need%20to%20consider%20when%20designing%20a%20bot.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22educational-bots%22%20id%3D%22toc-hId--535673506%22%20id%3D%22toc-hId--535647500%22%3EEducational%20Bots%3C%2FH1%3E%0A%3CP%3EDuring%20the%20pandemic%2C%20one%20of%20the%20areas%20that%20is%20being%20transformed%20the%20most%20is%20education.%20We%20can%20envision%20educational%20bots%20that%20help%20student%20answer%20most%20common%20questions%2C%20or%20act%20as%20a%20virtual%20teaching%20assistant.%20In%20this%20blog%20post%2C%20I%20will%20show%20you%20how%20to%20create%20a%20simple%20assistant%20bot%20that%20will%20be%20able%20to%20handle%20several%20questions%20from%20the%20field%20of%20Geography.%3C%2FP%3E%0A%3CP%3EBefore%20we%20jump%20to%20this%20task%2C%20let%E2%80%99s%20talk%20about%20Microsoft%20conversational%20AI%20stack%20in%20general%2C%20and%20consider%20different%20development%20options.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22conversational-ai-development-stack%22%20id%3D%22toc-hId-1951839327%22%20id%3D%22toc-hId-1951865333%22%3EConversational%20AI%20Development%20Stack%3C%2FH1%3E%0A%3CP%3EWhen%20it%20comes%20to%20conversational%20AI%2C%20we%20can%20logically%20think%20of%20a%20conversational%20agent%20having%20two%20main%20parts%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EConversational%20interface%3C%2FSTRONG%3E%20handles%20passing%20messages%20from%20the%20user%20to%20the%20bot%20and%20back.%20It%20takes%20care%20about%20communication%20between%20user%20messaging%20agent%20(such%20as%20Microsoft%20Teams%2C%20Skype%20or%20Telegram)%20and%20our%20application%20logic%2C%20and%20includes%20code%20to%20handle%20request-response%20logic.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EIntelligent%20backend%3C%2FSTRONG%3E%20adds%20some%20AI%20functionality%20to%20your%20bot%2C%20such%20are%20recognizing%20user%E2%80%99s%20phrases%2C%20or%20finding%20best%20possible%20answer.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EA%20bot%20can%20exist%20without%20any%20intelligent%20backend%2C%20but%20it%20would%20not%20be%20smart.%20Still%2C%20bots%20like%20that%20are%20useful%20for%20automating%20simple%20tasks%2C%20such%20as%20form%20filling%2C%20or%20handling%20some%20pre-defined%20workflow.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbots-arch.png%22%20border%3D%220%22%20alt%3D%22Bots%20Architecture%22%20width%3D%22592%22%20height%3D%22359%22%20%2F%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20I%20present%20slightly%20simplified%20view%20of%20the%20whole%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fbotframework-sdk%23bot-framework-ecosystem%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EBot%20Ecosystem%3C%2FA%3E%2C%20but%20this%20way%20it%20is%20easier%20to%20get%20the%20picture.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1652566495%22%20id%3D%22toc-hId--1652540489%22%3EConversational%20Interface%3A%20Microsoft%20Bot%20Framework%20and%20Azure%20Bot%20Services%3C%2FH2%3E%0A%3CP%3EAt%20the%20heart%20of%20conversational%20interface%20is%20%3CA%20href%3D%22https%3A%2F%2Fdev.botframework.com%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EMicrosoft%20Bot%20Framework%3C%2FA%3E%20-%20an%20open-source%20development%20framework%20(with%20source%20code%20available%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fbotframework-sdk%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eon%20GitHub%3C%2FA%3E)%2C%20which%20contains%20useful%20abstractions%20for%20bot%20development.%20The%20main%20idea%20of%20Bot%20Framework%20is%20to%20abstract%20communication%20channel%2C%20and%20develop%20bots%20as%20web%20endpoints%20that%20asynchronously%20handle%20request-response%20communication.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%20color%3D%22%230000FF%22%3E%3CEM%3EDecoupling%20of%20bot%20logic%20and%20communication%20channel%20allows%20you%20to%20develop%20bot%20code%20once%2C%20and%20then%20connect%20it%20easily%20to%20different%20platforms%2C%20such%20as%20Skype%2C%20Teams%20or%20Telegram.%20Omnichannel%20bots%20are%20now%20made%20simple!%3C%2FEM%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3EBot%20Framework%20SDK%20supports%20primarily%20C%23%2C%20Node.js%2C%20Python%20and%20Java%2C%20although%20C%23%20or%20Node.js%20are%20highly%20recommended.%3C%2FP%3E%0A%3CP%3ETo%20host%20bots%20developed%20with%20Bot%20Framework%20on%20Azure%2C%20you%20use%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fbot-services%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Bot%20Services%3C%2FA%3E.%20It%20hosts%20bot%20logic%20itself%20(either%20as%20web%20application%2C%20or%20azure%20function)%2C%20as%20well%20as%20allows%20you%20to%20declaratively%20define%20physical%20channels%20that%20your%20bot%20will%20be%20connected%20to.%20You%20can%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fbot-service%2Fbot-service-manage-channels%3Fview%3Dazure-bot-service-4.0%26amp%3BWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Econnect%20your%20bot%20to%20Skype%20or%20Telegram%20through%20Azure%20Portal%3C%2FA%3E%20with%20a%20few%20simple%20steps.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-834946338%22%20id%3D%22toc-hId-834972344%22%3EIntelligent%20Backend%3A%20LUIS%20and%20QnA%20Maker%3C%2FH2%3E%0A%3CP%3EMany%20modern%20bots%20support%20some%20form%20of%20natural%20language%20interaction.%20To%20do%20it%2C%20the%20bot%20needs%20to%20understand%20the%20user%E2%80%99s%20phrase%2C%20which%20is%20typically%20done%20through%20%3CSTRONG%3Eintent%20classification%3C%2FSTRONG%3E.%20We%20define%20a%20number%20of%20possible%20%3CSTRONG%3Eintents%3C%2FSTRONG%3E%20or%20actions%20that%20the%20bot%20can%20support%2C%20and%20then%20map%20an%20input%20phrase%20to%20one%20of%20the%20intents.%3C%2FP%3E%0A%3CP%3EThis%20mapping%20is%20typically%20done%20using%20a%20neural%20network%20trained%20on%20some%20dataset%20of%20sample%20phrases.%20To%20take%20away%20the%20complexity%20of%20training%20your%20own%20neural%20network%20model%2C%20Microsoft%20provides%20%3CSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fluis%2Fwhat-is-luis%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ELanuguage%20Understanding%20Intelligent%20Service%3C%2FA%3E%3C%2FSTRONG%3E%2C%20or%20LUIS%2C%20which%20allows%20you%20to%20train%20a%20model%20either%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fluis%2Fluis-how-to-start-new-app%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ethrough%20web%20interface%3C%2FA%3E%2C%20or%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fluis%2Fluis-tutorial-node-import-utterances-csv%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ean%20API%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-utteranceintentmapping.png%22%20border%3D%220%22%20alt%3D%22Bot%20Utterance-Intent%20Mapping%22%20width%3D%22468%22%20height%3D%22188%22%20%2F%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20addition%20to%20intent%20classification%2C%20LUIS%20also%20performs%20%3CSTRONG%3Enamed%20entity%20recognition%3C%2FSTRONG%3E%20(or%20%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FNamed-entity_recognition%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3ENER%3C%2FA%3E).%20It%20can%20automatically%20extract%20some%20entities%20of%20well-known%20types%2C%20such%20as%20geolocations%20or%20references%20to%20date%20and%20time%2C%20and%20can%20learn%20to%20extract%20some%20user-defined%20entities%20as%20well.%3C%2FP%3E%0A%3CP%3EHaving%20entities%20extracted%20and%20intent%20correctly%20determined%20it%20should%20be%20much%20easier%20to%20program%20the%20logic%20of%20your%20bot.%20This%20is%20often%20done%20using%20%3CSTRONG%3Eslot%20filling%3C%2FSTRONG%3E%20technique%3A%20extracted%20entities%20from%20the%20user%E2%80%99s%20input%20populate%20some%20slots%20in%20a%20dictionary%2C%20and%20if%20some%20more%20values%20are%20required%20to%20perform%20the%20task%20-%20additional%20dialog%20is%20initiated%20to%20ask%20additional%20info%20from%20the%20user.%3C%2FP%3E%0A%3CP%3EAnother%20type%20of%20bot%20behavior%20that%20often%20comes%20up%20is%20the%20ability%20to%20find%20best%20matching%20phrase%20or%20piece%20of%20information%20in%20some%20table%2C%20i.e.%20do%20an%20%3CSTRONG%3Eintelligent%20lookup%3C%2FSTRONG%3E.%20It%20is%20useful%20if%20you%20want%20to%20provide%20FAQ-style%20bot%20that%20can%20answer%20user%E2%80%99s%20questions%20based%20on%20some%20database%20of%20answers%2C%20or%20if%20you%20just%20want%20to%20program%20chit-chat%20behavior%20with%20some%20common%20responses.%20To%20implement%20this%20functionality%2C%20you%20can%20use%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fqnamaker%2Foverview%2Foverview%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EQnA%20Maker%3C%2FA%3E%20-%20a%20complex%20service%2C%20that%20encapsulates%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fsearch%2Fsearch-what-is-azure-search%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Cognitive%20Search%3C%2FA%3E%2C%20and%20provides%20simple%20way%20to%20build%20question-answering%20functionality.%20You%20can%20index%20any%20existing%20FAQ%20document%2C%20or%20provide%20question-answer%20pairs%20through%20the%20web%20interface%2C%20and%20then%20hook%20up%20QnA%20maker%20to%20your%20bot%20with%20a%20few%20lines%20of%20code.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--972508125%22%20id%3D%22toc-hId--972482119%22%3EBot%20Development%3A%20Composer%2C%20Power%20Virtual%20Agents%20or%20Code%3F%3C%2FH2%3E%0A%3CP%3EAs%20I%20mentioned%20above%2C%20bots%20can%20be%20developed%20using%20your%20favorite%20programming%20language.%20However%2C%20this%20approach%20requires%20you%20to%20write%20some%20boilerplate%20code%2C%20understand%20asynchronous%20calls%2C%20and%20therefore%20has%20a%20significant%20learning%20curve.%20There%20are%20some%20simpler%20options%20that%20are%20good%20for%20a%20start!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%20color%3D%22%230000FF%22%3E%3CEM%3EIt%20is%20recommended%20to%20start%20developing%20your%20bot%20using%20low-code%20approach%20through%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcomposer%2Fintroduction%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EBot%20Framework%20Composer%3C%2FA%3E%20-%20an%20interactive%20visual%20tool%20that%20allows%20you%20to%20design%20your%20bot%20by%20drawing%20dialog%20diagrams.%3C%2FEM%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3EComposer%20integrates%20LUIS%20and%20QnA%20maker%20out%20of%20the%20box%2C%20so%20that%20you%20do%20not%20need%20to%20train%20those%20services%20through%20web%20interface%20first%2C%20and%20then%20worry%20about%20integrating%20them%20to%20your%20bot.%20From%20the%20same%20UI%2C%20you%20are%20able%20to%20specify%20events%20triggered%20by%20some%20user%20phrases%2C%20and%20dialogs%20that%20respond%20to%20them.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-composer-overview-image.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-composer-overview-image.png%22%20border%3D%220%22%20alt%3D%22Bot%20Framework%20Composer%20Main%20UI%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAnother%20similar%20low-code%20option%20would%20be%20to%20use%20%3CA%20href%3D%22https%3A%2F%2Fpowervirtualagents.microsoft.com%2Fblog%2Fhow-to-use-conversational-ai-to-enhance-engagement%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPower%20Virtual%20Agents%3C%2FA%3E%20(PVA)%2C%20a%20tool%20from%20%3CA%20href%3D%22https%3A%2F%2Fpowerplatform.microsoft.com%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPower%20Platform%3C%2FA%3E%20family%20of%20tools%20for%20business%20automation.%20It%20would%20be%20especially%20useful%20if%20you%20are%20already%20familiar%20with%20Power%20Platform%2C%20and%20using%20any%20of%20its%20tools%20to%20enhance%20productivity.%20In%20this%20case%2C%20PWA%20will%20be%20a%20natural%20choice%2C%20and%20it%20will%20integrate%20nicely%20into%20all%20your%20data%20points%20and%20business%20processes.%20In%20short%20-%20Composer%20is%20a%20great%20low-code%20tool%20for%20developers%2C%20while%20PVA%20is%20more%20for%20business%20users.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22getting-started-with-bot-development%22%20id%3D%22toc-hId--983011229%22%20id%3D%22toc-hId--982985223%22%3EGetting%20Started%20with%20Bot%20Development%3C%2FH1%3E%0A%3CP%3ELet%20me%20show%20you%20how%20we%20can%20start%20the%20development%20of%20a%20simple%20educational%20bot%20that%20will%20help%20K-12%20students%20with%20their%20geography%20classes.%26nbsp%3B%3CSPAN%3EWe%20will%20develop%20a%20simple%20bot%2C%20which%20you%20can%20later%20host%20on%20Microsoft%20Azure%20and%20connect%20to%20most%20popular%20communication%20channels%2C%20such%20as%20Teams%2C%20Slack%20or%20Telegram.%20If%20you%20do%20not%20have%20an%20Azure%20account%2C%20you%20can%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Ffree%2F%3FOCID%3DAID3029145%26amp%3BWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eget%20a%20free%20trial%3C%2FA%3E%3CSPAN%3E%26nbsp%3B(or%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Ffree%2Fstudents%2F%3FWT.mc_id%3Dca-13976-dmitryso%26amp%3BOCID%3DAID3029145%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3CSPAN%3E%2C%20if%20you%20are%20a%20student).%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ETo%20begin%20with%2C%20we%20will%20implement%20three%20simple%20functions%20in%20our%20bot%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EBeing%20able%20to%20tell%20a%20capital%20city%20for%20a%20country%20(%3CEM%3EWhat%20is%20the%20capital%20of%20Russia%3F%3C%2FEM%3E).%3C%2FLI%3E%0A%3CLI%3EGiving%20definitions%20of%20most%20useful%20terms%2C%20eg.%20answering%20a%20questions%20like%20%3CEM%3EWhat%20is%20a%20capital%3F%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%3ESupport%20for%20simple%20chit-chat%20(%3CEM%3EHow%20are%20you%20today%3F%3C%2FEM%3E)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThose%20two%20functions%20cover%20two%20most%20important%20elements%20of%20our%20intelligent%20backend%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fqnamaker%2Foverview%2Foverview%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EQnA%20Maker%3C%2FA%3E%20(which%20can%20be%20used%20to%20implement%20the%20last%20two%20points)%20and%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fluis%2Fwhat-is-luis%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ELUIS%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--292449755%22%20id%3D%22toc-hId--292423749%22%3EStarting%20with%20Bot%20Composer%3C%2FH2%3E%0A%3CP%3ETo%20begin%20development%2C%20you%20need%20to%20%5Binstall%20Bot%20Framework%20Composer%5D%5BInstallComposer%5D%20-%20I%20recommend%20to%20do%20it%20as%20desktop%20application.%20Then%2C%20after%20starting%20it%2C%20click%20on%20%3CSTRONG%3ENew%3C%2FSTRONG%3E%20button%2C%20and%20chose%20starting%20template%20for%20your%20bot%3A%20%3CSTRONG%3EQnA%20Maker%20and%20LUIS%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-composer-create1.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-composer-create1.png%22%20border%3D%220%22%20alt%3D%22Composer%20Create%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EOnce%20you%20do%20that%2C%20you%20will%20see%20the%20main%20screen%20of%20composer%2C%20with%20a%20list%20of%20triggers%20on%20the%20left%2C%20and%20the%20main%20pane%20to%20design%20dialogs%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-composer-mainscreen.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-composer-mainscreen.png%22%20border%3D%220%22%20alt%3D%22Composer%20Main%20Screen%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%2C%20you%20can%20delete%20an%20unused%20trigger%20%3CSTRONG%3EBuySurface%3C%2FSTRONG%3E%20(which%20is%20left%20over%20from%20the%20demo)%2C%20and%20go%20to%20%3CSTRONG%3EWelcome%20message%3C%2FSTRONG%3E%20to%20customize%20the%20phrase%20that%20the%20bot%20says%20to%20new%20user.%20The%20logic%20of%20Welcome%20Message%20trigger%20is%20a%20bit%20complex%2C%20you%20need%20to%20look%20for%20a%20box%20called%20%3CSTRONG%3ESend%20a%20response%3C%2FSTRONG%3E%2C%20and%20change%20the%20message%20in%20the%20right%20pane.%3C%2FP%3E%0A%3CP%3EThe%20language%20used%20to%20define%20phrases%20is%20called%20%3CSTRONG%3ELanguage%20generation%3C%2FSTRONG%3E%2C%20or%20%3CSTRONG%3Elg%3C%2FSTRONG%3E.%20A%20few%20useful%20syntax%20rules%20to%20know%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EA%20phrase%20starts%20with%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3E-%3C%2FCODE%3E.%20If%20want%20to%20chose%20from%20a%20number%20of%20replies%2C%20specify%20several%20phrases%2C%20and%20one%20of%20them%20will%20be%20selected%20randomly.%20For%20example%3A%20%60%60%60bash%3C%2FLI%3E%0A%3CLI%3EHello%2C%20I%20am%20geography%20helper%20bot!%3C%2FLI%3E%0A%3CLI%3EHey%2C%20welcome!%3C%2FLI%3E%0A%3CLI%3EHi%2C%20looking%20forward%20to%20chat%20with%20you!%20%60%60%60%3C%2FLI%3E%0A%3CLI%3EComments%20start%20with%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3E%26gt%3B%3C%2FCODE%3E%3C%2FLI%3E%0A%3CLI%3ESome%20additional%20definitions%20start%20with%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3E%40%3C%2FCODE%3E%3C%2FLI%3E%0A%3CLI%3EYou%20can%20use%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3E%24%7B...%7D%3C%2FCODE%3Esyntax%20for%20variable%20substitution%20(we%20will%20see%20an%20example%20of%20this%20later)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId--2099904218%22%20id%3D%22toc-hId--2099878212%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-387608615%22%20id%3D%22toc-hId-387634621%22%3EConnecting%20to%20Azure%20Services%3C%2FH2%3E%0A%3CP%3ETo%20use%20intelligent%20backend%2C%20you%20need%20to%20create%20Azure%20resources%20for%20LUIS%20and%20QnA%20Maker%20and%20provide%20corresponding%20keys%20to%20Composer%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fluis%2Fluis-how-to-azure-subscription%23create-luis-resources-in-the-azure-portal%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20LUIS%20Authoring%20Resource%3C%2FA%3E%2C%20and%20make%20sure%20to%20remember%20the%20region%20in%20which%20it%20was%20created%2C%20and%20copy%20key%20from%20%3CSTRONG%3EKeys%20and%20Endpoint%3C%2FSTRONG%3E%20page%20in%20Azure%20Portal.%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fqnamaker%2Fhow-to%2Fset-up-qnamaker-service-azure%3Ftabs%3Dv1%26amp%3BWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20QnA%20Maker%20Service%3C%2FA%3E%2C%20and%20copy%20corresponding%20key%3C%2FLI%3E%0A%3CLI%3EIn%20Composer%2C%20go%20to%20bot%20settings%20by%20pressing%20%3CSTRONG%3EProject%20Settings%3C%2FSTRONG%3E%20button%20in%20the%20left%20menu%20(look%20for%20a%20wrench%20icon%2C%20or%20expand%20the%20menu%20if%20unsure).%20Under%20settings%2C%20fill%20in%20%3CSTRONG%3ELUIS%20Authoring%20Key%3C%2FSTRONG%3E%2C%20%3CSTRONG%3ELUIS%20region%3C%2FSTRONG%3E%20and%20%3CSTRONG%3EQnA%20Maker%20Subscription%20key%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-253923891%22%20id%3D%22toc-hId-253949897%22%3EStarting%20the%20Bot%3C%2FH2%3E%0A%3CP%3EAt%20this%20point%2C%20you%20can%20already%20start%20chatting%20with%20your%20bot.%20Click%20%3CSTRONG%3EStart%20bot%3C%2FSTRONG%3E%20in%20the%20upper%20right%20corner%2C%20and%20let%20some%20time%20for%20the%20magic%20to%20happen.%20When%20starting%20a%20bot%2C%20Composer%20actually%20creates%20and%20trains%20underlying%20LUIS%20model%2C%20builds%20bot%20framework%20project%2C%20and%20starts%20local%20web%20server%20with%20a%20copy%20of%20the%20bot%2C%20ready%20to%20serve%20your%20requests.%3C%2FP%3E%0A%3CP%3ETo%20chat%20with%20a%20bot%2C%20click%20%3CSTRONG%3ETest%20in%20emulator%3C%2FSTRONG%3E%20button%20(you%20need%20to%20have%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FMicrosoft%2FBotFramework-Emulator%2Fblob%2Fmaster%2FREADME.md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EBot%20Framework%20Emulator%3C%2FA%3E)%20installed%20for%20this%20to%20work).%20This%20automatically%20opens%20up%20the%20chat%20window%20with%20all%20required%20settings%2C%20and%20you%20can%20start%20talking%20to%20your%20bot%20right%20away.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1553530572%22%20id%3D%22toc-hId--1553504566%22%3ECreating%20QnA%20Maker%20Knowledge%20base%3C%2FH2%3E%0A%3CP%3ELet%E2%80%99s%20start%20with%20creating%20term%20dictionary%20using%20QnA%20Maker.%20Click%20on%20%3CSTRONG%3EQnA%3C%2FSTRONG%3E%20left%20menu%2C%20and%20then%20%3CSTRONG%3ECreate%20new%20KB%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-qna-create.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-qna-create.png%22%20border%3D%220%22%20alt%3D%22QnA%20New%20KB%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EHere%20you%20can%20either%20start%20from%20some%20existing%20data%20(provided%20as%20an%20URL%20to%20html%2C%20pdf%2C%20Word%20or%20Excel%20document)%2C%20or%20start%20creating%20phrases%20from%20scratch.%3C%2FP%3E%0A%3CP%3EIn%20most%20of%20the%20cases%2C%20you%20would%20have%20a%20document%20to%20start%20with%2C%20but%20in%20our%20case%20we%20will%20start%20from%20scratch.%20After%20creating%20a%20knowledge%20base%2C%20you%20can%20click%20%3CSTRONG%3EAdd%20QnA%20Pair%3C%2FSTRONG%3E%20to%20add%20all%20question-answer%20combinations%20you%20need.%20Note%20that%20you%20can%20add%20several%20options%20of%20the%20question%20by%20using%20%3CSTRONG%3EAll%20alternative%20phrasing%3C%2FSTRONG%3E%20link.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-qna-phrases.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-qna-phrases.png%22%20border%3D%220%22%20alt%3D%22QnA%20Phrases%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20our%20case%2C%20I%20have%20added%20a%20%3CEM%3Ehow%20are%20you%3C%2FEM%3E%20phrase%20(with%20several%20options)%2C%20and%20a%20phrase%20to%20explain%20the%20meaning%20of%20the%20word%20%3CEM%3Ecapital%3C%2FEM%3E.%3C%2FP%3E%0A%3CP%3EHaving%20added%20the%20phrases%2C%20we%20can%20start%20a%20bot%20and%20make%20sure%20that%20it%20correctly%20reacts%20to%20given%20phrases%2C%20or%20similar%20versions%20of%20those%20phrases%20-%20QnA%20maker%20does%20not%20require%20it%20to%20be%20an%20exact%20match%2C%20it%20looks%20for%20%3CEM%3Esimilar%3C%2FEM%3E%20phrases%20to%20make%20a%20decision%20on%20which%20answer%20to%20provide.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-933982261%22%20id%3D%22toc-hId-934008267%22%3EAdding%20Specific%20Actions%20with%20LUIS%3C%2FH2%3E%0A%3CP%3ETo%20give%20our%20bot%20an%20ability%20to%20give%20capitals%20of%20countries%2C%20we%20need%20to%20add%20some%20specific%20functionality%20to%20look%20for%20a%20capital%2C%20triggered%20by%20a%20certain%20phrase.%20We%20definitely%20do%20not%20want%20to%20type%20all%20200%2B%20countries%20and%20their%20capitals%20into%20QnA%20Maker!%3C%2FP%3E%0A%3CP%3EA%20functionality%20to%20get%20information%20about%20a%20country%20is%20openly%20available%20via%20%3CA%20href%3D%22https%3A%2F%2Frestcountries.eu%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EREST%20Countries%3C%2FA%3E%20API.%20For%20example%2C%20if%20we%20make%20GET%20request%20to%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3E%3CA%20href%3D%22https%3A%2F%2Frestcountries.eu%2Frest%2Fv2%2Fname%2FRussia%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Frestcountries.eu%2Frest%2Fv2%2Fname%2FRussia%3C%2FA%3E%3C%2FCODE%3E%2C%20we%20will%20get%20JSON%20response%20like%20this%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22language-json%20highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3E%3CSPAN%20class%3D%22p%22%3E%5B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%3CSPAN%20class%3D%22nl%22%3E%22name%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%3CSPAN%20class%3D%22s2%22%3E%22Russian%20Federation%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%2C%3C%2FSPAN%3E%0A%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22topLevelDomain%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22s2%22%3E%22.ru%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%5D%2C%3C%2FSPAN%3E%0A%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22capital%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%3CSPAN%20class%3D%22s2%22%3E%22Moscow%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3E...%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%7D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%5D%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3ETo%20ask%20for%20a%20capital%20of%20a%20given%20country%2C%20a%20user%20will%20say%20something%20like%20%3CEM%3EWhat%20is%20a%20capital%20of%20Russia%3F%3C%2FEM%3E%2C%20or%20%3CEM%3EI%20want%20to%20know%20the%20capital%20of%20Italy%3C%2FEM%3E.%20This%20phrase%20intent%20can%20be%20recognized%20using%20LUIS%2C%20and%20the%20name%20of%20the%20country%20is%20also%20extracted.%3C%2FP%3E%0A%3CP%3ETo%20add%20LUIS%20trigger%2C%20from%20the%20%3CSTRONG%3EDesign%3C%2FSTRONG%3E%20page%20of%20the%20composer%2C%20select%20your%20bot%20dialog%20and%20press%20%E2%80%9C%E2%80%A6%E2%80%9D%20next%20to%20it.%20You%20will%20see%20%3CSTRONG%3EAdd%20a%20trigger%3C%2FSTRONG%3E%20option%20in%20the%20drop-down%20box.%20Select%20it%2C%20and%20then%20chose%20%3CSTRONG%3EIntent%20recognized%3C%2FSTRONG%3E%20as%20trigger%20type.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CEM%3E%3CSTRONG%3EIntent%20Recognized%3C%2FSTRONG%3E%20is%20the%20most%20common%20trigger%20type.%20However%2C%20you%20can%20specify%20%3CSTRONG%3EDialog%20events%3C%2FSTRONG%3E%2C%20that%20allow%20you%20to%20structure%20part%20of%20the%20conversation%20as%20a%20separate%20dialog%2C%20or%20some%20conversational%20activities%2C%20such%20as%20%3CSTRONG%3EHandoff%20to%20human%3C%2FSTRONG%3E.%3C%2FEM%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3EThen%2C%20specify%20trigger%20phrases%2C%20using%20a%20variation%20of%20LG%20language.%20In%20our%20case%2C%20we%20will%20use%20the%20following%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22language-json%20highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3E%3CSPAN%20class%3D%22err%22%3E-%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Ewhat%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Eis%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Ea%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Ecapital%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Eof%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%3CSPAN%20class%3D%22err%22%3Ecountry%3DRussia%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%7D%3C%2FSPAN%3E%3CSPAN%20class%3D%22err%22%3E%3F%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22err%22%3E-%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3EI%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Ewant%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Eto%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Eknow%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Ea%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Ecapital%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Eof%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%3CSPAN%20class%3D%22err%22%3Ecountry%3DItaly%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%7D%3C%2FSPAN%3E%3CSPAN%20class%3D%22err%22%3E.%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22err%22%3E-%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3EGive%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Eme%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Ea%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Ecapital%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22err%22%3Eof%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%3CSPAN%20class%3D%22err%22%3Ecountry%3DGreece%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%7D%3C%2FSPAN%3E%3CSPAN%20class%3D%22err%22%3E!%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EHere%2C%20we%20specify%20a%20number%20of%20trigger%20phrases%20starting%20with%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3E-%3C%2FCODE%3E%2C%20and%20we%20indicate%20that%20we%20want%20to%20extract%20part%20of%20the%20phrase%20as%20an%20entity%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3Ecountry%3C%2FCODE%3E.%20LUIS%20will%20automatically%20train%20a%20model%20to%20extract%20entities%20based%20on%20the%20provided%20utterances%2C%20so%20make%20sure%20to%20provide%20a%20number%20of%20possible%20phrases.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%20color%3D%22%230000FF%22%3E%3CEM%3EThere%20are%20some%20pre-defined%20entity%20types%2C%20such%20as%20%3C%2FEM%3E%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3EdatetimeV2%3C%2FCODE%3E%2C%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3Enumber%3C%2FCODE%3E%3CEM%3E%2C%20etc.%20Using%20pre-defined%20types%20is%20recommended%2C%20and%20entity%20type%20can%20be%20specified%20using%20%3C%2FEM%3E%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3E%40%20%3CENTITY_TYPE%3E%20%3CENTITY_NAME%3E%3C%2FENTITY_NAME%3E%3C%2FENTITY_TYPE%3E%3C%2FCODE%3E%3CEM%3E%20notation.%20In%20our%20case%2C%20we%20can%20use%20%3C%2FEM%3E%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3EgeographyV2%3C%2FCODE%3E%3CEM%3E%20entity%20type%2C%20which%20extracts%20geographic%20locations%2C%20including%20countries.%3C%2FEM%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3EOnce%20we%20have%20defined%20phrase%20recognizer%2C%20we%20need%20to%20add%20a%20block%20that%20will%20do%20the%20actual%20REST%20call%20and%20fetch%20information%20on%20the%20given%20country.%20Use%20use%20%3CSTRONG%3ESend%20HTTP%20Request%3C%2FSTRONG%3E%20block%2C%20and%20specify%20the%20following%20parameters%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EMethod%20%3D%20GET%3C%2FLI%3E%0A%3CLI%3EUrl%20%3D%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3E%3CA%20href%3D%22https%3A%2F%2Frestcountries.eu%2Frest%2Fv2%2Fname%2F%24%7B%40country%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Frestcountries.eu%2Frest%2Fv2%2Fname%2F%24%7B%40country%3C%2FA%3E%7D%3C%2FCODE%3E.%20Here%2C%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3E%24%7B%40country%7D%3C%2FCODE%3Ewill%20be%20substituted%20with%20the%20name%20of%20the%20recognized%20country.%3C%2FLI%3E%0A%3CLI%3EResult%20property%20%3D%20dialog.result%3C%2FLI%3E%0A%3CLI%3EResponse%20type%20%3D%20json%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThis%20would%20make%20the%20REST%20call%20to%20the%20API%2C%20and%20the%20result%20will%20be%20stored%20into%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3Edialog.result%3C%2FCODE%3Eproperty.%20If%20we%20provided%20a%20valid%20country%2C%20json%20result%20will%20be%20automatically%20parsed%2C%20otherwise%2C%20invalid%20operation%20code%20will%20be%20recorded%20in%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3Edialog.result.statusCode%3C%2FCODE%3E-%20in%20our%20case%2C%20404.%3C%2FP%3E%0A%3CP%3ETo%20test%20if%20the%20call%20was%20successful%20and%20define%20different%20logic%20based%20on%20the%20result%2C%20we%20insert%20%3CSTRONG%3EBranch%3A%20If%2FElse%3C%2FSTRONG%3E%20block%2C%20and%20specify%20the%20following%20condition%3A%3CCODE%20class%3D%22language-plaintext%20highlighter-rouge%22%3E%3D%20equals(dialog.result.statusCode%2C200)%3C%2FCODE%3E.%20True%20condition%20will%20correspond%20to%20the%20left%20branch%2C%20and%20we%20will%20insert%20%3CSTRONG%3ESend%20a%20response%3C%2FSTRONG%3E%20block%20there%2C%20with%20the%20following%20text%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22language-plaintext%20highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3E-%20A%20capital%20of%20%24%7B%40country%7D%20is%20%24%7Bdialog.result.content%5B0%5D.capital%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EIn%20case%20result%20code%20is%20not%20200%2C%20the%20right%20branch%20will%20be%20executed%2C%20where%20we%20will%20insert%20an%20error%20message.%20Our%20final%20dialog%20should%20look%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-cooldialog.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-cooldialog.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--873472202%22%20id%3D%22toc-hId--873446196%22%3EAdding%20Preconfigured%20Chit-Chat%20Functionality%3C%2FH2%3E%0A%3CP%3EIt%20would%20be%20nice%20if%20your%20bot%20could%20respond%20to%20more%20everyday%20phrases%2C%20such%20as%20%3CEM%3EHow%20old%20are%20you%3F%3C%2FEM%3E%2C%20or%20%3CEM%3EDo%20you%20enjoy%20being%20a%20bot%3C%2FEM%3E.%20We%20can%20define%20all%20those%20phrases%20in%20QnA%20Maker%2C%20but%20that%20would%20take%20us%20quite%20some%20time%20to%20do%20so.%20Luckily%2C%20there%20is%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2FBotBuilder-PersonalityChat%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EProject%20Personality%20Chat%3C%2FA%3E%20that%20contains%20a%20number%20of%20pre-defined%20QnA%20Maker%20knowledge%20bases%20for%20several%20languages%2C%20and%20for%20a%20number%20of%20personalities%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EProfessional%3C%2FLI%3E%0A%3CLI%3EFriendly%3C%2FLI%3E%0A%3CLI%3EWitty%3C%2FLI%3E%0A%3CLI%3ECaring%3C%2FLI%3E%0A%3CLI%3EEnthusiastic%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EYou%20can%20grab%20a%20link%20to%20the%20knowledge%20base%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FMicrosoft%2FBotBuilder-PersonalityChat%2Ftree%2Fmaster%2FCSharp%2FDatasets%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Efrom%20here%3C%2FA%3E%2C%20then%20go%20to%20%3CA%20href%3D%22http%3A%2F%2Fqnamaker.ai%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EQnA%20Maker%20Portal%3C%2FA%3E%2C%20find%20your%20knowledge%20base%2C%20and%20add%20this%20URL%20link%20to%20your%20service%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-qna-chitchat.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-qna-chitchat.png%22%20border%3D%220%22%20alt%3D%22Adding%20URL%20to%20QnAMaker%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EHaving%20done%20that%2C%20click%20%3CSTRONG%3ESave%20and%20Train%3C%2FSTRONG%3E%2C%20and%20enjoy%20a%20talk%20to%20your%20bot!%20You%20can%20even%20try%20ask%20it%20about%20%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPhrases_from_The_Hitchhiker%2527s_Guide_to_the_Galaxy%23The_Answer_to_the_Ultimate_Question_of_Life%2C_the_Universe%2C_and_Everything_is_42%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Elife%2C%20universe%20and%20everything%3C%2FA%3E!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1614040631%22%20id%3D%22toc-hId-1614066637%22%3ETesting%20the%20Bot%20and%20Publishing%20to%20Azure%3C%2FH2%3E%0A%3CP%3ENow%20that%20our%20basic%20bot%20functionality%20is%20complete%2C%20we%20can%20test%20the%20bot%20in%20bot%20emulator%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-emulator-sample.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-emulator-sample.png%22%20border%3D%220%22%20alt%3D%22Chat%20in%20bot%20emulator%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20the%20bot%20is%20running%20locally%2C%20we%20can%20deploy%20it%20to%20Azure%20right%20from%20the%20Composer.%20If%20you%20go%20to%20%3CSTRONG%3EPublish%3C%2FSTRONG%3E%20from%20the%20left%20menu%2C%20you%20will%20be%20able%20to%20define%20%3CSTRONG%3EPublishing%20profile%3C%2FSTRONG%3E%20for%20your%20bot.%20Select%20%3CSTRONG%3EDefine%20new%20publishing%20profile%3C%2FSTRONG%3E%2C%20and%20chose%20one%20of%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-publishprofile.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-publishprofile.png%22%20border%3D%220%22%20alt%3D%22Publishing%20profiles%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThe%20most%20standard%20way%20to%20deploy%20is%20to%20use%20%3CSTRONG%3EAzure%20Web%20App%3C%2FSTRONG%3E.%20Composer%20will%20only%20require%20you%20to%20provide%20Azure%20subscription%20and%20resource%20group%20name%2C%20and%20it%20will%20take%20care%20of%20creating%20all%20the%20required%20resources%20(including%20bot-specific%20LUIS%2FQnA%20Maker%20instances)%20automatically.%20It%20may%20take%20awhile%2C%20but%20it%20will%20save%20you%20a%20lot%20of%20time%20and%20hassle%20of%20doing%20manual%20deployment.%3C%2FP%3E%0A%3CP%3EOnce%20the%20bot%20is%20published%20to%20Azure%2C%20you%20can%20go%20to%20Azure%20portal%20and%20configure%20%3CSTRONG%3EChannels%3C%2FSTRONG%3E%20through%20which%20you%20bot%20would%20be%20available%20to%20external%20world%2C%20such%20as%20Telegram%2C%20Microsoft%20Teams%2C%20Slack%20or%20Skype.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-azure-channels.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CIMG%20src%3D%22http%3A%2F%2Fsoshnikov.com%2Fimages%2Fblog%2Fbot-azure-channels.png%22%20border%3D%220%22%20alt%3D%22Add%20Bot%20Channels%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--322496551%22%20id%3D%22toc-hId--322470545%22%3E%26nbsp%3B%3C%2FH1%3E%0A%3CH1%20id%3D%22conclusion%22%20id%3D%22toc-hId--2129951014%22%20id%3D%22toc-hId--2129925008%22%3EConclusion%3C%2FH1%3E%0A%3CP%3ECreating%20a%20bot%20using%20Bot%20Composer%20seems%20like%20an%20easy%20thing%20to%20do.%20In%20fact%2C%20you%20can%20create%20quite%20powerful%20bots%20almost%20without%20any%20code!%20And%20you%20can%20also%20hook%20them%20to%20your%20enterprise%20endpoint%20using%20such%20features%20as%20HTTP%20REST%20APIs%20and%20OAuth%20authorization.%3C%2FP%3E%0A%3CP%3EHowever%2C%20there%20are%20cases%20when%20you%20need%20to%20significantly%20extend%20bot%20functionality%20using%20code.%20In%20this%20case%2C%20you%20have%20several%20options%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EKeep%20main%20bot%20authoring%20in%20Bot%20Composer%2C%20and%20develop%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcomposer%2Fhow-to-add-custom-action%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECustom%20Actions%3C%2FA%3E%20in%20C%23%3C%2FLI%3E%0A%3CLI%3EExport%20complete%20bot%20code%20using%20%3CSTRONG%3ECustom%20Runtime%3C%2FSTRONG%3E%20feature%20of%20Composer%2C%20which%20exports%20complete%20bot%20code%20in%20C%23%20or%20Javascript%2C%20which%20you%20can%20then%20fully%20customize.%20This%20approach%20is%20not%20ideal%2C%20because%20you%20will%20lose%20the%20ability%20to%20maintain%20the%20source%20of%20your%20bot%20in%20Composer.%3C%2FLI%3E%0A%3CLI%3EWrite%20a%20bot%20from%20the%20beginning%20in%20one%20of%20the%20supported%20languages%20(C%23%2C%20JS%2C%20Python%20or%20Java)%20using%20%3CA%20href%3D%22https%3A%2F%2Fdev.botframework.com%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EBot%20Framework%3C%2FA%3E.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CEM%3E%3CFONT%20size%3D%224%22%3EIf%20you%20want%20to%20explore%20how%20the%20same%20Educational%20bot%20for%20Geography%20can%20be%20written%20in%20C%23%2C%20check%20out%20this%20Microsoft%20Learn%20Module%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Flearn%2Fmodules%2Fresponsible-bots%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20a%20chat%20bot%20to%20help%20students%20learn%20with%20Azure%20Bot%20Service%3C%2FA%3E.%3C%2FFONT%3E%3C%2FEM%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3EI%20am%20sure%20conversational%20approach%20to%20UI%20can%20prove%20useful%20in%20many%20cases%2C%20and%20Microsoft%20Conversational%20Platform%20offers%20you%20wide%20variety%20of%20tools%20to%20support%20all%20your%20scenarios.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2139570%22%20slang%3D%22en-US%22%3E%3CDIV%3EDuring%20the%20pandemic%2C%20we%20all%20found%20ourselves%20in%20isolation%2C%20and%20relying%20more%20and%20more%20on%20effective%20electronic%20means%20of%20communication.%20The%20amount%20of%20digital%20conversations%20increased%20dramatically%2C%20and%20we%20need%20to%20rely%20on%20bots%20to%20help%20us%20handle%20some%20of%20those%20conversations.%20In%20this%20blog%20post%2C%20I%20give%20brief%20overview%20of%20conversational%20AI%20on%20Microsoft%20platform%20and%20show%20you%20how%20to%20build%20a%20simple%20educational%20bot%20to%20help%20students%20learn.%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EIf%20you%20prefer%20video%20content%2C%20here%20is%20a%20great%20video%20to%20get%20you%20started%2C%20from%20our%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Foverview%2Fai-platform%2Fdev-resources%2F%3FWT.mc_id%3Dca-13976-dmitryso%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3EAI%20Developer%20Resources%3C%2FA%3E%20page%3A%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%3CDIV%20class%3D%22video-embed-center%20video-embed%22%3E%3CIFRAME%20class%3D%22embedly-embed%22%20src%3D%22https%3A%2F%2Fcdn.embedly.com%2Fwidgets%2Fmedia.html%3Fsrc%3Dhttps%253A%252F%252Fwww.youtube.com%252Fembed%252FNh3S_sljkpI%253Ffeature%253Doembed%26amp%3Bdisplay_name%3DYouTube%26amp%3Burl%3Dhttps%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253DNh3S_sljkpI%26amp%3Bimage%3Dhttps%253A%252F%252Fi.ytimg.com%252Fvi%252FNh3S_sljkpI%252Fhqdefault.jpg%26amp%3Bkey%3Db0d40caa4f094c68be7c29880b16f56e%26amp%3Btype%3Dtext%252Fhtml%26amp%3Bschema%3Dyoutube%22%20width%3D%22400%22%20height%3D%22225%22%20scrolling%3D%22no%22%20title%3D%22YouTube%20embed%22%20frameborder%3D%220%22%20allow%3D%22autoplay%3B%20fullscreen%22%20allowfullscreen%3D%22true%22%3E%3C%2FIFRAME%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2139570%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EConversational%20AI%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft
During the pandemic, we all found ourselves in isolation, and relying more and more on effective electronic means of communication. The amount of digital conversations increased dramatically, and we need to rely on bots to help us handle some of those conversations. In this blog post, I give brief overview of conversational AI on Microsoft platform and show you how to build a simple educational bot to help students learn.
If you prefer video content, here is a great video to get you started, from our AI Developer Resources page:

 

Do We Need Bots, and When?

Many people believe that in the future we will be interacting with computers using speech, in the same way we interact between each other. While the future is still vague, we can already benefit from conversational interfaces in many areas, for example:

  • In user support, which has traditionally been based on interpersonal communication, automated chat-bots can solve a lot of routine problems for the users, leaving human specialists for solving only unusual cases.
  • During surgical operation, when hands-free interaction is essential. From personal experience, I find it personally more convenient to set morning alarm and “good night” music through voice assistant before going to sleep.
  • Automating some functions in interpersonal communication. My favorite example is a chat-bot that you can add to a group chat when organizing a party, and it will track how much money each of the participants spent on the preparation.

At the current state of development of conversational AI technologies, a chat bot will not replace a human, and it will not pass Turing test.

 

In practice, chat bots act as an advanced version of a command line, in which you do not need to know exact commands to perform an action.

Thus, successful bot applications will not try to pretend to be a human, because such behavior is likely to cause some user dissatisfaction in the future. It is one of the responsible conversational AI principles, which you need to consider when designing a bot.

 

Educational Bots

During the pandemic, one of the areas that is being transformed the most is education. We can envision educational bots that help student answer most common questions, or act as a virtual teaching assistant. In this blog post, I will show you how to create a simple assistant bot that will be able to handle several questions from the field of Geography.

Before we jump to this task, let’s talk about Microsoft conversational AI stack in general, and consider different development options.

 

Conversational AI Development Stack

When it comes to conversational AI, we can logically think of a conversational agent having two main parts:

  • Conversational interface handles passing messages from the user to the bot and back. It takes care about communication between user messaging agent (such as Microsoft Teams, Skype or Telegram) and our application logic, and includes code to handle request-response logic.
  • Intelligent backend adds some AI functionality to your bot, such are recognizing user’s phrases, or finding best possible answer.

A bot can exist without any intelligent backend, but it would not be smart. Still, bots like that are useful for automating simple tasks, such as form filling, or handling some pre-defined workflow.

 

Bots Architecture

 

Here I present slightly simplified view of the whole Bot Ecosystem, but this way it is easier to get the picture.

 

Conversational Interface: Microsoft Bot Framework and Azure Bot Service

At the heart of conversational interface is Microsoft Bot Framework - an open-source development framework (with source code available on GitHub), which contains useful abstractions for bot development. The main idea of Bot Framework is to abstract communication channel, and develop bots as web endpoints that asynchronously handle request-response communication.

 

Decoupling of bot logic and communication channel allows you to develop bot code once, and then connect it easily to different platforms, such as Skype, Teams or Telegram. Omnichannel bots are now made simple!

Bot Framework SDK supports primarily C#, Node.js, Python and Java, although C# or Node.js are highly recommended.

To host bots developed with Bot Framework on Azure, you use Azure Bot Service. It hosts bot logic itself (either as web application, or azure function), as well as allows you to declaratively define physical channels that your bot will be connected to. You can connect your bot to Skype or Telegram through Azure Portal with a few simple steps.

 

Intelligent Backend: LUIS and QnA Maker

Many modern bots support some form of natural language interaction. To do it, the bot needs to understand the user’s phrase, which is typically done through intent classification. We define a number of possible intents or actions that the bot can support, and then map an input phrase to one of the intents.

This mapping is typically done using a neural network trained on some dataset of sample phrases. To take away the complexity of training your own neural network model, Microsoft provides Language Understanding Intelligent Service, or LUIS, which allows you to train a model either through web interface, or an API.

 

Bot Utterance-Intent Mapping

 

In addition to intent classification, LUIS also performs named entity recognition (or NER). It can automatically extract some entities of well-known types, such as geolocations or references to date and time, and can learn to extract some user-defined entities as well.

Having entities extracted and intent correctly determined it should be much easier to program the logic of your bot. This is often done using slot filling technique: extracted entities from the user’s input populate some slots in a dictionary, and if some more values are required to perform the task - additional dialog is initiated to ask additional info from the user.

Another type of bot behavior that often comes up is the ability to find best matching phrase or piece of information in some table, i.e. do an intelligent lookup. It is useful if you want to provide FAQ-style bot that can answer user’s questions based on some database of answers, or if you just want to program chit-chat behavior with some common responses. To implement this functionality, you can use QnA Maker - a complex service, that encapsulates Azure Cognitive Search, and provides simple way to build question-answering functionality. You can index any existing FAQ document, or provide question-answer pairs through the web interface, and then hook up QnA maker to your bot with a few lines of code.

 

Bot Development: Composer, Power Virtual Agents or Code?

As I mentioned above, bots can be developed using your favorite programming language. However, this approach requires you to write some boilerplate code, understand asynchronous calls, and therefore has a significant learning curve. There are some simpler options that are good for a start!

 

It is recommended to start developing your bot using low-code approach through Bot Framework Composer - an interactive visual tool that allows you to design your bot by drawing dialog diagrams.

Composer integrates LUIS and QnA maker out of the box, so that you do not need to train those services through web interface first, and then worry about integrating them to your bot. From the same UI, you are able to specify events triggered by some user phrases, and dialogs that respond to them.

Bot Framework Composer Main UI

Another similar low-code option would be to use Power Virtual Agents (PVA), a tool from Power Platform family of tools for business automation. It would be especially useful if you are already familiar with Power Platform, and using any of its tools to enhance productivity. In this case, PWA will be a natural choice, and it will integrate nicely into all your data points and business processes. In short - Composer is a great low-code tool for developers, while PVA is more for business users.

 

Getting Started with Bot Development

Let me show you how we can start the development of a simple educational bot that will help K-12 students with their geography classes. We will develop a simple bot, which you can later host on Microsoft Azure and connect to most popular communication channels, such as Teams, Slack or Telegram. If you do not have an Azure account, you can get a free trial (or here, if you are a student).

To begin with, we will implement three simple functions in our bot:

  • Being able to tell a capital city for a country (What is the capital of Russia?).
  • Giving definitions of most useful terms, eg. answering a questions like What is a capital?
  • Support for simple chit-chat (How are you today?)

Those two functions cover two most important elements of our intelligent backend: QnA Maker (which can be used to implement the last two points) and LUIS.

 

Starting with Bot Composer

To begin development, you need to [install Bot Framework Composer][InstallComposer] - I recommend to do it as desktop application. Then, after starting it, click on New button, and chose starting template for your bot: QnA Maker and LUIS:

Composer Create

Once you do that, you will see the main screen of composer, with a list of triggers on the left, and the main pane to design dialogs:

 

Composer Main Screen

 

Here, you can delete an unused trigger BuySurface (which is left over from the demo), and go to Welcome message to customize the phrase that the bot says to new user. The logic of Welcome Message trigger is a bit complex, you need to look for a box called Send a response, and change the message in the right pane.

The language used to define phrases is called Language generation, or lg. A few useful syntax rules to know:

  • A phrase starts with -. If want to chose from a number of replies, specify several phrases, and one of them will be selected randomly. For example: ```bash
  • Hello, I am geography helper bot!
  • Hey, welcome!
  • Hi, looking forward to chat with you! ```
  • Comments start with >
  • Some additional definitions start with @
  • You can use ${...} syntax for variable substitution (we will see an example of this later)

 

Connecting to Azure Services

To use intelligent backend, you need to create Azure resources for LUIS and QnA Maker and provide corresponding keys to Composer:

  • Create LUIS Authoring Resource, and make sure to remember the region in which it was created, and copy key from Keys and Endpoint page in Azure Portal.
  • Create QnA Maker Service, and copy corresponding key
  • In Composer, go to bot settings by pressing Project Settings button in the left menu (look for a wrench icon, or expand the menu if unsure). Under settings, fill in LUIS Authoring Key, LUIS region and QnA Maker Subscription key.

 

Starting the Bot

At this point, you can already start chatting with your bot. Click Start bot in the upper right corner, and let some time for the magic to happen. When starting a bot, Composer actually creates and trains underlying LUIS model, builds bot framework project, and starts local web server with a copy of the bot, ready to serve your requests.

To chat with a bot, click Test in emulator button (you need to have Bot Framework Emulator) installed for this to work). This automatically opens up the chat window with all required settings, and you can start talking to your bot right away.

 

Creating QnA Maker Knowledge base

Let’s start with creating term dictionary using QnA Maker. Click on QnA left menu, and then Create new KB.

 

QnA New KB

Here you can either start from some existing data (provided as an URL to html, pdf, Word or Excel document), or start creating phrases from scratch.

In most of the cases, you would have a document to start with, but in our case we will start from scratch. After creating a knowledge base, you can click Add QnA Pair to add all question-answer combinations you need. Note that you can add several options of the question by using All alternative phrasing link.

 

QnA Phrases

 

In our case, I have added a how are you phrase (with several options), and a phrase to explain the meaning of the word capital.

Having added the phrases, we can start a bot and make sure that it correctly reacts to given phrases, or similar versions of those phrases - QnA maker does not require it to be an exact match, it looks for similar phrases to make a decision on which answer to provide.

 

Adding Specific Actions with LUIS

To give our bot an ability to give capitals of countries, we need to add some specific functionality to look for a capital, triggered by a certain phrase. We definitely do not want to type all 200+ countries and their capitals into QnA Maker!

A functionality to get information about a country is openly available via REST Countries API. For example, if we make GET request to https://restcountries.eu/rest/v2/name/Russia, we will get JSON response like this:

[ {"name":"Russian Federation",
   "topLevelDomain":[".ru"],
   "capital":"Moscow", ... } ]

To ask for a capital of a given country, a user will say something like What is a capital of Russia?, or I want to know the capital of Italy. This phrase intent can be recognized using LUIS, and the name of the country is also extracted.

To add LUIS trigger, from the Design page of the composer, select your bot dialog and press “…” next to it. You will see Add a trigger option in the drop-down box. Select it, and then chose Intent recognized as trigger type.

 

Intent Recognized is the most common trigger type. However, you can specify Dialog events, that allow you to structure part of the conversation as a separate dialog, or some conversational activities, such as Handoff to human.

Then, specify trigger phrases, using a variation of LG language. In our case, we will use the following:

- what is a capital of {country=Russia}?
- I want to know a capital of {country=Italy}.
- Give me a capital of {country=Greece}!

Here, we specify a number of trigger phrases starting with -, and we indicate that we want to extract part of the phrase as an entity country. LUIS will automatically train a model to extract entities based on the provided utterances, so make sure to provide a number of possible phrases.

 

There are some pre-defined entity types, such as datetimeV2, number, etc. Using pre-defined types is recommended, and entity type can be specified using @ <entity_type> <entity_name> notation. In our case, we can use geographyV2 entity type, which extracts geographic locations, including countries.

Once we have defined phrase recognizer, we need to add a block that will do the actual REST call and fetch information on the given country. Use use Send HTTP Request block, and specify the following parameters:

This would make the REST call to the API, and the result will be stored into dialog.result property. If we provided a valid country, json result will be automatically parsed, otherwise, invalid operation code will be recorded in dialog.result.statusCode - in our case, 404.

To test if the call was successful and define different logic based on the result, we insert Branch: If/Else block, and specify the following condition: = equals(dialog.result.statusCode,200). True condition will correspond to the left branch, and we will insert Send a response block there, with the following text:

- A capital of ${@country} is ${dialog.result.content[0].capital}

In case result code is not 200, the right branch will be executed, where we will insert an error message. Our final dialog should look like this:

 

 

Adding Preconfigured Chit-Chat Functionality

It would be nice if your bot could respond to more everyday phrases, such as How old are you?, or Do you enjoy being a bot. We can define all those phrases in QnA Maker, but that would take us quite some time to do so. Luckily, there is Project Personality Chat that contains a number of pre-defined QnA Maker knowledge bases for several languages, and for a number of personalities:

  • Professional
  • Friendly
  • Witty
  • Caring
  • Enthusiastic

You can grab a link to the knowledge base from here, then go to QnA Maker Portal, find your knowledge base, and add this URL link to your service:

 

Adding URL to QnAMaker

Having done that, click Save and Train, and enjoy a talk to your bot! You can even try ask it about life, universe and everything!

 

Testing the Bot and Publishing to Azure

Now that our basic bot functionality is complete, we can test the bot in bot emulator:

 

Chat in bot emulator

 

Once the bot is running locally, we can deploy it to Azure right from the Composer. If you go to Publish from the left menu, you will be able to define Publishing profile for your bot. Select Define new publishing profile, and chose one of the following:

 

Publishing profiles

The most standard way to deploy is to use Azure Web App. Composer will only require you to provide Azure subscription and resource group name, and it will take care of creating all the required resources (including bot-specific LUIS/QnA Maker instances) automatically. It may take awhile, but it will save you a lot of time and hassle of doing manual deployment.

Once the bot is published to Azure, you can go to Azure portal and configure Channels through which you bot would be available to external world, such as Telegram, Microsoft Teams, Slack or Skype.

 

Add Bot Channels

 

Conclusion

Creating a bot using Bot Composer seems like an easy thing to do. In fact, you can create quite powerful bots almost without any code! And you can also hook them to your enterprise endpoint using such features as HTTP REST APIs and OAuth authorization.

However, there are cases when you need to significantly extend bot functionality using code. In this case, you have several options:

  • Keep main bot authoring in Bot Composer, and develop Custom Actions in C#
  • Export complete bot code using Custom Runtime feature of Composer, which exports complete bot code in C# or Javascript, which you can then fully customize. This approach is not ideal, because you will lose the ability to maintain the source of your bot in Composer.
  • Write a bot from the beginning in one of the supported languages (C#, JS, Python or Java) using Bot Framework.

If you want to explore how the same Educational bot for Geography can be written in C#, check out this Microsoft Learn Module: Create a chat bot to help students learn with Azure Bot Service.

I am sure conversational approach to UI can prove useful in many cases, and Microsoft Conversational Platform offers you wide variety of tools to support all your scenarios.