Templates / Evaluate AI agent response correctness with OpenAI and RAGAS methodology

Evaluate AI agent response correctness with OpenAI and RAGAS methodology

Ready for 3.0

by Jimleuk ✓ · 1,652 views · created 2025-05-27 · Engineering, AI Summarization

Ready 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 24 nodes and runs on Evaluation events (plus 1 other trigger). Along the way it connects OpenAI Chat Model and Evaluation. It also calls api.openai.com over HTTP.

How it runs

Trigger: On Evaluation events (plus 1 other trigger).

  1. Remap Input (Edit Fields (Set)): sets 1 field: chatInput
  2. AI Agent: runs an AI agent, with model: OpenAI Chat Model
  3. Evaluation: check if evaluating
  4. Set Input Fields (Edit Fields (Set)): sets 3 fields: question, answer, groundTruth
  5. Correctness Classifier (Basic LLM Chain): sends a prompt to an LLM, with model: OpenAI Chat Model; output parser: Examples
  6. Get Embeddings (HTTP Request): calls api.openai.com (POST)
  7. GroundTruth to Items (Split Out): splits a list into separate items
  8. Calculate F1 Score (Code): runs custom JavaScript code
  9. Remap Embeddings (Edit Fields (Set)): sets 1 field: answer
  10. Get Embeddings (HTTP Request): calls api.openai.com (POST)

…plus 8 more steps. See the full node list below.

Services it uses

OpenAI Chat ModelEvaluation

HTTP calls to: api.openai.com

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 (14)

From the author

This n8n template demonstrates how to calculate the evaluation metric "Correctness" which in this scenario, measures the compares and classifies the agent's response against a set of ground truths. The scoring approach is adapted from the open-source…

Excerpt from Jimleuk's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.