Use Azure OpenAI and LangChain to categorize a document by combining input document with provided template documents

Ferry Djaja
6 min readSep 17, 2023

In this tutorial, we will learn how to categorize the documents using Azure OpenAI and LangChain.

As part of my daily responsibilities, I am tasked with reviewing change request (CR) documents submitted by my team. These CR documents come in two types: Normal and Standard. The primary distinction between these two types is that the Standard version is a simplified variant of the normal CR document. I have also made templates available for both document types to assist my team in adhering to a standardized format when submitting CRs. However, there are instances when the templates are not followed, leading to the need for request rejection. To facilitate both my team’s and I reviewing the CR document, I have developed an application for document review and categorization.

CR Templates

I have created CR template documents for both the standard and normal CR, which I will input into LangChain.

Standard CR (CR_Template_Standard.txt)

THIS IS STANDARD CR TEMPLATE DOCUMENT — START

Change Description
==================

Description:
<<jira id>>
Man hours Saved annually…

--

--