AI Agents

Generate OpenAI Citations for RAG File Retrieval

19 nodes 284 139 Automatic trigger
Download

Workflow Description

An automation that processes chat queries with OpenAI while maintaining conversation context in memory, generating accurate citations from retrieved files to ensure proper source attribution and reference documentation.

How it works

  1. 1.Receive user query through chat trigger
  2. 2.Maintain conversation history in memory buffer
  3. 3.Process request with OpenAI to generate citations
  4. 4.Aggregate and format results for delivery

Use cases

  • Create documented references from document databases
  • Support knowledge-based search applications with accurate citations

Requirements

  • Valid OpenAI API key configured
  • Accessible file storage or document database for retrieval

Service Value

Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.

Apps Used

Memory Chat Trigger OpenAI

Details

Trigger Automatic trigger
Nodes 19
Apps 3
Views 284
Downloads 139

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (19)

/

Aggregate

Aggregate

#1

Window Buffer Memory

Memory Buffer Window

#2

Sticky Note4

Sticky Note

#3

Sticky Note

Sticky Note

#4

Create a simple Trigger to have the Chat button within N8N

Chat Trigger

#5

OpenAI Assistant with Vector Store

OpenAI

#6

Sticky Note1

Sticky Note

#7

Get ALL Thread Content

HTTP Request

#8

Sticky Note2

Sticky Note

#9

Split all message iterations from a thread

Split Out

#10

Split all content from a single message

Split Out

#11

Split all citations from a single message

Split Out

#12

Retrieve file name from a file ID

HTTP Request

#13

Regularize output

Set

#14

Sticky Note3

Sticky Note

#15

Sticky Note5

Sticky Note

#16

Sticky Note6

Sticky Note

#17

Optional Markdown to HTML

Markdown

#18

Finnaly format the output

Code

#19