Use this comprehensive n8n workflow to calculate the RAG document relevance evaluation metric. Leverage the n8n Evaluation nodes and OpenAI to assess whether retrieved documents are relevant to user questions.
Download this n8n workflow template and start using it instantly.
• AI/ML Engineers and Data Scientists needing automated RAG system evaluation.
• Developers utilizing n8n templates for advanced AI and Large Language Model (LLM) automation.
• Users seeking to implement custom, prompt-based metrics using an n8n node structure.
• Anyone managing RAG systems who needs to systematically test knowledge base retrieval quality.
Evaluating the quality of a Retrieval-Augmented Generation (RAG) system is critical for production readiness. This sophisticated n8n workflow calculates the 'retrieved document relevance' metric. This metric determines if the information (facts) retrieved from the vector store by the AI Agent is actually relevant to the user's initial question.
This specific n8n workflow is divided into two parts: a setup flow to populate the vector store from a Google Sheet dataset, and the main evaluation flow. By using this n8n template, you gain a repeatable, transparent method for assessing retrieval performance, essential for debugging and improving your RAG application's knowledge foundation. The conditional logic ensures that the metric calculation (the most costly step) only runs when the n8n trigger is executing a formal evaluation.
The n8n workflow operates in two main phases:
similarity) into the evaluation run data, completing this powerful n8n workflow step. When fetching a dataset row (n8n trigger): This Evaluation n8n node initiates the relevance check for each row of the test dataset, providing the required inputs (like the question) to the RAG system.
AI Agent (Langchain n8n node): Serves as the core RAG processor. It uses the 'OpenAI Chat Model' and the 'Simple Vector Store1' tool to retrieve information. Key configuration: 'Return intermediate steps' is enabled to capture the retrieved documents.
Evaluating? (Evaluation n8n node): A critical flow control n8n node. It ensures that the subsequent high-cost metric calculation is only executed during a formal evaluation run, saving operational costs.
Extract documents (Set n8n node): Used to parse the output from the AI Agent, specifically filtering the intermediate steps to isolate the observation from the vectorknowledgebase tool, which contains the retrieved FACTS.
Calculate doc relevance metric (OpenAI n8n node): This n8n node performs the actual metric calculation. It uses a GPT-4o-mini model with a detailed system prompt to critically assess the relevance of the retrieved documents against the original question, returning a score (0 or 1) and comprehensive reasoning in JSON format.
Set metrics (Evaluation n8n node): The final n8n node in the evaluation chain, used to formally record the calculated relevance score (named similarity) back into the n8n evaluation result set.
Use this expert n8n workflow template to automatically calculate the semantic similarity and correctness score of AI-generated answers against ground truth data using the specialized n8n node for evaluations.

Calculate AI evaluation metrics using this advanced n8n workflow. Determine if an n8n agent correctly utilized a required tool (like Calculator) during execution.

Use this powerful n8n workflow to rigorously evaluate the performance and accuracy of an AI Agent designed for support ticket categorization. Compare generated priority and category against ground truth data using custom evaluation metrics.

Calculate AI performance using text similarity (Levenshtein distance) on extracted handwritten code. This advanced n8n workflow uses OpenAI GPT-4o and custom logic for precise metric reporting.

Analyze AI quality with this robust n8n workflow. It uses OpenAI embeddings to calculate Answer Similarity scores against ground truth, ideal for RAG evaluations. Get started with n8n templates today.









































