8
n8n 中文网amn8n.com

使用GPT-4、维基百科和向量数据库构建全面实体档案

高级

这是一个Document Extraction, AI RAG领域的自动化工作流,包含 33 个节点。主要使用 If, Set, Merge, ManualTrigger, Agent 等节点。 使用GPT-4、维基百科和向量数据库为内容构建全面实体档案

前置要求
  • OpenAI API Key
  • Qdrant 服务器连接信息
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "6fb6c9a50faeb88c76c44b2fdb3a06e4272886afd55ba8d161b7b55a4373c282",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "8b99d8c3-eb24-436a-8f64-2eca763ca38c",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -768,
        876
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bd998532-090f-4ec3-b3a8-c942dbd4d77c",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -768,
        684
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "entity"
            },
            {
              "name": "topic"
            },
            {
              "name": "audience"
            },
            {
              "name": "purpose"
            },
            {
              "name": "execution_id",
              "type": "number"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "12f3159a-6df5-4603-a9b0-5c742319e6da",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        256,
        1004
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "o4-mini",
          "cachedResultName": "o4-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "Y8ZxcY3KmZ6Zqrd2",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e5ece6f2-9476-459d-a153-9c27aa0d6a9b",
      "name": "OpenAI Chat Model4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1368,
        880
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "o4-mini",
          "cachedResultName": "o4-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "Y8ZxcY3KmZ6Zqrd2",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "45afcd19-cd43-47b0-b78b-8ecfda956359",
      "name": "Question Answered",
      "type": "n8n-nodes-base.if",
      "position": [
        1136,
        780
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6197485c-b2ec-4904-87a0-f52185e1305d",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.output.confidence }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "9ce6eceb-d170-4ee4-897f-426f9adbf48b",
      "name": "Wikipedia",
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "position": [
        384,
        1004
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "31f278bf-12b5-41ee-b200-a4f8e56796c9",
      "name": "Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
      "position": [
        2944,
        912
      ],
      "parameters": {
        "chunkSize": 10000
      },
      "typeVersion": 1
    },
    {
      "id": "0218c8e3-21ec-4584-b51c-ac47b2f85364",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        2864,
        704
      ],
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "entity_name",
                "value": "={{ $('Merge').item.json.output.entity_name.toLowerCase() }}"
              },
              {
                "name": "type",
                "value": "={{ $('Merge').item.json.output.type }}"
              },
              {
                "name": "definition",
                "value": "={{ $('Merge').item.json.output.definition }}"
              },
              {
                "name": "category",
                "value": "={{ $('Merge').item.json.output.category }}"
              },
              {
                "name": "relevance",
                "value": "={{ $('Merge').item.json.output.relevance }}"
              },
              {
                "name": "alternative_names",
                "value": "={{ $('Merge').item.json.output.alternative_names }}"
              },
              {
                "name": "example",
                "value": "={{ $('Merge').item.json.output.example }}"
              },
              {
                "name": "reference_link",
                "value": "={{ $('Merge').item.json.output.reference_link }}"
              },
              {
                "name": "misconceptions",
                "value": "={{ $('Merge').item.json.output.misconceptions }}"
              },
              {
                "name": "=related_entities",
                "value": "={{ $('Merge').item.json.output.related_entities }}"
              },
              {
                "name": "ai_model_used",
                "value": "={{ $('Merge').item.json.output.ai_model_used }}"
              },
              {
                "name": "confidence",
                "value": "={{ $('Merge').item.json.output.confidence }}"
              }
            ]
          }
        },
        "jsonData": "={{ $('Merge').item.json.output.entity_name.toLowerCase() }}",
        "jsonMode": "expressionData",
        "textSplittingMode": "custom"
      },
      "typeVersion": 1.1
    },
    {
      "id": "c95360a1-81f7-4bf9-81c9-bcac1d918ad1",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        3232,
        832
      ],
      "parameters": {
        "mode": "chooseBranch"
      },
      "typeVersion": 3.2
    },
    {
      "id": "43e0fc70-b7dc-4148-b3af-02af36ef4775",
      "name": "Researcher Internet",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        512,
        1004
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "hRo7kt0ghoXmEv4G",
          "cachedResultName": "Researcher: Internet"
        },
        "workflowInputs": {
          "value": {},
          "schema": [
            {
              "id": "query",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "query",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "query"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "013f6548-399d-43ad-a738-f280c0f3621a",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1936,
        780
      ],
      "parameters": {
        "mode": "chooseBranch",
        "useDataOfInput": 2
      },
      "typeVersion": 3.2
    },
    {
      "id": "d3c62700-d7d3-4152-a1eb-8fd4d5b7278d",
      "name": "Entity Search",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "onError": "continueRegularOutput",
      "position": [
        -320,
        780
      ],
      "parameters": {
        "mode": "load",
        "prompt": "={{ $json.entity.toLowerCase() }}",
        "options": {
          "searchFilterJson": "={\n  \"must\": [\n    {\n      \"key\": \"metadata.entity_name\",\n      \"match\": {\n        \"value\": \"{{ $json.entity.toLowerCase() }}\"\n      }\n    }\n  ]\n}"
        },
        "qdrantCollection": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.collection_name }}"
        }
      },
      "credentials": {
        "qdrantApi": {
          "id": "1rlzgQcdRysKi0oS",
          "name": "QdrantApi account"
        }
      },
      "typeVersion": 1.3,
      "alwaysOutputData": true
    },
    {
      "id": "db69e156-1c18-48a3-9178-9f8341a73bfc",
      "name": "Entity Search Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "position": [
        -248,
        1004
      ],
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "credentials": {
        "ollamaApi": {
          "id": "u58LNTOTwwLnJzt9",
          "name": "Ollama account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a28aeee2-3422-4455-a39a-84ebc0d57efd",
      "name": "Entity Search Successful",
      "type": "n8n-nodes-base.if",
      "onError": "continueRegularOutput",
      "position": [
        32,
        780
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d1f73505-50c0-4762-8f5a-3af4f8511a51",
              "operator": {
                "type": "object",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.document }}",
              "rightValue": "={{ $json.document }}"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": false
    },
    {
      "id": "f70fac9a-d478-42a0-a14b-5ff6cf864c57",
      "name": "Save Entity",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "onError": "continueRegularOutput",
      "position": [
        2768,
        480
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "qdrantCollection": {
          "__rl": true,
          "mode": "list",
          "value": "entities",
          "cachedResultName": "entities"
        },
        "embeddingBatchSize": 1
      },
      "credentials": {
        "qdrantApi": {
          "id": "1rlzgQcdRysKi0oS",
          "name": "QdrantApi account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "e1fd4754-75cb-4d44-bc7b-01d1eddfdb75",
      "name": "Entity Search 2",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "onError": "continueRegularOutput",
      "position": [
        2160,
        656
      ],
      "parameters": {
        "mode": "load",
        "prompt": "={{ $json.output.entity_name.toLowerCase() }}",
        "options": {
          "searchFilterJson": "{\n  \"must\": [\n    {\n      \"key\": \"metadata.entity_name\",\n      \"match\": {\n        \"value\": \"{{ $json.output.entity_name.toLowerCase() }}\"\n      }\n    }\n  ]\n}"
        },
        "qdrantCollection": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set Node').item.json.collection_name }}"
        }
      },
      "credentials": {
        "qdrantApi": {
          "id": "1rlzgQcdRysKi0oS",
          "name": "QdrantApi account"
        }
      },
      "typeVersion": 1.3,
      "alwaysOutputData": true
    },
    {
      "id": "5a6e8cd3-c68d-4f24-9f3d-d55a8a0a9267",
      "name": "Entity Defined",
      "type": "n8n-nodes-base.if",
      "position": [
        1712,
        656
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6197485c-b2ec-4904-87a0-f52185e1305d",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.output[\"is_complete\"] }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "85c800e2-a0da-42e9-aaf7-b2665aeb0969",
      "name": "Validate Entity",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "maxTries": 5,
      "position": [
        1360,
        656
      ],
      "parameters": {
        "text": "=entity_name: {{ $json.output.entity_name }}\ntype: {{ $json.output.type }}\ndefinition: {{ $json.output.definition }}\ncategory: {{ $json.output.category }}\nrelevance: {{ $json.output.relevance }}\nalternative_names: {{ $json.output.alternative_names }}\nexample: {{ $json.output.example }}\nreference_link: {{ $json.output.reference_link }}\nrelated entities: {{ $json.output.related_entities }}\nmisconceptions: {{ $json.output.misconceptions }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=You are an entity quality evaluator.\n\nYour job is to judge if an entity record is complete—that is, if it provides all key fields and gives a clear, direct, and accurate description of the entity for the intended business audience.\n\nScoring Rules:\n\t•\tMark as is_complete: true ONLY if all main fields are filled with relevant, plain-English information (not empty or obviously generic), and if the definition, type, category, and relevance are clear and correct for a non-technical business user.\n\t•\tMark as is_complete: false if any major field (definition, type, category, relevance, example, reference link) is missing, vague, off-topic, generic, or just restates the entity name.\n\t•\tAccept an empty array for alternative_names, misconceptions, or related_entities, but do not mark as complete if these fields are simply omitted (missing from the object).\n\t•\tIf you find factual mistakes, off-topic content, or AI hallucination, mark as incomplete and explain.\n\t•\tIf the entity is not explained in a way a typical business user could understand, mark as incomplete.\n\nResponse Format:\nReply with a valid JSON object, and nothing else:\n\n{ \"is_complete\": true/false, \"reason\": \"short explanation\" }\n\nDo not add any extra text, comments, or formatting outside the JSON."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.7,
      "waitBetweenTries": 500
    },
    {
      "id": "dcb79c8f-07ab-4690-ac10-c2aa7d0f08d9",
      "name": "Entity Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        2512,
        656
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d1f73505-50c0-4762-8f5a-3af4f8511a51",
              "operator": {
                "type": "object",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.document }}",
              "rightValue": "={{ $json.document }}"
            },
            {
              "id": "4cfb2390-5c31-4cae-bbe0-15a9310a5d5a",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "944e691a-6333-4382-8f96-2e85dd199c54",
      "name": "Entity Researcher",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        440,
        780
      ],
      "parameters": {
        "text": "=Entity Research Request:\n\nResearch and deliver a writer-ready entity profile for the following:\n\t•\tEntity: {{ $('Set Node').item.json.entity }}\n\t•\tContext/Topic: {{ $('Set Node').item.json.topic }}\n\t•\tAudience: {{ $('Set Node').item.json.audience }}\n\nInstructions:\nBuild a practical brief for our writing team. If you use any research tools (Wikipedia or Internet Researcher), always use only the entity name as your search/query term—not the context or audience.\nReturn only the required JSON object as output.\n",
        "options": {
          "systemMessage": "=You are an expert entity researcher.\nYour job is to deliver a complete, practical entity brief—ready for a writing team—using this information-gathering protocol:\n\nTool Use Protocol:\n\t1.\tStart with the vector database for all available details on the entity.\n\t2.\tIf needed, use Wikipedia to fill in missing details or clarify points.\nWhen querying Wikipedia, use only the entity name as your search term.\n\t3.\tIf essential information is still missing, use the Internet Researcher tool (up to two times).\nWhen using Internet Researcher, always use only the entity name as your query.\nIf after two queries information is still unavailable, leave those fields blank or as empty arrays.\n\t4.\tNever include any tool usage details, research path, or confidence scores in your output.\nOnly return the required JSON object.\n\nResearch priorities:\n\t•\tWrite in plain English for the target audience.\n\t•\tProvide real-world examples.\n\t•\tAddress common misconceptions when relevant.\n\t•\tBe concise but thorough—no padding.\n\nCritical Reminders:\n\t•\tIf information is unavailable after all tool steps, use empty arrays/strings.\n\t•\tNever include commentary, tool usage, or confidence scores.\n\t•\tDo not add markdown or extra explanation—JSON only.\n",
          "returnIntermediateSteps": false
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 2,
      "waitBetweenTries": 5000
    },
    {
      "id": "7e28cd46-869d-4433-acdc-57bc10da7935",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1760,
        144
      ],
      "parameters": {
        "width": 848,
        "height": 1056,
        "content": "### This n8n template demonstrates how to build an intelligent entity research system that automatically discovers, researches, and creates comprehensive profiles for business entities, concepts, and terms.\nPerfect for content teams, business analysts, compliance officers, or anyone who needs consistent, authoritative definitions and explanations of industry terms, products, technologies, or concepts!\n\n### How it works\n* **Smart Entity Discovery**: Before researching, the workflow checks your existing knowledge base to avoid duplicate work and build upon existing information.\n* **Multi-Source Research**: Uses a sophisticated AI agent that intelligently combines your vector database, Wikipedia, and live web research to gather comprehensive entity information.\n* **Structured Entity Profiles**: Creates consistent, business-ready entity profiles with definitions, categories, examples, misconceptions, and related entities - perfect for glossaries, training materials, or content reference.\n* **Quality Validation**: AI-powered validation ensures all entity profiles are complete, accurate, and suitable for business use before storage.\n* **Incremental Knowledge Building**: Each researched entity gets stored in your vector database, creating a growing knowledge base that improves over time.\n* **Duplicate Prevention**: Multi-stage checking prevents duplicate entities and unnecessary re-research, saving time and API costs.\n\n### How to use\n* **Simple Start**: Use the manual trigger with any entity like \"OAuth 2.0\", \"GDPR\", \"Machine Learning\", or \"API Gateway\"\n* **Workflow Integration**: Replace the manual trigger with form submissions, content management systems, or automated content pipelines\n* **Topic-Specific Research**: Provide topic and audience context to get tailored explanations (e.g., \"blockchain\" for \"IT managers\" vs \"general audience\")\n* **Batch Processing**: Process multiple entities at once for building comprehensive glossaries or knowledge bases\n\n### Requirements\n* **OpenAI API** - For o4-mini (entity research and validation)\n* **Anthropic API** - For Claude Sonnet 4 (quality validation and completeness checking)\n* **Qdrant Vector Database** - For entity storage and duplicate detection\n* **Ollama** - For local embeddings (nomic-embed-text model)\n* **Wikipedia Access** - For foundational research (built-in to n8n)\n* **Internet Research Tool** - Optional connection to web research workflow for current information\n\n### Configuration Notes\n⚠️ **Database Collections**: Ensure Qdrant collection \"entities\" exists and is properly configured\n⚠️ **Environment**: Update localhost URLs to your actual Qdrant instance address\n⚠️ **API Limits**: Monitor usage as each entity research can use 2-5 API calls depending on complexity\n\n### Perfect for\n* **Content Teams**: Building consistent entity definitions for articles and documentation\n* **Business Analysts**: Creating standardized definitions for business processes and technologies\n* **Training Departments**: Developing comprehensive glossaries for employee education\n* **Compliance Teams**: Maintaining up-to-date definitions of regulatory terms and concepts\n* **Product Teams**: Creating clear explanations of features, technologies, and industry concepts\n* **Knowledge Management**: Building searchable databases of business-critical concepts\n"
      },
      "typeVersion": 1
    },
    {
      "id": "688c507f-bc3b-42ee-9cbd-22f77031e3ca",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        608
      ],
      "parameters": {
        "width": 528,
        "height": 144,
        "content": "## Smart Entity Lookup\nThis checks if the entity has already been researched before. If it finds existing information, it skips the research and uses what's already available. If nothing is found, the workflow continues to research the entity from scratch."
      },
      "typeVersion": 1
    },
    {
      "id": "63efd98f-9b03-4fb9-94f4-66331f4e1a98",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        592
      ],
      "parameters": {
        "width": 592,
        "height": 176,
        "content": "## AI Research Agent\n\nThis is the core research engine that creates comprehensive entity profiles using multiple information sources. The AI agent automatically searches your knowledge database first, then uses Wikipedia and web research as needed to build complete entity definitions with examples, misconceptions, and related terms."
      },
      "typeVersion": 1
    },
    {
      "id": "ac41348b-f548-42cc-92b9-ad958d3a5314",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        448
      ],
      "parameters": {
        "width": 416,
        "height": 176,
        "content": "## Quality Control Validator\n\nChecks if the researched entity profile is complete and accurate before saving it. The AI validator ensures all validates fields are filled with meaningful information and that the definition is clear enough for business users to understand."
      },
      "typeVersion": 1
    },
    {
      "id": "75815fc7-3dc6-4008-a604-03e080fc4740",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2336,
        448
      ],
      "parameters": {
        "width": 400,
        "height": 176,
        "content": "## Final Duplicate Check\n\nThis performs a second search to see if the newly researched entity already exists in the database before saving it. It prevents creating duplicate entries when similar entities might have been found during the research process."
      },
      "typeVersion": 1
    },
    {
      "id": "fdd41059-8c96-40b9-9cb0-3f30c0da35d1",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2816,
        272
      ],
      "parameters": {
        "width": 400,
        "height": 176,
        "content": "## Entity Storage\n\nThis saves the validated entity profile to the knowledge database for future use. It packages all the entity information (definition, examples, related terms, etc.) and stores it in a searchable format so it can be found and reused later."
      },
      "typeVersion": 1
    },
    {
      "id": "cd787fbd-d7f6-411a-bd98-af776eeb94b3",
      "name": "Set Node",
      "type": "n8n-nodes-base.set",
      "position": [
        -544,
        780
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5833b571-4261-4775-abd7-2f2fb9fbb015",
              "name": "entity",
              "type": "string",
              "value": "={{ $json.entity }}"
            },
            {
              "id": "21a70173-fb72-4c98-a9ac-566e5cc0e3be",
              "name": "topic",
              "type": "string",
              "value": "={{ $json.topic }}"
            },
            {
              "id": "eec9aea6-b681-4656-bd14-c68456f5c2d9",
              "name": "audience",
              "type": "string",
              "value": "={{ $json.audience }}"
            },
            {
              "id": "bd6b2273-a10e-42cc-a834-f141c360fbd6",
              "name": "purpose",
              "type": "string",
              "value": "={{ $json.purpose }}"
            },
            {
              "id": "05dae7d9-fff6-44a2-a2a2-cd3426c08021",
              "name": "execution_id",
              "type": "string",
              "value": "={{ $json.execution_id }}"
            },
            {
              "id": "ea6e7b26-e236-426b-879e-fb8c82d79809",
              "name": "collection_name",
              "type": "string",
              "value": "entities"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0eb308dc-5756-488e-a941-c2c51b87e08b",
      "name": "Entity Search 1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        640,
        1004
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "options": {},
        "toolDescription": "Search for entity details",
        "qdrantCollection": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set Node').item.json.collection_name }}"
        }
      },
      "credentials": {
        "qdrantApi": {
          "id": "1rlzgQcdRysKi0oS",
          "name": "QdrantApi account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "f1d39f85-4e48-43c6-ab33-9c30517a5c3e",
      "name": "Entity Search Embeddings 1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "position": [
        720,
        1212
      ],
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "credentials": {
        "ollamaApi": {
          "id": "u58LNTOTwwLnJzt9",
          "name": "Ollama account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0353855d-d641-4bec-97cc-c8e53be5d9b6",
      "name": "Entity Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        928,
        1004
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"can_answer\": true,\n  \"entity_name\": \"Gmail\",\n  \"type\": \"Product\",\n  \"definition\": \"Gmail is Google's cloud-based email service for personal and business use, offering web and mobile access.\",\n  \"category\": \"Software\",\n  \"relevance\": \"Gmail is widely used and is a frequent target for cybersecurity threats.\",\n  \"alternative_names\": [\"Google Mail\"],\n  \"example\": \"A user receives a phishing attempt in their Gmail inbox.\",\n  \"reference_link\": \"https://mail.google.com/\",\n  \"misconceptions\": [\"Gmail accounts cannot be compromised.\", \"Only paid Gmail accounts are secure.\"],\n  \"related_entities\": [\"Google Workspace\", \"Two-Factor Authentication (2FA)\", \"Phishing Prevention\"],\n  \"ai_model_used\": \"04-mini\",\n  \"confidence\": 0.97\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "b9161937-611c-46d5-b372-1a6f0186b637",
      "name": "Validation Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1496,
        880
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"is_complete\": true,\n\t\"reason\": \"The answer clearly and directly states California’s location and borders, fully addressing the question.\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a084c458-9089-41eb-8017-5523891e159f",
      "name": "Entity Search Embeddings 2",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "position": [
        2232,
        880
      ],
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "credentials": {
        "ollamaApi": {
          "id": "u58LNTOTwwLnJzt9",
          "name": "Ollama account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "26684a88-c3d6-407f-af17-b54a25ca5da8",
      "name": "Entity Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "position": [
        2736,
        704
      ],
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "credentials": {
        "ollamaApi": {
          "id": "u58LNTOTwwLnJzt9",
          "name": "Ollama account"
        }
      },
      "typeVersion": 1
    }
  ],
  "pinData": {
    "When clicking ‘Execute workflow’": [
      {
        "topic": "",
        "entity": "Darth Vader",
        "purpose": "",
        "audience": "",
        "execution_id": 1
      }
    ]
  },
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Entity Search 2",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Node": {
      "main": [
        [
          {
            "node": "Entity Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia": {
      "ai_tool": [
        [
          {
            "node": "Entity Researcher",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Save Entity": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Entity Exists": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Save Entity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Entity Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Entity Researcher",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Entity Search": {
      "main": [
        [
          {
            "node": "Entity Search Successful",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Entity Defined": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Entity Search 1": {
      "ai_tool": [
        [
          {
            "node": "Entity Researcher",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Entity Search 2": {
      "main": [
        [
          {
            "node": "Entity Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Entity": {
      "main": [
        [
          {
            "node": "Entity Defined",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Entity Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Save Entity",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Entity Researcher": {
      "main": [
        [
          {
            "node": "Question Answered",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Question Answered": {
      "main": [
        [
          {
            "node": "Validate Entity",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ],
        []
      ]
    },
    "Validation Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Validate Entity",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Entity Researcher",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model4": {
      "ai_languageModel": [
        [
          {
            "node": "Validate Entity",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Save Entity",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Researcher Internet": {
      "ai_tool": [
        [
          {
            "node": "Entity Researcher",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Entity Search Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Entity Search",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Entity Search Successful": {
      "main": [
        [],
        [
          {
            "node": "Entity Researcher",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Entity Search Embeddings 1": {
      "ai_embedding": [
        [
          {
            "node": "Entity Search 1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Entity Search Embeddings 2": {
      "ai_embedding": [
        [
          {
            "node": "Entity Search 2",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Set Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Set Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 文档提取, AI RAG 检索增强

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量33
分类2
节点类型16
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流