Inspiration

Talking with the team from Morgan and Morgan, we were made aware of the enormous amount of legal documents that must be sifted through. Along with people being lost, confused, and experiencing a slow process. We were motivated to provide a solution to assist case workers in organizing and identifying documents and streamlining the legal process for the people. This revelation drove us to develop LegalFlow, a powerful tool leveraging AI and Azure technology to revolutionize the document management process and provide chatting services in the legal domain.

What it does

LegalFlow employs AI algorithms and Azure technology to perform in-depth document analysis, accurately categorizing legal documents into six distinct classes. This streamlines the organization and management of legal documents, ultimately saving valuable time and resources for legal teams. It serves as a chatbot as well, allowing to bolster trust, create a more expedient process, and more personalized experience towards the people.

How we built it

To create LegalFlowAI (our chat service), we used an instance of ChatConversation from the LangChain toolkit to allow our model to continually have context of the previous messages as the user interacts with the model. Our strategically created system prompt encourages LegalFlowAI to be inquisitive by nature, always asking a follow up question after providing information to keep the client engaged and welcomed to the firm.

The document classification system was built by using Azure’s AI Document Intelligence cloud service. This service uses OCR to extract all text found within a document for processing using a language model. The token stream is fed into a GPT model that classifies the document into one of six categories: Court Order Medical Record Medical Bill Correspondence, Police Report', Other We use LangChain here to carefully and thoughtfully construct a system prompt for our model so that it performs at its best (we elaborate later).

These models were combined within the Streamlit toolkit which allowed us to rapidly deploy a web-app integrating both of the abilities. Streamlit also supports the uploading of a local file (for the classification system) and allows the user to enable a simple accessibility setting to narrate responses from LegalFlowAI.

Challenges we ran into

When asking the model simply to classify the document into one of six categories, we found that the model was often incorrect in its conclusion. I recently learned a technique in which we ask the model to ‘show its thinking’. Just as how an elementary student who ‘shows their work’ on a math problem will likely have a higher accuracy than one who shows no work, we have also found language models tend to perform better when they show their thinking as well. All that is extra for us to do is parse (from the end of the response) what the final answer is (done by wrapping in <<< >>>) to get the document type to display to the user.

During day 2 of the project, we chose to use the LangChain toolkit rather than Microsoft’s SK that we set up during day 1 after attending a workshop. We quickly adapted to that kit while continuing to use Azure for our OCR cloud computing.

Accomplishments that we're proud of

Firstly, we take pride in meeting the project deadline and showcasing our team's strong commitment and effective project management. Secondly, achieving a perfect 15/15 score in classifying legal documents highlights the precision and accuracy of our AI model. Lastly, successfully implementing a text-to-speech feature adds an extra layer of accessibility and usability to our application. These accomplishments collectively underscore our team's technical prowess and dedication to delivering a high-quality solution.

What we learned

Throughout the development of LegalFlow, we gained invaluable insights into the intricacies of document analysis, AI integration, and the potential of Azure technology in the legal domain. We also honed our skills in collaborative problem-solving and project management. We learned how to utilize Streamlit as a medium for deployment to allow us to focus on functionality at first, and design later. We also learned how to incorporate HTML and CSS onto Streamlit, allowing us to keep it as our medium for deployment.

What's next for LegalFlow

The next steps for LegalFlow would be to obtain a larger dataset and train and test the model to see if it still functions in a bigger, broader, and more diverse set of information. Future features we look forward to implementing in LegalFlow are increasing its accessibility (making it multilingual for example)

Built With

Share this project:

Updates