First, replace the keys in the "Save the embedding in DB" & "Search Embeddings" nodes with your new Supabase keys. After that, run the following code snippets in your Supabase SQL editor:
Create the table to store chunks and embeddings:
CREATE TABLE public."RAG"
(
id bigserial PRIMARY KEY,
chunk text NULL,
embeddings vector(1024) NULL
)
TABLESPACE pg_default;
Create a function to match embeddings:
DROP FUNCTION IF EXISTS public.matchembeddings1(integer, vector);
CREATE OR REPLACE FUNCTION public.matchembeddings1(
match_count integer,
query_embedding vector
)
RETURNS TABLE (
chunk text,
similarity float
)
LANGUAGE plpgsql
AS $$
BEGIN
RETURN QUERY
SELECT
R.chunk,
1 - (R.embeddings <=> query_embedding) AS similarity
FROM public."RAG" AS R
ORDER BY R.embeddings <=> query_embedding
LIMIT match_count;
END;
$$;
Create a new Google Doc with the complete knowledge base about your business and replace the document ID in the "Content for the Training" node.
Get a Together AI API key and paste it into the "Embedding Uploaded document" node and the "Embed User Message" node.
Go to https://business.facebook.com/latest/settings/apps
, create an app, and select the use case "Connect with customer through WhatsApp". Copy the Client ID and Client Secret and add them to the first node.
Go to that newly created META app in the app dashboard, click on the use case, and then click on "customise...". Go to the API setup, add your number, and also generate an access token on that page. Now paste the access token and the WhatsApp Business Account ID into the send message node.
manualTrigger
googleDocs
code
httpRequest
supabase
whatsAppTrigger
if
httpRequest
httpRequest
aggregate
langchain agent
lmChatGoogleGemini
whatsApp