Document-based questions and answers
The system extracts the content from a source file (such as a PDF or DOCX stored in Google Drive), receives as a parameter the desired number of questions, and uses an AI model (OpenAI) to generate a relevant questionnaire with its answers
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
TextInput-9v0ms[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Text Input]
style TextInput-9v0ms stroke:#a170ff
GDriveFilesComponent-wnaii[<div><img alt="logo" src="/_astro/google_drive.wKmDsV2c.svg" style="height: 20px !important;width: 20px !important"/></div>Drive File Manager]
style GDriveFilesComponent-wnaii stroke:#a170ff
Prompt-knklq[<div><img alt="logo" src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt]
style Prompt-knklq stroke:#a170ff
DeepseekModel-ael5s[Deepseek]
style DeepseekModel-ael5s stroke:#a170ff
TextInput-f3zh3[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Cantidad de preguntas a generar]
style TextInput-f3zh3 stroke:#a170ff
TextOutput-itzp7[<div><img alt="logo" src="/_astro/type.Dy26vmDy.svg" style="height: 20px !important;width: 20px !important"/></div>Text Output]
style TextOutput-itzp7 stroke:#a170ff
ParseData-yy97j[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Extraer texto de documento]
style ParseData-yy97j stroke:#a170ff
TextInput-9v0ms -.- GDriveFilesComponent-wnaii
linkStyle 0 stroke:#a170ff
GDriveFilesComponent-wnaii -.- ParseData-yy97j
linkStyle 1 stroke:#a170ff
ParseData-yy97j -.- Prompt-knklq
linkStyle 2 stroke:#a170ff
TextInput-f3zh3 -.- Prompt-knklq
linkStyle 3 stroke:#a170ff
Prompt-knklq -.- DeepseekModel-ael5s
linkStyle 4 stroke:#a170ff
DeepseekModel-ael5s -.- TextOutput-itzp7
linkStyle 5 stroke:#a170ff
📄 Document‑Based Questions & Answers Workflow
🧩 Overview
This workflow automatically generates a set of comprehension questions and detailed answers from a source document stored in Google Drive. The user supplies a Drive file URL and the desired number of questions. The system extracts the file’s text, feeds it to a prompt template that formats the request for the AI model, and returns a Markdown‑formatted Q&A list.
⚙️ Main Features
- Extracts text from PDFs or DOCX files hosted on Google Drive.
- Accepts a dynamic number of questions specified by the user.
- Uses a prompt template to structure the AI request in Spanish.
- Generates high‑quality questions and answers via the Deepseek LLM.
- Outputs the result directly in the Playground as formatted Markdown.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| File URL Input | Captures the Google Drive link for the source file. | User‑supplied file URL. | Text (file URL). |
| Drive File Manager | Retrieves the file content from Google Drive. | File URL (from File URL Input), Operation = “Get”. | Data (file metadata + raw content). |
| Text Extractor | Converts the raw file data into plain text. | Data from Drive File Manager. | Text (extracted document content). |
| Prompt Template | Builds a Spanish prompt that includes the extracted text and the requested number of questions. | Document text, Number of questions. | Prompt Message (ready for the LLM). |
| Deepseek Model | Generates the Q&A text using the Deepseek chat model. | Prompt Message. | Generated Text (Markdown Q&A). |
| Text Output | Displays the final Markdown text in the Playground. | Generated Text. | Text (visible output). |
Note: The “Number of questions” input is provided via a separate Text Input component and is consumed by the Prompt Template step.
🧠 Notes
- The workflow requires valid OAuth credentials for Google Drive access.
- The Deepseek model must be authenticated with a working API key stored in the environment.
- The prompt template is written in Spanish; the output will also be in Spanish.
- The final output is strictly Markdown, following the structure:
Pregunta 1: <question>
Respuesta a la pregunta 1: <answer>
---
- The number of questions must be an integer; non‑numeric input will result in an error.
- If the Drive file cannot be retrieved (e.g., invalid URL, missing permissions), the workflow will terminate with a clear error message.
- Empty or missing inputs are not processed; the workflow will skip the relevant steps and return no output.