# Ingest and vectorize documents with Gemini and PostgreSQL pgvector

> Quick Overview This subworkflow ingests uploaded documents (PDF, DOCX, TXT, or CSV), extracts text, uses Google Gemini to generate metadata and embeddings, and stores chunked vectors in PostgreSQL with pgvector for semantic search while skipping unchanged duplicates. How it works 1. Receives document metadata (userid, filename, optional mimetype) and a binary file in binary.data from an Execute Workflow trigger. 2. Validates required fields, enforces allowed file types and a 20 MB limit, and routes the file to the appropriate text extraction method (PDF/DOCX/TXT/CSV). 3. Consolidates the extracted output into a single normalized text body and stops with an error if the extracted text is too short. 4. Calls the Google Gemini generateContent API to extract document metadata (title, type, summary, keywords, language) and parses the JSON response. 5. Hashes the extracted text and upserts a document record in PostgreSQL, detecting duplicates by comparing the stored content hash for the same

- **Domain**: `n8n-workflow-22333.n8n.io`
- **Provider**: n8n.io (https://n8n.io)
- **Kind**: workflow
- **Live-responds (last probe)**: None
- **Signed card**: False
- **Streaming**: False
- **Quality score**: 40%

## URLs
- Agent card: https://n8n.io/workflows/22333
- Page (HTML): https://agenstry.com/agents/n8n-workflow-22333.n8n.io
- Documentation: https://n8n.io/workflows/22333
