8
n8n 한국어amn8n.com

평가 지표:답변 유사도

고급

이것은Engineering, AI분야의자동화 워크플로우로, 21개의 노드를 포함합니다.주로 Set, Code, Merge, SplitOut, Aggregate 등의 노드를 사용하며인공지능 기술을 결합하여 스마트 자동화를 구현합니다. 평가 지표: 답변 유사도

사전 요구사항
  • 대상 API의 인증 정보가 필요할 수 있음
  • OpenAI API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "meta": {
    "instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9"
  },
  "nodes": [
    {
      "id": "c5365531-2d66-4e67-9db2-37059e9e97a3",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1512,
        420
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3881b831-b575-4b2f-8ebb-ac956a714f10",
      "name": "데이터셋 행 가져오기 시",
      "type": "n8n-nodes-base.evaluationTrigger",
      "position": [
        -2040,
        100
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1176192270,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YOnu2JJjlxd787AuYcg-wKbkjyjyZFgASYVV0jsij5Y/edit#gid=1176192270",
          "cachedResultName": "Similarity"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1YOnu2JJjlxd787AuYcg-wKbkjyjyZFgASYVV0jsij5Y",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YOnu2JJjlxd787AuYcg-wKbkjyjyZFgASYVV0jsij5Y/edit?usp=drivesdk",
          "cachedResultName": "96. Evaluations Test"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "XHvC7jIRR8A2TlUl",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "dd5a14f7-7321-4dfd-9f08-1f35efba1a07",
      "name": "입력 재매핑",
      "type": "n8n-nodes-base.set",
      "position": [
        -1820,
        100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "00924b90-278f-49f5-80f2-c297df0fcc97",
              "name": "chatInput",
              "type": "string",
              "value": "={{ $json.input }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "78d87631-7d52-4fbb-9313-f47263bd101f",
      "name": "평가",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        -1180,
        200
      ],
      "parameters": {
        "operation": "checkIfEvaluating"
      },
      "typeVersion": 4.6
    },
    {
      "id": "1d8b12ba-ec63-4f92-a4dc-1885cbcd4d95",
      "name": "입력 필드 설정",
      "type": "n8n-nodes-base.set",
      "position": [
        -960,
        100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d58952c1-d346-4fbf-881e-d5c04b6781a5",
              "name": "question",
              "type": "string",
              "value": "={{ $('When fetching a dataset row').first().json.input }}"
            },
            {
              "id": "0f10a3d0-cf6e-4715-9ded-2cee54aa62ec",
              "name": "answer",
              "type": "string",
              "value": "={{ $json.output }}"
            },
            {
              "id": "edbe42ed-36a7-438a-989f-900673e61d0f",
              "name": "groundTruth",
              "type": "array",
              "value": "={{ $('When fetching a dataset row').first().json['ground truth'].split('\\n') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "518cecea-9bcc-47dd-83b1-73ef0880e808",
      "name": "작업 없음, 아무것도 하지 않음",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -960,
        300
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c1a9cf2f-8e5d-4db9-a29b-b426e1932ab3",
      "name": "AI 에이전트",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1600,
        200
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "6c5602d1-59c0-479e-b9aa-fb8ce037d4b1",
      "name": "채팅 메시지 수신 시",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1820,
        300
      ],
      "webhookId": "ba1fadeb-b566-469a-97b3-3159a99f1805",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "6fb01095-7b93-41dd-8d7c-364cb685ddbb",
      "name": "출력 업데이트",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        520,
        300
      ],
      "parameters": {
        "outputs": {
          "values": [
            {
              "outputName": "output",
              "outputValue": "={{ $('Set Input Fields').item.json.answer }}"
            },
            {
              "outputName": "score",
              "outputValue": "={{ $json.score }}"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1176192270,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YOnu2JJjlxd787AuYcg-wKbkjyjyZFgASYVV0jsij5Y/edit#gid=1176192270",
          "cachedResultName": "Similarity"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1YOnu2JJjlxd787AuYcg-wKbkjyjyZFgASYVV0jsij5Y",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YOnu2JJjlxd787AuYcg-wKbkjyjyZFgASYVV0jsij5Y/edit?usp=drivesdk",
          "cachedResultName": "96. Evaluations Test"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "XHvC7jIRR8A2TlUl",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "18e8dbb6-df98-4d36-9686-9ec481a37754",
      "name": "메트릭 업데이트",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        700,
        300
      ],
      "parameters": {
        "metrics": {
          "assignments": [
            {
              "id": "1fd7759c-f4ef-4eda-87ad-9d9563b63e99",
              "name": "score",
              "type": "number",
              "value": "={{ $json.score }}"
            }
          ]
        },
        "operation": "setMetrics"
      },
      "typeVersion": 4.6
    },
    {
      "id": "a685c9e7-0b21-4873-a502-5826a916e31f",
      "name": "스티커 노트1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2120,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 840,
        "height": 720,
        "content": "## 1. 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&utm_campaign=n8n-nodes-base.evaluationTrigger)\n\nThe Evaluations Trigger is a separate execution which does not affect your production workflow in any way. It is manually triggered and automatically pulled datasets from the assigned Google Sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "2e57d911-8fef-456d-8e5c-3849350553e1",
      "name": "스티커 노트",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1240,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 1700,
        "height": 720,
        "content": "## 2. Answer Similarity: How similar is the AI response to the Ground Truth?\n[Learn more about the Evaluations Trigger](https://docs.n8n.io/integrations/builtin/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.evaluationTrigger)\n\nFor this evaluation, we want to do a simple check to see how similar the AI's response is to the ground truth.\nThis test is most effective for closed-ended questions where there can be little to no deviation in the answers. "
      },
      "typeVersion": 1
    },
    {
      "id": "9962bbf8-01bc-463c-ad3b-499618c5b1f9",
      "name": "스티커 노트3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2580,
        -120
      ],
      "parameters": {
        "width": 420,
        "height": 720,
        "content": "## Try It Out!\n### This n8n template demonstrates how to calculate the evaluation metric \"Similarity\" which in this scenario, measures the consistency of the agent.\n\nThe scoring approach is adapted from [https://github.com/explodinggradients/ragas/blob/main/ragas/src/ragas/metrics/_answer_similarity.py](https://github.com/explodinggradients/ragas/blob/main/ragas/src/ragas/metrics/_answer_similarity.py)\n\n### How it works\n* This evaluation works best where questions are close-ended or about facts where the answer can have little to no deviation.\n* For our scoring, we generate embeddings for both the AI's response and ground truth and calculate the cosine similarity between them.\n* A high score indicates LLM consistency with expected results whereas a low score could signal model hallucination.\n\n### Requirements\n* n8n version 1.94+\n* Check out this Google Sheet for a sample data [https://docs.google.com/spreadsheets/d/1YOnu2JJjlxd787AuYcg-wKbkjyjyZFgASYVV0jsij5Y/edit?usp=sharing](https://docs.google.com/spreadsheets/d/1YOnu2JJjlxd787AuYcg-wKbkjyjyZFgASYVV0jsij5Y/edit?usp=sharing)\n\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Hacking!"
      },
      "typeVersion": 1
    },
    {
      "id": "47699677-545f-4eca-8b46-89c6862a56f1",
      "name": "임베딩 가져오기",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -520,
        300
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/embeddings",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "input",
              "value": "={{ $json.groundTruth }}"
            },
            {
              "name": "model",
              "value": "text-embedding-3-small"
            },
            {
              "name": "encoding_format",
              "value": "float"
            }
          ]
        },
        "nodeCredentialType": "openAiApi"
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1a022046-80f2-4df3-b075-be8e9294b951",
      "name": "GroundTruth를 항목으로 변환",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -720,
        300
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "groundTruth"
      },
      "typeVersion": 1
    },
    {
      "id": "0cea3a79-23ab-4d0f-9c6c-2522af6a506f",
      "name": "임베딩 가져오기1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -520,
        100
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/embeddings",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "input",
              "value": "={{ $json.answer }}"
            },
            {
              "name": "model",
              "value": "text-embedding-3-small"
            },
            {
              "name": "encoding_format",
              "value": "float"
            }
          ]
        },
        "nodeCredentialType": "openAiApi"
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1b5740cc-4b79-4690-88ae-fa31c5a1c16c",
      "name": "집계",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -120,
        300
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "groundTruth"
      },
      "typeVersion": 1
    },
    {
      "id": "d32f979b-7d96-4730-8324-de0d34ed659a",
      "name": "임베딩 재매핑",
      "type": "n8n-nodes-base.set",
      "position": [
        -320,
        100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3db07c98-f926-46e0-85f2-ed1eb137f842",
              "name": "answer",
              "type": "array",
              "value": "={{ $json.data[0].embedding }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "188864fb-3d6a-4c01-9d23-73c731de023d",
      "name": "임베딩 재매핑1",
      "type": "n8n-nodes-base.set",
      "position": [
        -320,
        300
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3db07c98-f926-46e0-85f2-ed1eb137f842",
              "name": "data",
              "type": "array",
              "value": "={{ $json.data[0].embedding }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5cc6c1c7-240b-4129-b57a-e7d0ef2e72e6",
      "name": "임베딩 결과 생성",
      "type": "n8n-nodes-base.merge",
      "position": [
        80,
        300
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.1
    },
    {
      "id": "7aa037d2-31a6-4efe-81b1-26a95c4c6d38",
      "name": "유사도 점수 계산",
      "type": "n8n-nodes-base.code",
      "position": [
        280,
        300
      ],
      "parameters": {
        "jsCode": "const { answer, groundTruth = [] } = $input.item.json;\n\nconst scores = await Promise.all(groundTruth.map(truth =>\n  cosineSimilarity(answer, truth.data)\n));\n\nconst averageScore = scores.reduce((acc,i) => acc + i, 0) / scores.length;\n\nreturn { json: { score: averageScore } };\n\nfunction cosineSimilarity(a, b) {  \n  let dotProduct = normA = normB = 0;\n  for (let i = 0; i < a.length; i++) {\n    dotProduct += a[i] * b[i];\n    normA += a[i] ** 2;\n    normB += b[i] ** 2;\n  }\n  return dotProduct / (Math.sqrt(normA) * Math.sqrt(normB));\n}"
      },
      "typeVersion": 2
    }
  ],
  "pinData": {},
  "connections": {
    "c1a9cf2f-8e5d-4db9-a29b-b426e1932ab3": {
      "main": [
        [
          {
            "node": "78d87631-7d52-4fbb-9313-f47263bd101f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1b5740cc-4b79-4690-88ae-fa31c5a1c16c": {
      "main": [
        [
          {
            "node": "5cc6c1c7-240b-4129-b57a-e7d0ef2e72e6",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "78d87631-7d52-4fbb-9313-f47263bd101f": {
      "main": [
        [
          {
            "node": "1d8b12ba-ec63-4f92-a4dc-1885cbcd4d95",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "518cecea-9bcc-47dd-83b1-73ef0880e808",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dd5a14f7-7321-4dfd-9f08-1f35efba1a07": {
      "main": [
        [
          {
            "node": "c1a9cf2f-8e5d-4db9-a29b-b426e1932ab3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6fb01095-7b93-41dd-8d7c-364cb685ddbb": {
      "main": [
        [
          {
            "node": "18e8dbb6-df98-4d36-9686-9ec481a37754",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "47699677-545f-4eca-8b46-89c6862a56f1": {
      "main": [
        [
          {
            "node": "188864fb-3d6a-4c01-9d23-73c731de023d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0cea3a79-23ab-4d0f-9c6c-2522af6a506f": {
      "main": [
        [
          {
            "node": "d32f979b-7d96-4730-8324-de0d34ed659a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d32f979b-7d96-4730-8324-de0d34ed659a": {
      "main": [
        [
          {
            "node": "5cc6c1c7-240b-4129-b57a-e7d0ef2e72e6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1d8b12ba-ec63-4f92-a4dc-1885cbcd4d95": {
      "main": [
        [
          {
            "node": "0cea3a79-23ab-4d0f-9c6c-2522af6a506f",
            "type": "main",
            "index": 0
          },
          {
            "node": "1a022046-80f2-4df3-b075-be8e9294b951",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "188864fb-3d6a-4c01-9d23-73c731de023d": {
      "main": [
        [
          {
            "node": "1b5740cc-4b79-4690-88ae-fa31c5a1c16c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c5365531-2d66-4e67-9db2-37059e9e97a3": {
      "ai_languageModel": [
        [
          {
            "node": "c1a9cf2f-8e5d-4db9-a29b-b426e1932ab3",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "1a022046-80f2-4df3-b075-be8e9294b951": {
      "main": [
        [
          {
            "node": "47699677-545f-4eca-8b46-89c6862a56f1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5cc6c1c7-240b-4129-b57a-e7d0ef2e72e6": {
      "main": [
        [
          {
            "node": "7aa037d2-31a6-4efe-81b1-26a95c4c6d38",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7aa037d2-31a6-4efe-81b1-26a95c4c6d38": {
      "main": [
        [
          {
            "node": "6fb01095-7b93-41dd-8d7c-364cb685ddbb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6c5602d1-59c0-479e-b9aa-fb8ce037d4b1": {
      "main": [
        [
          {
            "node": "c1a9cf2f-8e5d-4db9-a29b-b426e1932ab3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3881b831-b575-4b2f-8ebb-ac956a714f10": {
      "main": [
        [
          {
            "node": "dd5a14f7-7321-4dfd-9f08-1f35efba1a07",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

고급 - 엔지니어링, 인공지능

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
고급
노드 수21
카테고리2
노드 유형13
난이도 설명

고급 사용자를 위한 16+개 노드의 복잡한 워크플로우

저자
Jimleuk

Jimleuk

@jimleuk

Freelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at hello@jimle.uk LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34