This project provides an example solution to illustrate the use of Azure AI Document Intelligence and Azure OpenAI to extract pertinent details and classifications from study documents for eArchive purposes. The intent is to replace a manual form which a user must fill out about a document when requesting the document to be eArchived in downstream systems, with an automated process triggered by the upload of said document.
This solution includes a Durable Azure Function with Azure Blob Storage bindings for both trigger and output, the use of Azure AI Document Intelligence for initial document processing, and Azure OpenAI for more complex entity and classification extraction from section chunks. The result is a flattened JSON document of key/value pairs that is parsed and sent to Dataverse to record the eArchive request with details that would have been captured in a form from the user.
This solution includes a blob triggered durable function deployed to an Azure Function App, developed on Python with Semantic Kernel SDK to define and orchestrate prompt function calls to Azure OpenAI, as well as other libraries to perform calls to Azure AI Document Intelligence services.
- Document uploaded to blob storage, triggers Azure Durable Function
Python function uses Langchain and AI Services Document Intelligence to: - Convert document to markdown
- Split into chunks by heading
- Detect Language
- Identify presence of handwritten text (signature)
- Python function uses Semantic Kernel to orchestrate semantic (prompt) functions to Azure OpenAI chat completion service to:
- Classify document type from document chunks
- Extract entities and metadata of interest from document chunks
- Python function uses Typing and List libraries to
synthesize mode of entities extracted from chunks to return most likely correct value for various entities/metadata and forms into flattened JSON
- Resulting JSON file is stored in blob storage for downstream processing
Reference Documentation:
- Semantic Kernel GitHub Repo
- Getting Started with Semantic Kernel (Python)
- Understanding the Kernel in Semantic Kernel
- Adding AI Services to the Kernel
See Power Platform Section for details
- Create an Azure Function App in your Azure Subscription
- Create a Storage Account in your Azure Subscription
- Configure the Azure Function App with necessary application settings, such as connection strings for Azure Blob Storage. See local.settings.example.json for required settings
- Deploy the function code to the Azure Function App
- Follow instructions in Power Platform section to deploy Power Platform portion of the solution
Reference Documentation:
- Manage your function app
- App Configuration references
- Develop Azure Functions by using Visual Studio Code
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.