Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Custom Question Answering Bot and custom Bot UI for Website

License

NotificationsYou must be signed in to change notification settings

sanjay-senthilkumar01/Custom-Question-Answering-Bot-and-custom-Bot-UI-

Repository files navigation

Neura_QA_bot

Neura a QA bot for Neural Inverse website support for the Question regarding Neural Inverse ,With the bot's source code, anyone can create their own bot QA similar to Neura inNeuralinverse.live

Bot Framework v4 Custom question answering bot sample. This sample demonstrates usage of advanced features of Custom question answering likePrecise answering, support for unstructured sources along withMulti-turn conversations andActive Learning in a bot.

This bot has been created usingBot Framework, it shows how to create a bot that uses theCustom question answering feature in Language Service.

Concepts introduced in this sample

TheCustom question answering feature in Language Service enables you to build, train and publish a simple question and answer bot based on FAQ URLs, structured and unstructured documents or editorial content in minutes. In this sample, we demonstrate:

  • How to use the Active Learning to generate suggestions for knowledge base.
  • How to use follow up prompts to create multiple turns of a conversation.
  • How to configure display of precise answers.
  • How to enable/disable querying unstructured sources with the bot.

Prerequisites

Configure knowledge base of the project

  • Follow instructionshere to create a Custom question answering project. You will need this project's name to be used asProjectName inappsettings.json.
  • VisitLanguage Studio and open created project.
  • Go toEdit knowledge base -> Click on... -> Click onImport questions and answers -> Click onImport as TSV.
  • ImportSampleForCQA.tsv file.
  • You can test your knowledge base by clicking onTest option.
  • Go toDeploy knowledge base and click onDeploy.

Connect your bot to the project.

Follow these steps to updateappsettings.json.

  • In theAzure Portal, go to your resource.
  • Go toKeys and Endpoint under Resource Management.
  • Copy one of the keys as value ofLanguageEndpointKey and Endpoint as value ofLanguageEndpointHostName inappsettings.json.
  • ProjectName is the name of the project created inLanguage Studio.

To try this sample

  • Install the Bot Framework Emulator version 4.14.0 or greater fromhere

  • Run the bot from a terminal or from Visual Studio, choose option A or B.

    A) From a terminal

    # run the botdotnet run

    B) Or from Visual Studio

    • Launch Visual Studio
    • File -> Open -> Project/Solution
    • SelectQnABotWithMSI.csproj file
    • PressF5 to run the project
  • Connect to the bot using Bot Framework Emulator

    1. Launch Bot Framework Emulator
    2. File -> Open Bot
    3. Enter a Bot URL ofhttp://localhost:3978/api/messages

Try Active Learning

  • Try the following utterances:
    1. Surface Book
    2. Power
  • In Language Studio, click on inspect to see the closeness in the scores of the returned answers.
  • InBot Framework Emulator, a card is generated with the suggestions.
    • Clicking an option would send afeedback record which would show as suggestion underReview suggestions inLanguage Studio.
    • ActiveLearningCardTitle,ActiveLearningCardNoMatchText andActiveLearningCardNoMatchResponse in the card could be changed fromQnAMakerBaseDialog.cs.

Try Multi-turn prompt

  • Try the following utterances:
    1. Accessibility
    2. Options
  • You will notice that multi-turn prompts associated with the question are also returned in the responses.

Try Precise Answering

  • Try the following utterances:
    1. Accessibility
    2. Register
  • You will notice a short answer returned along with a long answer.
  • If testing inLanguage Studio, you might have to checkInclude short answer response at the top.
  • You can disable precise answering by settingEnablePreciseAnswer to false inappsettings.json.
  • You can setDisplayPreciseAnswerOnly to true inappsettings.json to display just precise answers in the response.
  • Learn more aboutprecise answering.

Query unstructured content

  • Go to your project inLanguage Studio -> InManage sources click on+ Add source
  • Click onURLs and addhttps://www.microsoft.com/en-us/microsoft-365/blog/2022/01/27/from-empowering-frontline-workers-to-accessibility-improvements-heres-whats-new-in-microsoft-365/ and selectunstructured in theClassify file structure dropdown.
  • Try the following utterances:
    1. Frontline workers
    2. Hybrid work solutions
  • You can observe that, answers are returned with high score.
  • You can set_includeUnstructuredSources to false inQnAMakerBaseDialog.cs to prevent querying unstructured sources.

Try Filters

  • Go to your project inLanguage Studio -> InEdit knowledge bases -> UnderMetadata column click on+ Add
  • Select a QnA to edit and add a key value pair, sayLanguage :CSharp, and click onSave changes.
  • Click onTest and select metadata that you just added(Language : CSharp) by clicking onShow advanced options.
  • This will return answers with specified metadata only.
  • You can filter answers using bot as well by passing metadata and/or source filters. Edit line no. 81 inQnAMakerBaseDialog.cs to something like below.Learn more.
    varfilters=newFilters{MetadataFilter=newMetadataFilter(){LogicalOperation=Bot.Builder.AI.QnA.JoinOperator.AND.ToString()},LogicalOperation=Bot.Builder.AI.QnA.JoinOperator.AND.ToString()};filters.MetadataFilter.Metadata.Add(newKeyValuePair<string,string>("Language","CSharp"));filters.SourceFilter.Add("SampleForCQA.tsv");filters.SourceFilter.Add("SampleActiveLearningImport.tsv");// Initialize Filters with filters in line No. 81

Microsoft Teams channel group chat fix

When a bot (named asHelpBot) is added to a Teams channel or Teams group chat, you will have to refer it as@HelpBotHow to build a bot? to get answers from the service.However, bot tries to send<at>HelpBot</at>How to build a bot? as query to Custom question answering service which may not give expected results for question to bot. The following code removes<at>HelpBot</at> mentions of the bot from the message and sends the remaining text as query to the service.

  • GotoBots/QnABotWithMSI.cs
  • Add References
    usingMicrosoft.Bot.Connector;usingSystem.Text.RegularExpressions;
  • ModifyOnTurnAsync function as:
    publicoverrideasyncTaskOnTurnAsync(ITurnContextturnContext,CancellationTokencancellationToken=default){// Teams group chatif(turnContext.Activity.ChannelId.Equals(Channels.Msteams)){turnContext.Activity.Text=turnContext.Activity.RemoveRecipientMention();}awaitbase.OnTurnAsync(turnContext,cancellationToken);// Save any state changes that might have occurred during the turn.awaitConversationState.SaveChangesAsync(turnContext,false,cancellationToken);awaitUserState.SaveChangesAsync(turnContext,false,cancellationToken);}

Deploy the bot to Azure

SeeDeploy your C# bot to Azure for instructions.

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

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

Further reading

About

Custom Question Answering Bot and custom Bot UI for Website

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp