Agentic RAG Supabase icon

Agentic RAG Supabase

Handle RAG operations with Supabase pgvector for PDF/TXT files

Overview

The node "Agentic RAG Supabase" provides operations to manage and query vector embeddings stored in a Supabase database using pgvector extension. Specifically, the Search Vector operation under the Vector resource allows users to perform similarity searches on vector embeddings based on a text query.

This node is useful in scenarios where you have documents or chunks of text embedded as vectors (e.g., via machine learning models) and want to find the most relevant pieces of information related to a user query. Typical applications include semantic search, recommendation systems, and retrieval-augmented generation (RAG) workflows.

For example, after ingesting and embedding a large set of documents, you can use this node to quickly retrieve the top K most semantically similar documents or text chunks to a given query string.

Properties

Name Meaning
Query The text query string for which you want to find the most similar vectors/documents.
Top K The number of top matching results to return from the vector similarity search.

Output

The output JSON contains the following fields:

  • results: An array of matched documents/chunks from the vector database. Each item includes content and metadata.
  • query: The original query string used for the search.
  • resultsCount: Number of results returned (up to Top K).

The node does not output binary data for this operation.

Dependencies

  • Requires a Supabase project with the pgvector extension enabled and a table configured to store vector embeddings.
  • Needs credentials including:
    • Supabase project URL and API key for database access.
    • Hugging Face API key for generating vector embeddings of the query text.
  • Uses the Hugging Face model "thenlper/gte-small" to generate embeddings for the input query.
  • The node internally calls a Supabase remote procedure match_documents to perform the vector similarity search.

Troubleshooting

  • Error: Unknown error / Embedding error
    This may occur if the Hugging Face API key is invalid or rate-limited, or if the embedding service is unreachable. Verify your API key and network connectivity.

  • Error: No documents found
    If the search returns zero results, it could mean the vector table is empty or the similarity threshold is too strict. Ensure that vectors have been upserted correctly and consider adjusting parameters.

  • Error: RPC call failed / SQL errors
    Indicates issues with the Supabase database setup or permissions. Confirm that the rag_documents table exists with the correct schema and that the pgvector extension is installed.

  • Invalid or missing credentials
    Make sure all required credentials (Supabase and Hugging Face API keys) are properly configured in n8n.

Links and References


This summary focuses exclusively on the Vector > Search Vector operation as requested.

Discussion