{
  "name": "Synthesize and compare multiple LLM responses with OpenRouter council",
  "nodes": [
    {
      "id": "9e8c8e51-b1e8-431b-b104-675d4bb2cc57",
      "name": "Initialize Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        224,
        0
      ]
    },
    {
      "id": "11432589-2dd5-42c5-9a05-d85b7908fd23",
      "name": "Split by Model",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        368,
        0
      ]
    },
    {
      "id": "f304d235-b1a1-41b2-88ef-15a3fa53123c",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        64,
        0
      ]
    },
    {
      "id": "234da11b-e5f3-49a2-a5f7-502a9d713b9e",
      "name": "Stage 1: Query Model Answers",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        544,
        0
      ]
    },
    {
      "id": "c00798aa-8e82-453e-9030-3e875a5d1ec6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -304
      ],
      "parameters": {
        "width": 496,
        "height": 624,
        "content": "## INPUT and INITIALIZATION\n- Ask the question\n- Initialize the models"
      }
    },
    {
      "id": "19faade7-71a3-493c-8d77-7bcc3b7ddfe4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -304
      ],
      "parameters": {
        "width": 480,
        "height": 624,
        "content": "## Stage 1: Individual Model Responses\n- Feed user query to **all** Council Member Models\n- Collect the Model responses  from **all** Council Member Models"
      }
    },
    {
      "id": "f78c2ed3-b1a7-42e0-8a9d-4ed0c2e4df36",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        -304
      ],
      "parameters": {
        "width": 1328,
        "height": 624,
        "content": "## Stage 2: Response Evaluation and Ranking\n- **Anonymize model responses**\n- Ask models to evaluate and rank the answers"
      }
    },
    {
      "id": "e61dbdc2-87d9-438e-a732-dbe74fd63467",
      "name": "Stage 2: Query Model Answer Rankings",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1776,
        0
      ]
    },
    {
      "id": "dd5219c2-c4a0-4f46-aa12-21114a02a92a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        368
      ],
      "parameters": {
        "width": 736,
        "height": 624,
        "content": "## Stage 3: The Chairman's verdict\n- The Chairman model synthesizes the Council's result\n"
      }
    },
    {
      "id": "33fdeb1d-bfed-4d24-aa7f-e5bc604c3369",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        368
      ],
      "parameters": {
        "width": 560,
        "height": 624,
        "content": "## Output\n- Build a result report (as mail body) with:\n-- the initial query\n-- the Chairman verdict \n-- the Ranking\n-- the individual model answers"
      }
    },
    {
      "id": "8e66ab1a-49c6-4f06-a344-5982824b6125",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        368
      ],
      "parameters": {
        "width": 992,
        "height": 624,
        "content": "## How it works:\nThis workflow is inspired by a vibe coding project of Andrej Karpathy: https://github.com/karpathy/llm-council .\nThe LLM Council serves as a moderation board to synthesize different L"
      }
    },
    {
      "id": "9ed93ba9-221e-40e0-8c03-5a6b33051eee",
      "name": "Stage 3: Chairman Synthesis",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1616,
        672
      ]
    },
    {
      "id": "91f0f387-f9d5-4e46-a70b-202f9c17df0e",
      "name": "Stage 1: Extract Responses",
      "type": "n8n-nodes-base.set",
      "position": [
        704,
        0
      ]
    },
    {
      "id": "2e37b91f-b4da-4976-842c-e8e223242b36",
      "name": "Stage 1: Aggregate Responses",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        848,
        0
      ]
    },
    {
      "id": "39f7355c-db9c-437a-8037-a8700515aa37",
      "name": "Stage 2: Create Anonymized Responses",
      "type": "n8n-nodes-base.set",
      "position": [
        1040,
        0
      ]
    },
    {
      "id": "06fd85e8-2ff1-4bb6-9110-8666d1568fb5",
      "name": "Stage 2: Build Ranking Prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        1232,
        0
      ]
    },
    {
      "id": "28fd25b9-b44f-4617-99aa-4947d449cc0b",
      "name": "Stage 2: Re-Add councilModels",
      "type": "n8n-nodes-base.set",
      "position": [
        1408,
        0
      ]
    },
    {
      "id": "99a510c0-64b2-49b2-93ac-a28a3836ddfb",
      "name": "Stage 2: rankingPrompt per LLM",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1584,
        0
      ]
    },
    {
      "id": "ba8e9264-c6a3-474d-af2b-73e10db73a4e",
      "name": "Stage 2: Extract Rankings",
      "type": "n8n-nodes-base.set",
      "position": [
        1936,
        0
      ]
    },
    {
      "id": "f7abd792-9809-4b5a-bc53-4186f63b28be",
      "name": "Stage 3: Build ChairmanPrompt Part 1",
      "type": "n8n-nodes-base.set",
      "position": [
        1264,
        672
      ]
    },
    {
      "id": "0566f6cf-1c1a-41ff-9dee-27387305c98c",
      "name": "Stage 3: Build Chairman Prompt Part 2",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        672
      ]
    },
    {
      "id": "cdaa1b7e-2d8d-4610-9d4e-0f366286401a",
      "name": "Stage 4: Format Output Part 1",
      "type": "n8n-nodes-base.set",
      "position": [
        1792,
        672
      ]
    },
    {
      "id": "8891adea-9665-4813-8068-564b873c8138",
      "name": "Stage 4: Format Output Part 2",
      "type": "n8n-nodes-base.set",
      "position": [
        1984,
        672
      ]
    },
    {
      "id": "05670818-5ce9-4f61-8cde-4c2b2e41abf5",
      "name": "Stage 4: Send Result per Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        2176,
        672
      ]
    },
    {
      "id": "4d1c1bb1-655f-427e-89fc-dddc7cc19bf6",
      "name": "Stage 2: Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2112,
        0
      ]
    },
    {
      "id": "be8a9bc5-b8d6-4ea2-8470-8f648727bed6",
      "name": "Stage 3: Calculate Aggregate Rankings",
      "type": "n8n-nodes-base.code",
      "position": [
        1088,
        672
      ]
    }
  ],
  "connections": {
    "Split by Model": {
      "main": [
        [
          {
            "node": "Stage 1: Query Model Answers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 2: Aggregate": {
      "main": [
        [
          {
            "node": "Stage 3: Calculate Aggregate Rankings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialize Variables": {
      "main": [
        [
          {
            "node": "Split by Model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 2: Extract Rankings": {
      "main": [
        [
          {
            "node": "Stage 2: Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 1: Extract Responses": {
      "main": [
        [
          {
            "node": "Stage 1: Aggregate Responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Initialize Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 3: Chairman Synthesis": {
      "main": [
        [
          {
            "node": "Stage 4: Format Output Part 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 1: Aggregate Responses": {
      "main": [
        [
          {
            "node": "Stage 2: Create Anonymized Responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 1: Query Model Answers": {
      "main": [
        [
          {
            "node": "Stage 1: Extract Responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 2: Build Ranking Prompt": {
      "main": [
        [
          {
            "node": "Stage 2: Re-Add councilModels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 2: Re-Add councilModels": {
      "main": [
        [
          {
            "node": "Stage 2: rankingPrompt per LLM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 4: Format Output Part 1": {
      "main": [
        [
          {
            "node": "Stage 4: Format Output Part 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 4: Format Output Part 2": {
      "main": [
        [
          {
            "node": "Stage 4: Send Result per Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 2: rankingPrompt per LLM": {
      "main": [
        [
          {
            "node": "Stage 2: Query Model Answer Rankings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 2: Create Anonymized Responses": {
      "main": [
        [
          {
            "node": "Stage 2: Build Ranking Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 2: Query Model Answer Rankings": {
      "main": [
        [
          {
            "node": "Stage 2: Extract Rankings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 3: Build ChairmanPrompt Part 1": {
      "main": [
        [
          {
            "node": "Stage 3: Build Chairman Prompt Part 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 3: Build Chairman Prompt Part 2": {
      "main": [
        [
          {
            "node": "Stage 3: Chairman Synthesis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 3: Calculate Aggregate Rankings": {
      "main": [
        [
          {
            "node": "Stage 3: Build ChairmanPrompt Part 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}