{
  "name": "Compare GPT-4, Claude & Gemini Responses with Contextual AI's LMUnit Evaluation",
  "nodes": [
    {
      "id": "7ba3480f-b4ef-4cd2-91be-cf03623525d1",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -176,
        64
      ]
    },
    {
      "id": "a258fcba-1add-4563-b2db-295ecbfd2e83",
      "name": "Run LMUnit",
      "type": "n8n-nodes-contextualai.contextualAi",
      "position": [
        1520,
        64
      ]
    },
    {
      "id": "6603c1b2-1e37-479b-8566-4da1d2a867a5",
      "name": "Preprocess OpenAI Response",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        -64
      ]
    },
    {
      "id": "9d3f1b8e-83b7-43d4-9533-f5d30fb5ce6b",
      "name": "Preprocess Gemini Response",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        144
      ]
    },
    {
      "id": "64dab774-809d-46e6-9b8a-417334eef4ce",
      "name": "Combine responses",
      "type": "n8n-nodes-base.merge",
      "position": [
        624,
        48
      ]
    },
    {
      "id": "856be276-1e27-4a4c-90d2-614dcff43c56",
      "name": "Add unit tests to responses",
      "type": "n8n-nodes-base.code",
      "position": [
        848,
        64
      ]
    },
    {
      "id": "004de229-3b47-4a25-8758-cb78dac4f2dc",
      "name": "Iterate over each unit tests",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1072,
        64
      ]
    },
    {
      "id": "d5e6bbc0-1136-44fb-a1f3-44e1e7a1be4d",
      "name": "Wait for 3 sec",
      "type": "n8n-nodes-base.wait",
      "position": [
        1296,
        64
      ]
    },
    {
      "id": "30c53f36-50e1-46dd-b34a-95f3c9715645",
      "name": "Associate scores with Responses",
      "type": "n8n-nodes-base.set",
      "position": [
        1744,
        64
      ]
    },
    {
      "id": "93c4e9f3-f54d-4cb8-8bc9-f7cb0e6810c2",
      "name": "Group Results Together",
      "type": "n8n-nodes-base.code",
      "position": [
        1968,
        144
      ]
    },
    {
      "id": "d7df1b30-3074-48ed-8760-a5abf2f27e25",
      "name": "Format Final Result",
      "type": "n8n-nodes-base.code",
      "position": [
        1296,
        -128
      ]
    },
    {
      "id": "4890542e-6f0b-4e56-9d58-03e21e35296e",
      "name": "Final Response",
      "type": "@n8n/n8n-nodes-langchain.chat",
      "position": [
        1520,
        -128
      ]
    },
    {
      "id": "50fafc17-0180-4caa-9758-9f4cf6d292e2",
      "name": "Preprocess Anthropic Response",
      "type": "n8n-nodes-base.set",
      "position": [
        384,
        336
      ]
    },
    {
      "id": "afee1fc1-af47-40cd-8350-4c19969249ad",
      "name": "OpenAI GPT 4.1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        48,
        -64
      ]
    },
    {
      "id": "1577d553-e55e-4f5d-a7c5-a89f2af3a96f",
      "name": "Gemini 2.5 Flash",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        48,
        144
      ]
    },
    {
      "id": "1d779c2e-d50e-4466-a70a-232f557800a0",
      "name": "Claude 4.5 Sonnet",
      "type": "@n8n/n8n-nodes-langchain.anthropic",
      "position": [
        32,
        336
      ]
    },
    {
      "id": "89f15299-0f97-4fb4-ac18-26e3cbb2ee6f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -320
      ],
      "parameters": {
        "width": 528,
        "height": 1376,
        "content": "# Multi-Model Response Evaluation using Contextual AI’s LMUnit  \n\n## PROBLEM  \nEvaluating and comparing responses from multiple LLMs (OpenAI, Claude, Gemini) can be challenging when done manually.  \n-"
      }
    },
    {
      "id": "fa8085b7-11f8-4cc5-9430-e5f535345f41",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -320
      ],
      "parameters": {
        "width": 736,
        "height": 832,
        "content": "### 1: User Message Submission \nWhen a user sends a message through the chat interface, the input is captured and forwarded simultaneously to three different language models: GPT 4.1, Gemini 2.5 Flash"
      }
    },
    {
      "id": "100f6319-47d8-4882-a360-5e075c777924",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        -320
      ],
      "parameters": {
        "width": 416,
        "height": 832,
        "content": "### 2: Associate unit tests with language model responses\nAfter preprocessing responses, we attach unit tests to evaluate each response using predefined quality criteria:\n - “Is the response clear and"
      }
    },
    {
      "id": "b6bcb7e0-a35d-4724-9f4e-bd5fc2897465",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        -320
      ],
      "parameters": {
        "width": 1136,
        "height": 816,
        "content": "### 3: Use Contextual AI's LMUnit to evaluate responses\nFinally, we pass the responses alongside the unit tests to Contextual AI's LMUnit to generate evaluation scores and aggregate them to display fi"
      }
    }
  ],
  "connections": {
    "Run LMUnit": {
      "main": [
        [
          {
            "node": "Associate scores with Responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI GPT 4.1": {
      "main": [
        [
          {
            "node": "Preprocess OpenAI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for 3 sec": {
      "main": [
        [
          {
            "node": "Run LMUnit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini 2.5 Flash": {
      "main": [
        [
          {
            "node": "Preprocess Gemini Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude 4.5 Sonnet": {
      "main": [
        [
          {
            "node": "Preprocess Anthropic Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine responses": {
      "main": [
        [
          {
            "node": "Add unit tests to responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Final Result": {
      "main": [
        [
          {
            "node": "Final Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group Results Together": {
      "main": [
        [
          {
            "node": "Iterate over each unit tests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Preprocess Gemini Response": {
      "main": [
        [
          {
            "node": "Combine responses",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Preprocess OpenAI Response": {
      "main": [
        [
          {
            "node": "Combine responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "OpenAI GPT 4.1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Gemini 2.5 Flash",
            "type": "main",
            "index": 0
          },
          {
            "node": "Claude 4.5 Sonnet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add unit tests to responses": {
      "main": [
        [
          {
            "node": "Iterate over each unit tests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Iterate over each unit tests": {
      "main": [
        [
          {
            "node": "Format Final Result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for 3 sec",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Preprocess Anthropic Response": {
      "main": [
        [
          {
            "node": "Combine responses",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Associate scores with Responses": {
      "main": [
        [
          {
            "node": "Group Results Together",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}