Document quality control
This workflow is a system designed to answer questions about the content of a specific document stored in Google Drive. It acts as an assistant that can "read" a file and answer queries about its information.
+3
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
ChatInput-t1dhv[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Input]
style ChatInput-t1dhv stroke:#a170ff
OpenAIModel-b5y7n[<div><img alt="logo" src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>OpenAI]
style OpenAIModel-b5y7n stroke:#a170ff
ChatOutput-eun7o[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output]
style ChatOutput-eun7o stroke:#a170ff
GDriveFilesComponent-mgn88[<div><img alt="logo" src="/_astro/google_drive.wKmDsV2c.svg" style="height: 20px !important;width: 20px !important"/></div>Google Drive File Manager]
style GDriveFilesComponent-mgn88 stroke:#a170ff
ParseData-kfvde[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Parse Data]
style ParseData-kfvde stroke:#a170ff
Prompt-qq08j[<div><img alt="logo" src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt2]
style Prompt-qq08j stroke:#a170ff
OpenAIModel-b5y7n -.- ChatOutput-eun7o
linkStyle 0 stroke:#a170ff
GDriveFilesComponent-mgn88 -.- ParseData-kfvde
linkStyle 1 stroke:#a170ff
ParseData-kfvde -.- Prompt-qq08j
linkStyle 2 stroke:#a170ff
ChatInput-t1dhv -.- Prompt-qq08j
linkStyle 3 stroke:#a170ff
Prompt-qq08j -.- OpenAIModel-b5y7n
linkStyle 4 stroke:#a170ff
🧩 Overview
This workflow acts as an intelligent assistant that can read a document stored in Google Drive and answer user queries about its content.
When a user submits a question through the chat interface, the system retrieves the specified file, extracts its text, constructs a prompt that includes the document’s content, sends the prompt to an OpenAI language model, and finally returns the model’s answer to the user.
⚙️ Main Features
- Chat‑based interaction that accepts user questions and optional file attachments.
- Google Drive integration to retrieve the target document directly from the cloud.
- Data parsing that converts the retrieved file into plain text suitable for the language model.
- Dynamic prompt construction that merges the document text with the user’s question.
- OpenAI model execution that generates a contextual response.
- Chat output that presents the answer back to the user in the same conversation.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Chat Input | Receives the user’s question (and optional files). | User message text. | Message containing the question. |
| Google Drive File Manager | Retrieves the specified document from Google Drive. | File name or ID selected by the user. | Raw file content wrapped in a Data object. |
| Parse Data | Converts the raw file data into plain text. | Data object from the file manager. | Text representation of the document. |
| Prompt | Builds a prompt that includes the document text and the user’s question. | Document text and question message. | Prompt message ready for the language model. |
| OpenAI | Generates a response using the constructed prompt. | Prompt message. | Generated text message. |
| Chat Output | Delivers the generated answer back to the user. | Generated text message. | Message displayed in the chat. |
🧠 Notes
- The workflow requires valid credentials for both Google Drive and the OpenAI API.
- File extraction supports standard text‑based formats; binary or unsupported formats may fail to parse.
- The OpenAI model is configured to return plain text; JSON output can be enabled if desired.
- The system handles a single document per query; processing large documents may result in token limits being exceeded.
- All components operate synchronously; the response latency depends on the size of the document and the OpenAI model’s inference time.