Create a Chatbot using Azure OpenAI and Azure Bot Service

Ziggy Zulueta 480 Reputation points MVP
2023-08-15T14:10:20.5666667+00:00

I would like to create a chatbot that uses Azure OpenAI for its to answer questions using my own data. I would then like to use Azure Bot Service so that I can use the bot for many channels. Is this possible?

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,251 questions
{count} votes

Accepted answer
  1. VasaviLankipalle-MSFT 14,831 Reputation points
    2023-08-16T16:55:38.4833333+00:00

    Hello @Ziggy Zulueta , I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue: Create a Chatbot to use Azure OpenAI in order to train the bot and then use Azure Bot Service for it to be used in multiple channels.

    Solution:

    1. Go to framework composer and create the bot. https://learn.microsoft.com/en-us/composer/install-composer?tabs=windows
    2. In the composer, you can call an HTTP Request to call the Open AI service and get the response.
    3. The tricky part is to add logic in the composer specifically on adding the chat history in the messages array:
      1. If user is new, then initialize the messages array to system role and initial user role
        1. We provide an option for user to reset the whole conversation so them messages array is initialized
          1. while the user keeps on chatting the messages array gets added
            1. in all cases above the messages array is sent to the open ai request
    4. Once the logic is completed and the Open AI HTTP Request and handling is done properly in the composer, then you can eventually publish the bot in Azure bot service
    5. from there you can use the chatbot in multiple channels

    Thank you again for your time and patience throughout this issue.

    Regards,
    Vasavi
    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    2 people found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Ziggy Zulueta 480 Reputation points MVP
    2023-08-16T16:45:00.6866667+00:00

    I was able to fulfill my requirement by doing the following:

    1. Go to framework composer and create the bot.
    2. In the composer, you can call an HTTP Request to call the Open AI service and get the response.
    3. The tricky part is to add logic in the composer specifically on adding the chat history in the messages array:
      1. If user is new, then initialize the messages array to system role and initial user role
        1. We provide an option for user to reset the whole conversation so them messages array is initialized
          1. while the user keeps on chatting the messages array gets added
            1. in all cases above the messages array is sent to the open ai request
    4. Once the logic is completed and the Open AI HTTP Request and handling is done properly in the composer, then you can eventually publish the bot in Azure bot service
    5. from there you can use the chatbot in multiple channels
    2 people found this answer helpful.

  2. John Sanders 176 Reputation points Microsoft Employee
    2023-08-15T20:09:46.06+00:00

    I would suggest trying to use the preview "on your data" feature: https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/use-your-data


  3. VasaviLankipalle-MSFT 14,831 Reputation points
    2023-08-15T21:52:33.3866667+00:00

    Hello @Ziggy Zulueta , Thanks for using Microsoft Q&A Platform.

    Yes, you can use the Azure OpenAI and then Azure Bot Service. As mentioned by John, try Azure OpenAI on your data (preview) feature.

    Please go through this documentation to learn how to deploy your model to Power Virtual Agents directly from Azure OpenAI studio: https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/use-your-data#using-power-virtual-agents

    I hope this helps.

    Regards,
    Vasavi