Intelligent Document Retrieval with Supabase and OpenAI Embeddings
detail.loadingPreview
Leverage the power of OpenAI embeddings and Supabase's vector search capabilities to build an intelligent document retrieval system. This workflow enables you to query your documents semantically and retrieve the most relevant results with associated file metadata.
About This Workflow
This n8n workflow orchestrates a sophisticated document retrieval process by integrating OpenAI's embedding generation with Supabase's robust database and vector search functionalities. The core of the workflow lies in transforming a natural language query into a vector embedding using OpenAI's text-embedding-3-small model. This embedding is then sent to a custom Supabase RPC function, match_documents, which performs a similarity search against a documents table. The function also joins with a files table to enrich the results with file names and URLs. The entire process is highly configurable, allowing for dynamic filtering of results based on file_id directly from the workflow. This enables precise and context-aware retrieval of information from your knowledge base.
Key Features
- Semantic Search: Understands the meaning behind your queries, not just keywords.
- Vector Embeddings: Utilizes OpenAI's advanced models to represent text numerically for accurate comparisons.
- Supabase Integration: Leverages Supabase for efficient data storage and powerful vector similarity search.
- Customizable RPC Functions: Extends Supabase with
match_documentsfor tailored retrieval logic. - File Metadata Enrichment: Returns relevant file names and URLs alongside search results.
How To Use
- Configure Credentials: Ensure your OpenAI API key and Supabase URL/API key are securely set up in n8n.
- Deploy Supabase Functions: Implement the provided
match_documentsandmatch_filesSQL functions within your Supabase project. - Set up
filesTable: Ensure yourfilestable in Supabase has columns likeid,name,google_drive_url, andembedding. - Configure
Database retrieval1Node: Replace placeholder API keys and Supabase IDs in thejsCode. Thequeryparameter should be provided by an upstream node (e.g., a chat trigger). - Define Filters (Optional): In the
Database retrieval1node, pass a JSON object to thefiltersparameter (e.g.,{ "file_id": ["uuid1", "uuid2"] }) to narrow down the search to specific files. - Connect Trigger: Connect your desired trigger node (e.g.,
When chat message received) to initiate the workflow.
Apps Used
Workflow JSON
{
"id": "dd08ad46-cc76-413b-a7cd-92a1abad32d3",
"name": "Intelligent Document Retrieval with Supabase and OpenAI Embeddings",
"nodes": 22,
"category": "DevOps",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: dd08ad46-cc76...
About the Author
Free n8n Workflows Official
System Admin
The official repository for verified enterprise-grade workflows.
Statistics
Related Workflows
Discover more workflows you might like
Effortless Bug Reporting: Slack Slash Command to Linear Issue
Streamline your bug reporting process by instantly creating Linear issues directly from Slack using a simple slash command. This workflow enhances team collaboration by providing immediate feedback and a structured approach to logging defects, saving valuable time for development and QA teams.
Automated PR Merged QA Notifications
Streamline your QA process with this automated workflow that notifies your team upon successful Pull Request merges. Leverage AI and vector stores to enrich notifications and ensure seamless integration into your development pipeline.
Visualize Your n8n Workflows: Interactive Dashboard with Mermaid.js
Gain unparalleled visibility into your n8n automation landscape. This workflow transforms your n8n instance into a dynamic, interactive dashboard, leveraging Mermaid.js to visualize all your workflows in one accessible place.