Documentation generator
This workflow is an automated system designed to generate customized documents on the indicated topic in PDF format and save them in Google Drive.
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
Prompt-rek36[<div><img alt="logo" src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt]
style Prompt-rek36 stroke:#a170ff
OpenAIModel-qct7t[<div><img alt="logo" src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>OpenAI]
style OpenAIModel-qct7t stroke:#a170ff
PdfWriter-ht7y8[Pdf Writer]
style PdfWriter-ht7y8 stroke:#a170ff
GDriveFilesComponent-0mr8v[<div><img alt="logo" src="/_astro/google_drive.wKmDsV2c.svg" style="height: 20px !important;width: 20px !important"/></div>Google Drive File Manager]
style GDriveFilesComponent-0mr8v stroke:#a170ff
TextInput-643iq[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Notas adicionales o instrucciones personalizadas]
style TextInput-643iq stroke:#a170ff
TextInput-ipla4[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Nivel de grado]
style TextInput-ipla4 stroke:#a170ff
TextInput-nup34[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Incluir clave de respuestas]
style TextInput-nup34 stroke:#a170ff
TextInput-nhmez[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Número de preguntas]
style TextInput-nhmez stroke:#a170ff
TextInput-sj7qo[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Asunto]
style TextInput-sj7qo stroke:#a170ff
TextInput-qcjq3[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Tema de la hoja de trabajo]
style TextInput-qcjq3 stroke:#a170ff
Prompt-rek36 -.- OpenAIModel-qct7t
linkStyle 0 stroke:#a170ff
OpenAIModel-qct7t -.- PdfWriter-ht7y8
linkStyle 1 stroke:#a170ff
PdfWriter-ht7y8 -.- GDriveFilesComponent-0mr8v
linkStyle 2 stroke:#a170ff
TextInput-643iq -.- Prompt-rek36
linkStyle 3 stroke:#a170ff
TextInput-ipla4 -.- Prompt-rek36
linkStyle 4 stroke:#a170ff
TextInput-nup34 -.- Prompt-rek36
linkStyle 5 stroke:#a170ff
TextInput-nhmez -.- Prompt-rek36
linkStyle 6 stroke:#a170ff
TextInput-sj7qo -.- Prompt-rek36
linkStyle 7 stroke:#a170ff
TextInput-qcjq3 -.- Prompt-rek36
linkStyle 8 stroke:#a170ff
Documentation Generator
🧩 Overview
The workflow automates the creation of a customized worksheet, automatically generating the content with an AI model, converting the result to a PDF, and storing the file in Google Drive. It streamlines the process of producing topic‑specific worksheets, saving time and ensuring consistency across documents.
⚙️ Main Features
- Collects user‑defined parameters such as topic, subject, grade level, number of questions, inclusion of an answer key, and any additional notes.
- Builds a dynamic prompt that instructs the AI model to generate a worksheet in plain Markdown.
- Invokes an OpenAI model to produce the worksheet text.
- Converts the AI‑generated text into a styled PDF file.
- Uploads the resulting PDF to a specified Google Drive folder, handling file creation and naming automatically.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Text Input (Additional Notes) | Collects optional custom instructions for the worksheet. | Text entered by the user. | Message containing the user’s text. |
| Text Input (Grade Level) | Provides the educational grade for which the worksheet is intended. | Text entered by the user. | Message containing the grade level. |
| Text Input (Include Answer Key) | Indicates whether an answer key should be generated. | Text entered by the user (“Yes” or “No”). | Message containing the choice. |
| Text Input (Number of Questions) | Specifies how many questions the worksheet should contain. | Text entered by the user. | Message containing the numeric value. |
| Text Input (Subject) | Identifies the subject area of the worksheet. | Text entered by the user. | Message containing the subject. |
| Text Input (Topic of Worksheet) | Describes the specific topic the worksheet will cover. | Text entered by the user. | Message containing the topic. |
| Prompt | Assembles a structured prompt using the collected inputs and passes it to the AI model. | Six messages: grade level, subject, topic, number of questions, answer key flag, and additional notes. | Prompt message ready for the AI. |
| OpenAI Model | Generates the worksheet content in plain Markdown based on the prompt. | Prompt message. | Generated worksheet text. |
| PDF Writer | Converts the AI‑generated Markdown into a PDF file with optional styling. | Generated text, CSS style, and desired file name. | Path to the created PDF file. |
| Google Drive File Manager | Uploads the PDF to Google Drive and stores it in the selected folder. | File content (PDF path), folder ID, and file name. | Data object containing the stored file’s metadata. |
🧠 Notes
- The workflow assumes valid credentials for both the OpenAI API and Google Drive are configured.
- Only a single worksheet is generated per execution; batch processing would require a mapping mode configuration.
- The prompt template enforces Markdown output; any additional formatting is handled by the PDF writer.
- The PDF writer applies a default CSS style; customizing the style requires editing the
css_stringinput. - File upload to Google Drive uses the Upload operation by default; other operations (Copy, Move, etc.) can be selected manually if needed.
- The workflow does not support real‑time streaming responses; the AI output is awaited before PDF creation.