n8n workflow template · 18 nodes · OpenAI
RAG on living data is a free n8n workflow template that starts when a chat message is received and works with OpenAI, Supabase and Notion. It has 18 nodes, 9 of them AI nodes (OpenAI Embeddings, Token Splitter, Question and Answer Chain and Vector Store Retriever). The notes inside the workflow say: “Using a manual approach for polling data from Notion for more accuracy.” To run it, you add your own credentials for Notion API, OpenAI API and Supabase API.
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
Using a manual approach for polling data from Notion for more accuracy.
Simple chat bot to ask specific questions while having access to the context of the Notion Knowledge Base which was stored in the Vector Store
If you are on the cloud plan, consider switching to the Notion Trigger Node instead, to save on executions.
Choose the database which represents your Knowledge Base
This placeholder serves as a reference point so it is easier to swap the data source with a different service
Process each page/document separately.
All chunks of a previous version of the document are being deleted by filtering the meta data by the given ID
Reduce the active streams/items to just 1 to prevent the following nodes from double-processing
Model used for both creating and reading embeddings
Retrieve all page contents/blocks
Combine all contents to a single text formatted into one line which can be easily stored as an embed
Embed item and store in Vector Store. Depending on the length the content is being split up into multiple chunks/embeds
Store additional meta data with each embed, especially the Notion ID, which can be later used to find all belonging entries of one page, even if they got split into multiple embeds.
For more accurate search results, increase the overlap. For the text-embedding-ada-002 model the chunk size plus overlap must not exceed 8191
Reduce the active streams/items to just 1 to prevent the following nodes from double-processing
The 18 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:
Configure your own credentials after importing. Create each credential in n8n, then select it in the node.
Do you need somewhere to run it? Read our guide to self-hosted n8n.
We can adapt this workflow to your apps, data and process, then deploy and support it.
Contact Us