Contract generator
This workflow automates the drafting of standardized legal documents, such as Confidentiality 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 alt="logo" src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>Redactor Legal]
style OpenAIModel-c8t7z stroke:#a170ff
TextInput-ac284[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Información]
style TextInput-ac284 stroke:#a170ff
TextInput-mfop6[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Claves Específicas]
style TextInput-mfop6 stroke:#a170ff
PdfWriter-gxl2g[Pdf Writer]
style PdfWriter-gxl2g stroke:#a170ff
DocxWriter-826zm[Docx Writer]
style DocxWriter-826zm stroke:#a170ff
TextInput-ac284 -.- CombineText-bh1ku
linkStyle 0 stroke:#a170ff
TextInput-mfop6 -.- CombineText-bh1ku
linkStyle 1 stroke:#a170ff
CombineText-bh1ku -.- OpenAIModel-c8t7z
linkStyle 2 stroke:#a170ff
OpenAIModel-c8t7z -.- PdfWriter-gxl2g
linkStyle 3 stroke:#a170ff
OpenAIModel-c8t7z -.- DocxWriter-826zm
linkStyle 4 stroke:#a170ff
Contract Generator
The Contract Generator streamlines the creation of standard legal documents, such as Non‑Disclosure Agreements (NDAs). By gathering contract details and clauses, the workflow feeds them into an AI model that drafts the complete agreement, which is then output as both PDF and DOCX files ready for signing or further editing.
⚙️ Main Features
- Consolidates contract metadata and clause details into a single prompt.
- Employs an OpenAI model to draft a coherent, legally‑structured agreement.
- Produces a styled PDF and a Word‑ready DOCX file from the generated text.
- Allows customization of model parameters (temperature, token limits, etc.).
- Supports automatic storage of output files for immediate download or further processing.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Information | Provides the general contract context (type, location, parties). | – | Text describing the contract type, location, and parties. |
| Key Details | Supplies specific clauses, definitions, and obligations. | – | Text containing clause lists and obligation descriptions. |
| Combine Text | Concatenates the two text inputs into a single prompt. | Text from Information, Text from Key Details | Combined Text ready for the AI model. |
| OpenAI Model | Generates the full legal agreement using the AI. | Combined Text as the prompt | Generated Text of the complete contract. |
| PDF Writer | Creates a PDF file from the generated contract text. | Generated Text | File path to the PDF document. |
| DOCX Writer | Creates a DOCX file from the generated contract text. | Generated Text | File path to the DOCX document. |
🧠 Notes
- The OpenAI model used is gpt‑4.1‑mini; the workflow requires a valid OpenAI API key and optional model parameter adjustments.
- The PDF output incorporates default CSS styling to ensure readable formatting, while the DOCX writer uses a preset file name (
contrato.docx). - Token limits may constrain very long inputs; users should monitor the length of combined text to avoid exceeding model capacity.
- The workflow outputs are independent; the PDF and DOCX files are stored separately and can be accessed or downloaded after generation.
- No explicit error handling is embedded; failures in the AI call or file writing may halt downstream steps.
- The workflow assumes that the input text is well‑structured; poorly formatted inputs can lead to incoherent generated contracts.