OpenAI citation generation for RAG file retrieval
Workflow Description
Advanced template utilizing buffered memory and retrieval-augmented generation to generate accurate citations via OpenAI, preserving conversation context while organizing data retrieved from source files.
How it works
- 1.Receive user query through chat trigger and store it in memory buffer
- 2.Send query to OpenAI with preserved context for citation generation
- 3.Process results and format output using Markdown and data splitting
Use cases
- Create verified citations for documents retrieved in RAG systems
- Build intelligent assistants that provide accurate source references when answering questions
- Automate source documentation in enterprise search applications
Requirements
- Valid OpenAI API key configured
- Pre-configured source files or database for retrieval
- Basic understanding of retrieval-augmented generation workflows
Service Value
Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.
Apps Used
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (19)
Aggregate
Aggregate
Window Buffer Memory
Memory Buffer Window
Sticky Note4
Sticky Note
Sticky Note
Sticky Note
Create a simple Trigger to have the Chat button within N8N
Chat Trigger
OpenAI Assistant with Vector Store
OpenAI
Sticky Note1
Sticky Note
Get ALL Thread Content
HTTP Request
Sticky Note2
Sticky Note
Split all message iterations from a thread
Split Out
Split all content from a single message
Split Out
Split all citations from a single message
Split Out
Retrieve file name from a file ID
HTTP Request
Regularize output
Set
Sticky Note3
Sticky Note
Sticky Note5
Sticky Note
Sticky Note6
Sticky Note
Optional Markdown to HTML
Markdown
Finnaly format the output
Code