Make OpenAI citation for file retrieval RAG
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
What this workflow does
This AI workflow has 12 nodes and runs when a chat message arrives. Along the way it connects OpenAI.
How it runs
Trigger: When a chat message arrives.
- OpenAI: work with assistant, with memory: Window Buffer Memory
- Get ALL Thread Content (HTTP Request): calls an HTTP API
- Split all message iterations from a thread (Split Out): splits a list into separate items
- Split all content from a single message (Split Out): splits a list into separate items
- Split all citations from a single message (Split Out): splits a list into separate items
- Retrieve file name from a file ID (HTTP Request): calls an HTTP API
- Regularize output (Edit Fields (Set)): sets 3 fields: id, filename, text
- Aggregate: combines items into one
- Finnaly format the output (Code): runs custom JavaScript code
- Optional Markdown to HTML (Markdown): converts between Markdown and HTML
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (9)
- Aggregate
n8n-nodes-base.aggregate - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - OpenAI
@n8n/n8n-nodes-langchain.openAi - HTTP Request
n8n-nodes-base.httpRequest - Split Out
n8n-nodes-base.splitOut - Edit Fields (Set)
n8n-nodes-base.set - Markdown
n8n-nodes-base.markdown - Code
n8n-nodes-base.code
From the author
Make OpenAI Citation for File Retrieval RAG Use case In this example, we will ensure that all texts from the OpenAI assistant search for citations and sources in the vector store files. We can also format the output for Markdown or HTML tags. This is…