Save Costs In RAG Workflows using the Q&A Tool With Multiple Models
Ready for 3.0What this workflow does
This AI workflow has 10 nodes and runs when a chat message arrives (plus 1 other trigger). Along the way it connects Embeddings OpenAI, Vector Store Question Answer and OpenAI Chat Model.
How it runs
Trigger: When a chat message arrives (plus 1 other trigger).
- AI Agent: runs an AI agent, with model: Expensive model; 1 tool (Answer questions with a vector store)
- Insert Data to Store (Simple Vector Store): stores documents in the Simple vector store, with embeddings: Embeddings OpenAI; document loader: Default Data Loader
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 (8)
- n8n Form Trigger
n8n-nodes-base.formTrigger - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - Simple Vector Store
@n8n/n8n-nodes-langchain.vectorStoreInMemory - AI Agent
@n8n/n8n-nodes-langchain.agent - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - Vector Store Question Answer Tool
@n8n/n8n-nodes-langchain.toolVectorStore - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
From the author
This template shows how to use the Question and Answer tool to save costs in RAG use cases. Who is this for? This template is for everyone who wants to start giving knowledge to their Agents through RAG. Requirements Have a PDF with custom knowledge that you…