Creating Your Own Document Generating AI Assistant

Ai on circuit board in futuristic concept suitable for future technology artwork , Responsive web banner
Shai Shulman, Adv.

Shai Shulman, Adv.

Legal Team Lead, Corporate Counsel, LegalTech Developer

What is AI’s best practical use for a lawyer? Could it be a chatbot assistant that can draft new documents from her own templates?

Generative AI has become part of our daily lives ever since ChatGPT made its public debut, way back in the hazy days of November 2022 (though it may now seem like a century ago). We’re using it to plan a romantic trip to Italy, write a song for a loved one’s birthday, or seek answers to those questions we’d rather not ask out loud.

For us lawyers, however, using an AI chatbot in a professional capacity isn’t that easy. The stakes are higher, both in terms of our professional credibility and financial implications. Ultimately, we find ourselves with no control over the accuracy of the legal data used to train the AI model, or over the style, tone, and wording used in the responses it produces.

To me, one routine legal task that is just waiting to be automated is drafting new agreements and other legal documents from a template. Every corporate and transactional lawyer has their own collection of templates, honed over years, ready to be customized for each new client and new case. With GenAI’s potential to streamline this process in mind, I’ve set out to find a simple and easy way to use an off-the-shelf AI chatbot for generating new documents from these templates.

This mission turned out to be a bit harder than it looks, as following a specific template is not something that GenAI models can easily do. I focused on ChatGPT, given its better customization capabilities compared to newer competitors, experimenting with some simple techniques (embedding templates in prompts) and some very complex ones (fine-tuning). None were very practical as a simple solution.

This is where the advent of custom GPTs comes into play. Introduced in late 2023, OpenAI’s new feature, dubbed “GPTs”, allows users with subscription to the Plus tier to create a customized chatbots for various purposes, from drafting legal documents to providing specialized advice, by including additional specific knowledge, detailed instructions, and even external tools that can enrich the response from external data sources. 

Through some clever prompt engineering and a small plugin, I had developed, I was able to quickly create a simple but powerful personalized AI helper in ChatGPT, that can generate new legal documents from my own template.

Practical Guide

To start creating a your own GPT for generating legal documents, ensure you have a Plus account with ChatGPT and head over to


The GPT hinges on two critical elements: Knowledge and Instructions. As Knowledge, you’ll upload files that containing the data used in creating the responses. These can range from snippets to full templates, which can include placeholders for new data to be completed and specific inline instructions for different scenarios. It’s advisable, however, to limit the number of templates uploaded for each GPT to avoid issues with aligning to different templates. In my case, I uploaded a unilateral NDA template, complete with placeholders and specific instructions for different scenarios.

Example of instructions for new GPT
Example of instructions for new GPT


Instructions play a crucial role in shaping the AI’s output. They should guide the model to strictly follow your templates word for word (which is quite different from the usual behavior of GenAI models) and specify when to deviate from the template’s wording. As ChatGPT can only output unformatted text by default, you can instruct the model to use a specific format that can display bold text, headers and numbered lists. In this case my instructions include a directive to use a specific lightweight format called Markdown when creating the response.

You can further refine your instructions to include additional directives, like adding signature blocks or paragraph numbering for each document. Once you saved you GPT, you can now simply prompt it with a specific request like “Generate a unilateral NDA for company X with the following requirements”, and the GPT will generate the text for the new document.

Time For Action

This is all very well, but still not incredibly efficient as we would need toggle back and forth between Word and ChatGPT. If only there was a way for ChatGPT to create actual Word documents for us.

While ChatGPT cannot create external files by itself, it does offer a solution through “actions” – external plugins that enhance the AI’s capabilities. For instance, I developed a small plugin that enables ChatGPT to produce downloadable Word documents directly from its text-based response, and made it available here (source code here). Once you let your GPT know of the plugin’s existence, it will direct the response to the plugin any time you specifically ask that a Word file be generated, and you will get back a link to download the new file.

Adding Doc-It as an Action

Integrating this plugin is easy: select “Add New Action,” click “Import“, enter the plugin’s URL, and change the existing GPT instruction to also direct the GPT to generate a Word file.

Using the GPT

Once you’ve configured the plugin, you can use it with a prompt the same way you always use ChatGPT. The only difference is that the response will be generated based on your own templates and provided as a Word file.

Voila! Our GPT creates a new NDA for our client SecretCo Limited as a Word file

From this point onward you could start to experiment and refine your GPT and the instructions to ensure the output meets your needs. Keep in mind that this method is best suited for shorter documents due to the AI’s limited context window.

Naturally, you should always consider information security concerns when sharing sensitive data with external services like ChatGPT.

Scroll to top