Compare OpenAI GPT, Claude, and Gemini responses using Contextual AI’s LMUnit evaluation framework within an n8n workflow. This n8n templates solution automates LLM quality testing.
Download this n8n workflow template and start using it instantly.
Manually comparing the quality of Large Language Model responses (e.g., from OpenAI, Anthropic, and Google Gemini) for criteria like clarity and conciseness is time-consuming and subjective. This robust n8n workflow solves this problem by automating the entire evaluation lifecycle. The solution uses a specialized n8n node, Contextual AI's LMUnit, which provides standardized, context-aware unit testing for natural language responses.
This sophisticated n8n template captures a single user prompt, sends it to multiple providers, and then leverages the LMUnit n8n node to generate a quantitative score (1–5) against custom criteria. The final aggregated result provides clear, data-driven feedback, allowing users to efficiently benchmark and optimize their chosen LLMs. This is a powerful use case demonstrating the flexibility of n8n in complex AI automation tasks.
This complex n8n workflow initiates immediately upon receiving a chat message input via the dedicated n8n trigger:
When chat message received n8n trigger captures the user's prompt. This prompt is simultaneously sent to three separate n8n nodes: OpenAI GPT 4.1, Gemini 2.5 Flash, and Claude 4.5 Sonnet.Set n8n nodes normalize the varied JSON structures of the responses and label them with the provider name. The Combine responses Merge n8n node collects these outputs into a single stream.Add unit tests to responses Code n8n node introduces the evaluation criteria (e.g., clarity and conciseness checks). It multiplies the data items, creating a unique item for every model response paired with every test case.Iterate over each unit tests n8n node ensures sequential processing, and Wait for 3 sec prevents rate limiting before accessing the external evaluation API.Run LMUnit n8n node sends the response and the specific unit test criteria to Contextual AI, receiving an objective quality score.Associate scores with Responses n8n node. Then, the Group Results Together Code n8n node aggregates all scores, grouping them under their respective providers.Format Final Result n8n node structures the grouped data into a readable summary message, which is then delivered back to the user via the Final Response n8n node (a LangChain Chat n8n node).To deploy this powerful n8n workflow, follow these steps:
OpenAI GPT 4.1 n8n node.Claude 4.5 Sonnet n8n node.Gemini 2.5 Flash n8n node. When chat message received (n8n trigger):
Function: Serves as the starting n8n trigger, capturing the user's prompt.
Key Configuration: Response Mode set to responseNodes to handle the final output.
OpenAI GPT 4.1 / Gemini 2.5 Flash / Claude 4.5 Sonnet (LangChain n8n node):
Function: Generates responses in parallel from three different large language models based on the single input prompt captured by the n8n trigger.
Key Configuration: Uses specific, high-performance models (GPT-4.1, Gemini 2.5 Flash, Claude 4.5 Sonnet).
Combine responses (Merge n8n node):
Function: Combines the three parallel response streams (OpenAI, Gemini, Claude) into a single path for subsequent evaluation.
Add unit tests to responses (Code n8n node):
Function: Programmatically injects the evaluation criteria (unit tests) and pairs them with each model's response, preparing the data structure for the LMUnit n8n node.
Run LMUnit (Contextual Ai n8n node):
Function: Core evaluation step. Sends the response and test criteria to the Contextual AI service to obtain an objective quality score (1-5).
Key Configuration: Resource set to LMUnit. Dynamically inputs query, response, and unitTest parameters.
Group Results Together (Code n8n node):
Function: Aggregates the numerous scored items, grouping the results by the provider for structured comparison.
Format Final Result (Code n8n node):
Function: Transforms the aggregated, scored data into a clean, human-readable summary message for the end-user.
Final Response (LangChain Chat n8n node):
* Function: Delivers the final, formatted evaluation report back to the initiating chat interface, completing the n8n workflow cycle.
Use this powerful n8n workflow template to automatically compare flight prices across Kayak, Skyscanner, Expedia, and Google Flights via a webhook, sending a detailed email report to the user.

Automate real-time flight fare checking across Skyscanner, Air India, IndiGo, and more using this powerful n8n workflow. Get instant, sorted email alerts for the cheapest deals delivered straight to your inbox.

Compare two Large Language Models (LLMs) simultaneously and log their outputs, context, and user input to Google Sheets using this advanced n8n workflow. Ideal for AI model evaluation.

Use this powerful n8n workflow to compare real-time hotel prices across Booking.com, Agoda, and Expedia, generating a detailed price report emailed directly to the user. Leverage this n8n template for web scraping and data aggregation.

Automate candidate evaluation using this n8n workflow. Scrape LinkedIn profiles and JDs using GhostGenius, compare them with Groq AI, and generate ATS-style optimization tips. Integrate this powerful n8n template for recruitment.


DevRel at Contextual AI







































