Quick Overview
This workflow collects a question and PDF via an n8n form, uses Google Gemini to answer using only the document with citations, suggests follow-up questions, emails the results via Gmail, and logs the Q&A to Google Sheets.
How it works
- Receives a form submission that includes the user’s email address, a question, and an uploaded PDF.
- Sends the PDF and question to Google Gemini’s document model to generate an answer that quotes the exact clause or sentence used, or states if the document lacks the answer.
- If the PDF cannot be read, sends a failure notification to the user via Gmail.
- Formats the extracted answer together with the user’s email and original question.
- Uses a Google Gemini chat model to generate three unnumbered follow-up questions based on the Q&A.
- Emails the cited answer and suggested follow-ups to the user via Gmail and appends the Q&A to a Google Sheets worksheet.
Setup
- Add a Google Gemini (PaLM) API credential and ensure the selected Gemini models are available in your project.
- Connect a Gmail OAuth2 account and verify it can send emails to external recipients.
- Connect a Google Sheets OAuth2 account and select the target spreadsheet and sheet/tab (for example, a tab named “Document QA”) for logging.
- Publish the form and share its URL with users, and ensure uploads are text-based PDFs (not scanned images) and within the size limit your instance supports.