This article is contributed. See the original author and article here.

OpenAI’s GPT-3 AI applications have become a buzzword in the industry. If you’re looking to boost your business operations and maximize productivity but are encountering technical barriers and resource limitations, the app highlighted in this article may be your answer.
It smoothly integrates Azure OpenAI into various business workflows, showcasing a spectrum of AI-powered demos. This demo highlight the technology’s capabilities and can help streamline your business operations while optimizing productivity.


 


SAVITAMITTAL_4-1679241206110.png


Let’s build your business process with OpenAI


Resources 




  • Azure OpenAI – Summarization & gain insights



  • Power Apps – To build front end

  • Power Automate – To build the process


Getting Started


1. Azure Open AI – Summarization & Gain insights



SAVITAMITTAL_0-1679082782817.png


3. Create 2 SharePoint Lists 



  • Prompts for your custom questions (change questions & prompt types as per your business requirements)

  • Conversation insights to save Open AI generated insights from the email text (change column names as per your business requirements)


SAVITAMITTAL_7-1679086505620.png


 


Scenario 1: Lets start with conversation insights. Assume you have an email enabled conversation. You want to get some insights from the email text.


To generate insights, PowerAutomate is used and then results are saved in SharePoint.

3. Create a PowerAutomate




  • Here are the steps to create a Power Flow:



    1. Go to flow.microsoft.com and click on “Flows”.

    2. Visit https://make.powerautomate.com/

    3. Click “New Flow” and name it “OpenAI-Insights“.

    4. It has many variables for multiple prompts at once and save insights from one conversation in SharePoint List.

    5. Build the entire flow according to your requirements.SAVITAMITTAL_1-1679083168954.png

    6. When a new email arrives-Choose email trigger if email’s conversation you want to use as a source to gain insights. Else you can use any other trigger depends upon where your conversations stores. e.g. Teams chat, SharePoint, blob storage or any other storage solution.

    7. HtmlToText-Get email body as a plain text using html to text connector.

    8. Get items– SharePoint Connector to get the prompts list to run on your email text to gain additional insights

    9. Initialize Variables-# of variables are initialized based on number of prompts

    10. initialize a variable called summary to store output.

    11. Apply to each -OPEN AI step loop through each prompt question on original conversation text to get the insight and save the result via case statement in the initialized variable.
      HTTP Connector

      Method: POST
      URI: https://resourcename.openai.azure.com/openai/deployments/davinci003/completions?api-version=2022-12-01
      Headers content-type:application/json
      api-key:  [Azure Portal -> OpenAI resource -> Keys & Endpoints]
      Body   {
      “prompt”: @{variables(‘promptPhrase’)},
      “max_tokens”: 1000,
      “temperature”: 1
      }

      SAVITAMITTAL_0-1679091327420.png
      ParseOpenAIOutput-Parse the response from OpenAI HTTP output.
      Click Generate from sample in Parse step and paste the below sample json to parse the response from HTTP output


      {
      “body”: {
      “id”: “cmpl-xxxxxxx”,
      “object”: “text_completion”,
      “created”: 1678909613,
      “model”: “text-davinci-003”,
      “choices”: [
      {
      “text”: “nThe main reason of the conversation is to give credit to travel company for their gracious refund of the cost of the no-show.”,
      “index”: 0,
      “finish_reason”: “stop”,
      “logprobs”: null
      }
      ],
      “usage”: {
      “completion_tokens”: 27,
      “prompt_tokens”: 91,
      “total_tokens”: 118
      }
      }
      }


      SAVITAMITTAL_0-1679199886668.pngAfter parsing we need to loop the array and assign the text to the variable
      Apply to each action. Select Choices from parse step output as the array property.
      Set  Output – variable “Summary” 

      Switch: It has 6 case actions based on number of prompts to set the each variable based on each HTTP Post call.


      SAVITAMITTAL_1-1679200233800.png

       


       end of Apply to each -OPEN AI step #11 (loop through each prompt question and call OpenAI endpoint to get insights. Parse the response and save it in each prompt related variable)
       



    12. Create Item – Once all the variables are set then create an entry in the SharePoint Conversation insights list with original text and additional insightsSAVITAMITTAL_3-1679200897367.png




SAVITAMITTAL_2-1679202037897.png


How to utilize insights into a process
PowerApps can be created with SharePoint list to create a business process around insights generated by OpenAI on each customer conversation.
Dashboard->Details screen-> Process each conversation with Insights
https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/app-from-sharepoint



 Dashboard – Vertical galley in PowerApps with SharePoint list ‘Conversation Insights’ as a Data Source 


SAVITAMITTAL_1-1679201855711.png                                   
 Item details page with OpenAI insights to accelerate the customer service – Display form in PowerApps


 


SAVITAMITTAL_3-1679202135976.png


 


Stay tuned for more exciting blog content as we explore various potential scenarios.
Effortlessly extract text from documents, audio, and video files to generate valuable insights.

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.