{
  "name": "Evaluate RAG response accuracy with OpenAI: document groundedness metric",
  "nodes": [
    {
      "id": "976ded9c-2080-484e-ad64-eb3c6e671961",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -760,
        -320
      ]
    },
    {
      "id": "348dfa43-be32-48a8-a9e1-a0641852517e",
      "name": "Get Datasheet",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -540,
        -320
      ]
    },
    {
      "id": "e4854cab-8bc9-4e63-911f-a9a4f5993855",
      "name": "Simple Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        -300,
        -320
      ]
    },
    {
      "id": "f69492e2-c85a-451c-9e02-f5902f214da6",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -320,
        -100
      ]
    },
    {
      "id": "65131cfb-ac44-48fa-a648-033c0611e8ea",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        -200,
        -100
      ]
    },
    {
      "id": "0800667d-7b33-4c8b-bc61-d12ccf94a640",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        -120,
        100
      ]
    },
    {
      "id": "04a8a558-07cf-41f4-85a9-37e79be90b52",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -300,
        620
      ]
    },
    {
      "id": "6f6961f7-73c3-4e16-942e-e2da096fec94",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -320,
        845
      ]
    },
    {
      "id": "a063f080-9227-471f-8330-3da574e275d1",
      "name": "Simple Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        -200,
        847.5
      ]
    },
    {
      "id": "85584b59-0970-4bd9-ac96-f31a0046f20e",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -120,
        980
      ]
    },
    {
      "id": "a99b3732-f8ac-45d3-a2f5-7a1177dc5742",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -540,
        725
      ]
    },
    {
      "id": "c21ee596-bc9c-4bb3-8cac-f243a2d5102b",
      "name": "Evaluation",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        240,
        620
      ]
    },
    {
      "id": "64104870-1796-4fcc-8c0d-cc4302de5167",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        460,
        720
      ]
    },
    {
      "id": "91e0a42e-6afc-463b-8f25-7117b057159d",
      "name": "Get Documents",
      "type": "n8n-nodes-base.set",
      "position": [
        460,
        480
      ]
    },
    {
      "id": "8fba17b7-c24b-4a26-a998-e3d2f7acc481",
      "name": "When fetching a dataset row",
      "type": "n8n-nodes-base.evaluationTrigger",
      "position": [
        -760,
        525
      ]
    },
    {
      "id": "611a6e12-f52b-4b3c-b74c-238a4f75f612",
      "name": "Remap Input",
      "type": "n8n-nodes-base.set",
      "position": [
        -540,
        525
      ]
    },
    {
      "id": "0c1e25b8-9145-443e-8c9f-34eb62aa7192",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        660,
        660
      ]
    },
    {
      "id": "a9d8a911-9519-4497-9127-0a2e3da9ae1b",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        860,
        660
      ]
    },
    {
      "id": "038f408d-51f0-4625-b39d-e326f24850b4",
      "name": "Document Grounding",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        660,
        480
      ]
    },
    {
      "id": "e867ed3e-df63-40e2-a3f6-0d19bbace13a",
      "name": "Set Outputs",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        1020,
        480
      ]
    },
    {
      "id": "7350d6c6-1a9d-4663-b509-de1c9d73588a",
      "name": "Set Metrics",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        1220,
        480
      ]
    },
    {
      "id": "e5313dae-6eff-4b71-83b1-0c89ff319662",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -840,
        -500
      ],
      "parameters": {
        "width": 960,
        "height": 780,
        "content": "## 1. Ready your RAG Vector Store\n[Read more about the Simple Vector Store](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreinmemory/)\n\nFor this exerci"
      }
    },
    {
      "id": "36da4904-2256-4d4a-9a1d-17ad3af939d4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -840,
        300
      ],
      "parameters": {
        "width": 960,
        "height": 900,
        "content": "## 2. Setup Your AI Workflow to Use Evaluations\n[Learn more about the Evaluations Trigger](https://docs.n8n.io/integrations/builtin/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&u"
      }
    },
    {
      "id": "d892b15f-126d-4fac-8458-167a9f4bf1b1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        300
      ],
      "parameters": {
        "width": 1260,
        "height": 640,
        "content": "## 3. Document Groundedness: Is the AI response based on the retrieved documents?\n[Learn more about the Evaluations Node](https://docs.n8n.io/integrations/builtin/?utm_source=n8n_app&utm_medium=node_s"
      }
    },
    {
      "id": "c500b17e-0c27-4121-9f89-40531b83f48e",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        -500
      ],
      "parameters": {
        "width": 380,
        "height": 880,
        "content": "## Try It Out!\n### This n8n template demonstrates how to calculate the evaluation metric \"RAG document groundedness\" which in this scenario, measures the ability to provide or reference information in"
      }
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Evaluation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluation": {
      "main": [
        [
          {
            "node": "Get Documents",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remap Input": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Outputs": {
      "main": [
        [
          {
            "node": "Set Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Datasheet": {
      "main": [
        [
          {
            "node": "Simple Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Documents": {
      "main": [
        [
          {
            "node": "Document Grounding",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Simple Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Document Grounding": {
      "main": [
        [
          {
            "node": "Set Outputs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Simple Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Document Grounding",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Simple Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Simple Vector Store": {
      "main": [
        []
      ]
    },
    "Simple Vector Store1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Document Grounding",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When fetching a dataset row": {
      "main": [
        [
          {
            "node": "Remap Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get Datasheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}