Contract Generator
This flow automates the drafting of standardized legal documents, such as Non-Disclosure Agreements (NDAs), through an AI-powered assistant.
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
CombineText-bh1ku[Combine Text]
style CombineText-bh1ku stroke:#a170ff
OpenAIModel-c8t7z[<div><img src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>Redactor Legal]
style OpenAIModel-c8t7z stroke:#a170ff
TextInput-ac284[<div><img src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Informacion]
style TextInput-ac284 stroke:#a170ff
TextInput-mfop6[<div><img src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Claves Especificas]
style TextInput-mfop6 stroke:#a170ff
PdfWriter-ndfys[Pdf Writer]
style PdfWriter-ndfys stroke:#a170ff
DocxWriter-dwzww[Docx Writer2]
style DocxWriter-dwzww stroke:#a170ff
TextInput-ac284 -.- CombineText-bh1ku
linkStyle 0 stroke:#a170ff
TextInput-mfop6 -.- CombineText-bh1ku
linkStyle 1 stroke:#a170ff
OpenAIModel-c8t7z -.- PdfWriter-ndfys
linkStyle 2 stroke:#a170ff
OpenAIModel-c8t7z -.- DocxWriter-dwzww
linkStyle 3 stroke:#a170ff
CombineText-bh1ku -.- OpenAIModel-c8t7z
linkStyle 4 stroke:#a170ff
Contract Generator
đź§© Overview
The Contract Generator streamlines the creation of standardized legal documents—such as Non‑Disclosure Agreements—by aggregating user‑supplied contract details and key clauses, feeding them into a large language model, and automatically producing finalized PDF and DOCX files. The workflow eliminates manual drafting, ensures consistency, and delivers ready‑to‑sign documents in a fraction of the time.
⚙️ Main Features
- Collects contract metadata and clause details from two separate text inputs.
- Combines the input sections into a single coherent prompt for the AI model.
- Generates a full legal contract using the GPT‑4o model, guided by a system message.
- Outputs the contract in PDF format for signatures and record‑keeping.
- Outputs the contract in DOCX format for further editing or review.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Text Input | Supplies the contract information such as parties, location, and type. | User‑typed contract metadata. | Text containing contract metadata. |
| Text Input | Supplies specific clauses, definitions, and obligations for the agreement. | User‑typed clause details. | Text containing clause specifics. |
| Combine Text | Concatenates the two text inputs into a single prompt for the AI. | Text from the first input; text from the second input. | Combined text prompt. |
| OpenAI Model | Generates the complete legal contract from the combined prompt. | Combined text prompt; system message prompting legal drafting. | Generated contract text. |
| PDF Writer | Creates a PDF file of the generated contract. | Generated contract text. | File path to the PDF. |
| DOCX Writer | Creates a DOCX file of the generated contract. | Generated contract text. | File path to the DOCX. |
đź§ Notes
- The workflow relies on the GPT‑4o language model; switching models requires updating the model name in the OpenAI Model component.
- The system message passed to the model should instruct the assistant to produce a formal, fully‑formed contract, ensuring the output adheres to legal drafting standards.
- The PDF Writer uses a default CSS style that formats the contract with standard typography; this can be customized via the
css_stringinput if different styling is required. - The DOCX Writer produces a plain DOCX file containing the contract text; no additional formatting is applied beyond what the model outputs.
- All inputs must be non‑empty; the workflow does not validate semantic correctness of the clauses.
- The final PDF and DOCX files are stored as data objects, providing file paths that can be used downstream or delivered to the user.