Previous post displayed the basic way of calling ChatGPT in Azure OpenAI. For more complex scenarios we want to add PDF document, index it and use the indexed document in the ChatGPT prompts instead of giving the source data in the REST API call.

Azure Configuration

There needs to be Azure Search Service Instance, Storage account and Azure OpenAI service. Remember to give permission for the Search Service to read Storage account and OpenAI Service to call Search Service.

I used instructions

Main Power Automate flow

Handles the data, document and updating the data run into error.

  • First we trigger the flow only if there is attachment using trigger conditions.
  • Then there is failsafe, just to be sure that I don’t start my flow again with status.
  • Then we update the status for moved to processing.
  • We need to move the document into Azure BLOB for the Search to Index it
  • Then create index, indexer, run the indexer and ensure that it has run successful before continuing
  • Finally call OpenAI ChatGPT with prompt and save the result into Dataverse

Moving document to BLOB

Get the Dataverse row and download the file. Then create BLOB to Azure and respond to parent flow.

There will be following posts showing more about the logic for