{
  "name": "Evaluation metric example: String similarity",
  "nodes": [
    {
      "id": "b2a1a367-119f-4e2d-a982-ff675debf658",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        -40
      ],
      "parameters": {
        "width": 180,
        "height": 260,
        "content": "Check how far apart the actual code is from the expected code (a score of 1 is a perfect match)"
      }
    },
    {
      "id": "f5413855-20de-4b77-ba90-18610a9d9b4d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1300,
        40
      ],
      "parameters": {
        "width": 300,
        "height": 500,
        "content": "## How it works\nThis template shows how to calculate a workflow evaluation metric: **text similarity, measured character-by-character**.\n\nThe workflow takes images of hand-written codes, extracts the "
      }
    },
    {
      "id": "8921a4c4-cee1-44e7-8dce-55219db519d7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        280
      ],
      "parameters": {
        "width": 220,
        "height": 220,
        "content": "Read in [this test dataset](https://docs.google.com/spreadsheets/d/1uuPS5cHtSNZ6HNLOi75A2m8nVWZrdBZ_Ivf58osDAS8/edit?gid=1786963566#gid=1786963566) of images"
      }
    },
    {
      "id": "fbf8337b-eb46-443a-8507-58a14b817be0",
      "name": "Match webhook format",
      "type": "n8n-nodes-base.set",
      "position": [
        -680,
        340
      ]
    },
    {
      "id": "a03c9b79-d45d-4842-9325-df1af37697eb",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -900,
        40
      ]
    },
    {
      "id": "85bd63e2-3039-4f0e-8721-bc2b843461c9",
      "name": "When fetching a dataset row",
      "type": "n8n-nodes-base.evaluationTrigger",
      "position": [
        -900,
        340
      ]
    },
    {
      "id": "4ed0b460-70af-4f1d-a7f3-97293f9b4ce0",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        260,
        320
      ]
    },
    {
      "id": "f1642aa1-94c5-4002-a7aa-533566dd20eb",
      "name": "Evaluating?",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        -20,
        200
      ]
    },
    {
      "id": "15115588-b9ca-4e24-b7d8-f0aa0974b5dd",
      "name": "Set metrics",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        480,
        80
      ]
    },
    {
      "id": "af028132-c866-487d-be85-e3af049bc793",
      "name": "Extract code from image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -240,
        200
      ]
    },
    {
      "id": "50a26635-078f-40a7-8944-2e43ed8cd482",
      "name": "Calc string distance",
      "type": "n8n-nodes-base.code",
      "position": [
        260,
        80
      ]
    },
    {
      "id": "383db4b0-9665-4608-bbf9-3dca88508bff",
      "name": "Download image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -460,
        200
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Download image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluating?": {
      "main": [
        [
          {
            "node": "Calc string distance",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download image": {
      "main": [
        [
          {
            "node": "Extract code from image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calc string distance": {
      "main": [
        [
          {
            "node": "Set metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Match webhook format": {
      "main": [
        [
          {
            "node": "Download image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract code from image": {
      "main": [
        [
          {
            "node": "Evaluating?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When fetching a dataset row": {
      "main": [
        [
          {
            "node": "Match webhook format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}