I’m integrating Supabase with N8N to perform vector searches on pgvector-stored documents. My SQL function works fine in Supabase, but the JSONB metadata filter doesn’t work when called from N8N.
I noticed also that it works as intended when I do the same but in a node “Retrieve documents As vector store for chain tools” but when it’s “Retrieve documents as tool for AI Agent” the presence of a metadata filter causes an error
I am seeing the same issue. I tried with different vector stores (supabase and pinecone) and same error when using vector store as AI Agent. any fixes or workaround on this please?
Same here.
From what I can work out the node only sees the user chat request, NOT the agent request - you can’t filter (or I can’t get it to filter) on what your agent is asking the node, only what the users inputs in their chat.
The attached filter works (sometimes) but it is not what I need. I need the agent to pass the filter parameter.
At the moment I can’t see how to reference the agent output as a field.
Thanks for feedback guys i’m feeling less alone, i’m pretty sure there is some filters passed in the backround that “takes the place” of the filters we want to actually pass hence the conflict. Is there a way to monitor detailed logs going out from n8n ? Because on Supabase log side I don’t get enough details.
I’ll try to open a support ticket if it is possible
I’m not 100% sure but you maybe able to just use the Postgrest API with match_documents. So just use an http node with predefined credential type of supabase. This would be the curl, if you want to try and import: curl -X POST 'https://YOUR_SUPABASE_URL/rest/v1/rpc/match_documents' \ -H 'Authorization: Bearer YOUR_SUPABASE_ANON_KEY' \ -H 'Content-Type: application/json' \ -d '{ "query_embedding": [/* your embedding array here */], "match_threshold": 0.78, "match_count": 10, "filter": { "user_id": 3 } }'
Update for anyone struggling - I hope this gets fixed soon as its a complete pain - but in the meantime. A work around I’m looking at is rather have the agent call the supabase (or pinecone has same issue) node, and try to get it to do the filter etc, I’ve put that part into a separete workflow. So the agent calls this “Search my vector store workflow” and then in that seperate workflow you get a query coming in. From there you can use the supabase node in retreval mode (not agent tool mode) and apply your filter there, use the query from the LLM as your prompt, and then have it return the response to the main workflow. this works ok. but is a pain having another workflow to keep track of.