Skip to content

making match_documents compatible with n8n structure #17

@virtuman

Description

@virtuman

If this makes sense, and purely for compatibility, do you think it would be a good idea to make match_documents in the format as expected by n8n? this would allow to re-use same function for n8n workflows. Minor difference in implementation, but makes it usable with n8n out of the box

Minor differences are arguments in the function:
n8n-compatible:

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
)

current mind-matrix: https://github.com/khwerhahn/MindMatrix/blob/main/sql/setup.sql#L70-L81

CREATE OR REPLACE FUNCTION public.match_documents(
    query_embedding vector(1536),
    search_vault_id TEXT,
    match_count INT
)
RETURNS TABLE (
    id BIGINT,
    obsidian_id TEXT,
    content TEXT,
    metadata JSONB,
    similarity FLOAT
)

Documentation reference for function structure:
https://supabase.com/docs/guides/ai/langchain?database-method=sql

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions