Is there a way to get an n8n agent to call/chat with two separate supabase tables?

Is there a way to get an n8n agent to call/chat with two separate supabase tables?

Sure, why not. You can connect many tools to AI Agent.

What’s the best approach? To create multiple Supabase vector store tools or just input multiple table names into the field? (Is this even possible? @ihortom)

I also face this same issue.
So I’m using the Supabase Documentation, linked by this section of n8n documentation

-- Enable the pgvector extension to work with embedding vectors
create extension vector;

-- Create a table to store your documents
create table documents (
  id bigserial primary key,
  content text, -- corresponds to Document.pageContent
  metadata jsonb, -- corresponds to Document.metadata
  embedding vector(1536) -- 1536 works for OpenAI embeddings, change if needed
);

-- Create a function to search for documents
create function match_documents (
  query_embedding vector(1536),
  match_count int default null,
  filter jsonb DEFAULT '{}'
) returns table (
  id bigint,
  content text,
  metadata jsonb,
  similarity float
)
language plpgsql
as $$
#variable_conflict use_column
begin
  return query
  select
    id,
    content,
    metadata,
    1 - (documents.embedding <=> query_embedding) as similarity
  from documents
  where metadata @> filter
  order by documents.embedding <=> query_embedding
  limit match_count;
end;
$$;

And then I want to create another function, let’s just say match_buildings. The vector_store from n8n kept using match_documents by default even when it’s been stated to use match_buildings.

I don’t have any alternative except of using different supabase credentials if I want to use another function from the supabase.

2 Likes

You can achieve this with a custom query option like this:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.