{
  "id": "eZ0ezrp3Vf0EDjgM",
  "name": "BambooHR AI-Powered Company Policies and Benefits Chatbot",
  "tags": [],
  "nodes": [
    {
      "id": "1338d536-b4da-4b7d-bd85-a43dad9074fe",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        272,
        16
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "96ec0f75-7060-482f-ad60-965d765b9675",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1600,
        208
      ],
      "parameters": {
        "options": {},
        "dataType": "binary"
      },
      "typeVersion": 1
    },
    {
      "id": "9205b7c4-5570-4f1a-bd31-9e516b1b7305",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1376,
        208
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "53543ff6-6b16-4db5-b9b8-8da9239cc25d",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1552,
        320
      ],
      "parameters": {
        "options": {},
        "chunkOverlap": 100
      },
      "typeVersion": 1
    },
    {
      "id": "c98cb5a1-dcdb-4cf2-bffa-d1f8118024b0",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        464,
        944
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "c0c30b46-2ab1-4285-8ce4-56041cb40670",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        304,
        944
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "5fa04b36-286f-4bc6-83df-be4c416e0924",
      "name": "Vector Store Tool",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        592,
        992
      ],
      "parameters": {
        "name": "company_files",
        "topK": 5,
        "description": "Retrieves information from the company handbook, 401k policies, benefits overview, and expense policies available to all employees."
      },
      "typeVersion": 1
    },
    {
      "id": "293cc2ac-9150-4453-9854-69f3d581968a",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        688,
        1200
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a223c229-b9be-4ba6-a342-ad0b777395c5",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        400,
        1312
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "abd26080-b2b1-47cf-aa79-dd5f187b2be8",
      "name": "Employee Lookup Tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        912,
        960
      ],
      "parameters": {
        "name": "employee_lookup_tool",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "description": "Call this tool with the full name of an employee to retrieve their details from our HRIS, including their job title, department, and supervisor. If an employee name is not provided, you may call this tool with a department name to retrieve the most senior person in that department. This tool requires an exact match on employee names but can infer the senior-most person for a department query.",
        "jsonSchemaExample": "{\n\t\"name\": \"The name of an employee or department\"\n}",
        "specifyInputSchema": true
      },
      "typeVersion": 1.2
    },
    {
      "id": "7e7fed0e-bc29-4bf1-8005-3d0876a9ccb5",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1472,
        960
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "3d5a0ff5-7dda-41b2-b6a3-8d4d2dea7b09",
      "name": "OpenAI Chat Model3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2496,
        1056
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "412c82f4-f574-47d1-ad40-9f58ae0f4b85",
      "name": "OpenAI Chat Model4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        3216,
        1088
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "f9b468a8-9558-4231-9c0c-36c8db3094e1",
      "name": "Auto-fixing Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        3392,
        1056
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "0a32e40a-f1b3-401a-a0fc-f75d835dba4d",
      "name": "OpenAI Chat Model5",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        3296,
        1168
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "94578f9f-30c8-4249-b096-caa05701cd0d",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        3600,
        1168
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"name\": \"The name of an employee\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "55a4c197-a037-4ae3-b2d2-6aa6767cffbe",
      "name": "GET all files",
      "type": "n8n-nodes-base.bambooHr",
      "position": [
        480,
        16
      ],
      "parameters": {
        "resource": "file",
        "operation": "getAll",
        "returnAll": true,
        "simplifyOutput": false
      },
      "typeVersion": 1
    },
    {
      "id": "47abf59d-84a4-43f6-b2ce-6bc079bf720d",
      "name": "Filter out files from undesired categories",
      "type": "n8n-nodes-base.filter",
      "position": [
        672,
        16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b85b86cd-0b54-4348-a538-8ff4ae625b9a",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.name }}",
              "rightValue": "=Company Files"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c45b175d-9743-475c-afbf-6d0202026783",
      "name": "Split out individual files",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        880,
        16
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "files"
      },
      "typeVersion": 1
    },
    {
      "id": "656885a4-12c1-4ebf-8619-771ac66c967e",
      "name": "Filter out non-pdf files",
      "type": "n8n-nodes-base.filter",
      "position": [
        1072,
        16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "73cc2cb9-04fa-43e7-a459-de0bf26ffb18",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.originalFileName.endsWith(\".pdf\") }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a443870a-d2cb-4ef5-9d87-f95170eab882",
      "name": "Download file from BambooHR",
      "type": "n8n-nodes-base.bambooHr",
      "position": [
        1280,
        16
      ],
      "parameters": {
        "fileId": "={{ $json.id }}",
        "resource": "file",
        "operation": "download"
      },
      "typeVersion": 1
    },
    {
      "id": "3f3c0a48-c145-40d4-a708-bf1fa32a83a3",
      "name": "Supabase Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        1472,
        16
      ],
      "parameters": {
        "mode": "insert",
        "options": {
          "queryName": "match_files"
        },
        "tableName": {
          "__rl": true,
          "mode": "list",
          "value": "company_files",
          "cachedResultName": "company_files"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a4c1523b-9397-4de9-9c27-2a23e8c44db8",
      "name": "Employee initiates a conversation",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        224,
        752
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "ed6ae7df-e29d-4c7b-9dfb-c6554bf82643",
      "name": "Supabase Vector Store Retrieval",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        400,
        1152
      ],
      "parameters": {
        "options": {
          "queryName": "match_files"
        },
        "tableName": {
          "__rl": true,
          "mode": "list",
          "value": "company_files",
          "cachedResultName": "company_files"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b1e06b9c-b4fa-4673-ae00-e92b269d5217",
      "name": "AI-Powered HR Benefits and Company Policies Chatbot",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        1152,
        800
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e58a5e96-a3d9-4114-b4b5-459388a5cff0",
      "name": "Text Classifier",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        1360,
        800
      ],
      "parameters": {
        "options": {},
        "inputText": "={{ $json.query.name }}",
        "categories": {
          "categories": [
            {
              "category": "person",
              "description": "This is the name of a person."
            },
            {
              "category": "department",
              "description": "This is the name of a department within the company."
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8737b476-f388-472b-b6ad-830533b35123",
      "name": "GET all employees",
      "type": "n8n-nodes-base.bambooHr",
      "position": [
        1776,
        704
      ],
      "parameters": {
        "operation": "getAll",
        "returnAll": true
      },
      "typeVersion": 1
    },
    {
      "id": "81fa275b-020d-492d-a2ec-e521ec07cb66",
      "name": "Filter out other employees",
      "type": "n8n-nodes-base.filter",
      "position": [
        1968,
        704
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e80c892e-21dc-4d6e-8ef6-c2ffaea6d43e",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.displayName }}",
              "rightValue": "={{ $('AI-Powered HR Benefits and Company Policies Chatbot').item.json.query.name }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b2762fcc-b9b3-46e8-ab13-0f9eb5800dbe",
      "name": "Stringify employee record for response",
      "type": "n8n-nodes-base.set",
      "position": [
        2176,
        704
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "73ae7ef0-339a-4e32-bbc9-c40cefd37757",
              "name": "response",
              "type": "string",
              "value": "={{ $json.toJsonString() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fb3c6f9e-600f-48c4-adc2-3b818dee6899",
      "name": "GET all employees (second path)",
      "type": "n8n-nodes-base.bambooHr",
      "position": [
        1776,
        896
      ],
      "parameters": {
        "operation": "getAll",
        "returnAll": true
      },
      "typeVersion": 1
    },
    {
      "id": "1e8370fb-cf4b-4307-9a14-e12988e4f018",
      "name": "Extract departments",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1968,
        896
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "departments",
              "fieldToAggregate": "department"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6e40f1fa-101c-4904-aace-582c673aec1a",
      "name": "Ensure uniqueness in department list",
      "type": "n8n-nodes-base.set",
      "position": [
        2176,
        896
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "34f456ff-d2c5-431f-ade3-ace48abd0c6a",
              "name": "departments",
              "type": "array",
              "value": "={{ $json.departments.unique() }}"
            },
            {
              "id": "cf31288a-65fc-45c6-8b6f-6680020dce09",
              "name": "query",
              "type": "string",
              "value": "={{ $('Text Classifier').item.json.query.name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "94ac6aa8-cbc6-4001-bebb-0ed0b6df0de6",
      "name": "Extract department",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        2368,
        896
      ],
      "parameters": {
        "text": "={{ $json.query }}",
        "options": {},
        "attributes": {
          "attributes": [
            {
              "name": "department",
              "description": "=The department from the following list that would be most applicable:\n{{ $json.departments }}"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "57763d00-bdd1-4d81-aa0c-333d5e8878b1",
      "name": "Retrieve all employees",
      "type": "n8n-nodes-base.bambooHr",
      "position": [
        2736,
        896
      ],
      "parameters": {
        "operation": "getAll",
        "returnAll": true
      },
      "typeVersion": 1
    },
    {
      "id": "d40254b9-8209-458b-93d0-8682c1c39ce2",
      "name": "Filter out other departments",
      "type": "n8n-nodes-base.filter",
      "position": [
        2928,
        896
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a88bf53c-ecfd-49a7-8180-1e8b8eaeb6fd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.department }}",
              "rightValue": "={{ $('Extract department').item.json.output.department }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a978e246-863f-4f07-b3f9-84a04e4aeba6",
      "name": "Extract relevant employee fields",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3136,
        896
      ],
      "parameters": {
        "include": "specifiedFields",
        "options": {},
        "aggregate": "aggregateAllItemData",
        "fieldsToInclude": "id, displayName, jobTitle, workEmail",
        "destinationFieldName": "department_employees"
      },
      "typeVersion": 1
    },
    {
      "id": "a1331546-ad4c-4f80-ac60-5eb0321e5a29",
      "name": "Identify most senior employee",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        3312,
        896
      ],
      "parameters": {
        "text": "=Who is the most senior employee from this list:\n{{ $json.department_employees.toJsonString() }}",
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.4
    },
    {
      "id": "25de5143-bae4-4847-8ac3-f12555fbbd37",
      "name": "Format name for response",
      "type": "n8n-nodes-base.set",
      "position": [
        3680,
        896
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2b4412bf-142b-4ba0-a6b2-654e97c263e5",
              "name": "response",
              "type": "string",
              "value": "={{ $json.output.name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "da428733-f5c3-4b64-8f24-d2bfd0b0acf6",
      "name": "HR AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        512,
        752
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful HR assistant accessible by employees at our company.\n\nObjective: \nAssist employees with questions regarding company policies, documents, and escalation procedures.\n\nTools: \n1. A vector store database (company_files) containing the company handbook, 401k policy, expense policy, and employee benefits. \n2. An employee lookup tool (employee_lookup_tool) that retrieves details about an employee when provided with their name. It can also retrieve the most senior person in a department if given a department name. \n\nGuidelines: \n- When an employee asks for a contact person, first attempt to find the relevant contact in company_files. \n- If a contact person is found but their details (e.g., email or phone number) are missing, use the `employee_lookup_tool` to retrieve their contact details. \n- If no contact person is found: \n 1. Use the `employee_lookup_tool` with \"HR\" (or another relevant department) to retrieve the most senior person in that department. \n 2. If no senior contact is found, ask the employee for their name. \n 3. Use the `employee_lookup_tool` to retrieve their supervisor\u2019s name. \n 4. Use the `employee_lookup_tool` to retrieve their supervisor\u2019s details. \n 5. Provide the supervisor's contact information and recommend them as the best next point of contact. \n"
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "18c54311-5049-4cae-ad75-f1cb77b1de00",
      "name": "Main Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 2172,
        "content": "## \ud83c\udfe2 BambooHR AI-Powered Policies & Benefits Chatbot\n\nA chat assistant that answers employee questions about company policies and benefits from your BambooHR documents, and can also look up specific employees or the senior contact in any department. Policy PDFs are embedded into Supabase, and an AI agent grounds every answer in that content while delegating people lookups to a sub-workflow.\n\n**Perfect for:** HR teams who want a single self-serve assistant for both policy questions and employee directory lookups.\n\n---\n\n## How it works\n\n1. **When clicking 'Test workflow'** \u2014 Manually starts the policy ingestion run.\n2. **GET all files** \u2014 Pulls the company file list from BambooHR.\n3. **Filter out files from undesired categories** \u2014 Keeps only policy and benefit files.\n4. **Split out individual files** \u2014 Splits the list into one item per file.\n5. **Filter out non-pdf files** \u2014 Drops anything that is not a PDF.\n6. **Download file from BambooHR** \u2014 Downloads each policy PDF.\n7. **Supabase Vector Store** \u2014 Embeds and stores the policy documents.\n8. **Embeddings OpenAI** \u2014 Generates vectors for storage.\n9. **Default Data Loader** \u2014 Loads each downloaded PDF for embedding.\n10. **Recursive Character Text Splitter** \u2014 Chunks the PDFs before embedding.\n11. **Employee initiates a conversation** \u2014 Chat trigger for employee questions.\n12. **HR AI Agent** \u2014 Answers using the chat model, memory, and tools.\n13. **OpenAI Chat Model** \u2014 LLM powering the agent.\n14. **Window Buffer Memory** \u2014 Keeps recent conversation context.\n15. **Vector Store Tool** \u2014 Retrieves relevant policy text for the agent.\n16. **Supabase Vector Store Retrieval** \u2014 Queries the stored policy vectors.\n17. **Embeddings OpenAI1** \u2014 Embeds the user query for retrieval.\n18. **OpenAI Chat Model1** \u2014 Summarizes retrieved chunks inside the tool.\n19. **Employee Lookup Tool** \u2014 Sub-workflow tool for employee and department lookups.\n20. **AI-Powered HR Benefits and Company Policies Chatbot** \u2014 Sub-workflow entry trigger.\n21. **Text Classifier** \u2014 Decides if the query is about a person or a department.\n22. **OpenAI Chat Model2** \u2014 LLM powering the classifier.\n23. **GET all employees** \u2014 Fetches employees for the single-person path. *(employee path)*\n24. **Filter out other employees** \u2014 Narrows to the requested person. *(employee path)*\n25. **Stringify employee record for response** \u2014 Formats the record as text. *(employee path)*\n26. **GET all employees (second path)** \u2014 Fetches employees for the department path. *(department path)*\n27. **Extract departments** \u2014 Aggregates the department list. *(department path)*\n28. **Ensure uniqueness in department list** \u2014 Dedupes the departments. *(department path)*\n29. **Extract department** \u2014 Identifies the target department from the query. *(department path)*\n30. **OpenAI Chat Model3** \u2014 LLM powering department extraction.\n31. **Retrieve all employees** \u2014 Fetches employees in that department.\n32. **Filter out other departments** \u2014 Keeps only matching-department staff.\n33. **Extract relevant employee fields** \u2014 Trims to the needed fields.\n34. **Identify most senior employee** \u2014 Picks the senior contact via LLM.\n35. **OpenAI Chat Model4** \u2014 LLM for seniority reasoning.\n36. **Auto-fixing Output Parser** \u2014 Repairs malformed LLM output.\n37. **OpenAI Chat Model5** \u2014 LLM used by the auto-fixing parser.\n38. **Structured Output Parser** \u2014 Enforces the output schema.\n39. **Format name for response** \u2014 Formats the final answer.\n\n---\n\n## Setup (~25 minutes)\n\n1. **OpenAI API** \u2014 Add your key in every OpenAI node: *OpenAI Chat Model* through *OpenAI Chat Model5*, *Embeddings OpenAI*, and *Embeddings OpenAI1*.\n2. **BambooHR** \u2014 Add API credentials in *GET all files*, *Download file from BambooHR*, *GET all employees*, *GET all employees (second path)*, and *Retrieve all employees*.\n3. **Supabase** \u2014 Add credentials in *Supabase Vector Store* and *Supabase Vector Store Retrieval*.\n4. **Sub-workflow** \u2014 Confirm *Employee Lookup Tool* points to this workflow's *AI-Powered HR Benefits and Company Policies Chatbot* trigger.\n5. **Ingest policies** \u2014 Run the manual trigger once before going live.\n> Only BambooHR PDFs are ingested; confirm the file categories match your account. Embedding many PDFs and the multiple LLM calls in the lookup path both incur OpenAI cost."
      },
      "typeVersion": 1
    },
    {
      "id": "f3ef2615-2047-493d-8d81-79101ae78e3d",
      "name": "Section: Policy Ingestion",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -144
      ],
      "parameters": {
        "color": 5,
        "width": 1680,
        "height": 600,
        "content": "## 1\ufe0f\u20e3 Policy Ingestion\n\nTriggered manually, **GET all files** pulls the company document list from BambooHR, which is narrowed by **Filter out files from undesired categories**, **Split out individual files**, and **Filter out non-pdf files**. **Download file from BambooHR** then fetches each policy PDF, and **Supabase Vector Store** embeds it using **Embeddings OpenAI**, the **Default Data Loader**, and the **Recursive Character Text Splitter**."
      },
      "typeVersion": 1
    },
    {
      "id": "6482c82c-ea19-44d1-80b7-ef024cd7e268",
      "name": "Section: HR Chat Agent & RAG",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        480
      ],
      "parameters": {
        "color": 3,
        "width": 880,
        "height": 1080,
        "content": "## 2\ufe0f\u20e3 HR Chat Agent & RAG\n\nWhen an **Employee initiates a conversation**, the **HR AI Agent** answers using the **OpenAI Chat Model** and **Window Buffer Memory** for context. Policy questions are grounded by the **Vector Store Tool**, which retrieves from **Supabase Vector Store Retrieval** via **Embeddings OpenAI1** and **OpenAI Chat Model1**, while the **Employee Lookup Tool** hands people questions to the sub-workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "5c17fd04-ab0c-48a0-ba65-4402986fed17",
      "name": "Section: Employee Lookup - Classify & Fetch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        544
      ],
      "parameters": {
        "color": 6,
        "width": 1540,
        "height": 720,
        "content": "## 3\ufe0f\u20e3 Employee Lookup: Classify & Fetch\n\nThe **Text Classifier** (powered by **OpenAI Chat Model2**) decides whether a query is about a specific person or a department. The employee path runs **GET all employees**, **Filter out other employees**, and **Stringify employee record for response**, while the department path runs **GET all employees (second path)**, **Extract departments**, **Ensure uniqueness in department list**, and **Extract department** with **OpenAI Chat Model3**."
      },
      "typeVersion": 1
    },
    {
      "id": "eaf78bfe-5d18-4991-a31b-46dbeb1ca922",
      "name": "Section: Employee Lookup - Seniority Resolution",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2640,
        688
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 668,
        "content": "## 4\ufe0f\u20e3 Employee Lookup: Seniority Resolution\n\nFor department queries, **Retrieve all employees** and **Filter out other departments** narrow the roster before **Extract relevant employee fields** trims it down. **Identify most senior employee** then picks the right contact using **OpenAI Chat Model4**, with the **Auto-fixing Output Parser** (backed by **OpenAI Chat Model5** and the **Structured Output Parser**) keeping the output valid before **Format name for response** returns the answer."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "35a3abb7-a3cf-4c61-8c92-e523e9edd09a",
  "nodeGroups": [],
  "connections": {
    "GET all files": {
      "main": [
        [
          {
            "node": "Filter out files from undesired categories",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Classifier": {
      "main": [
        [
          {
            "node": "GET all employees",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "GET all employees (second path)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "GET all employees": {
      "main": [
        [
          {
            "node": "Filter out other employees",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "HR AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Tool": {
      "ai_tool": [
        [
          {
            "node": "HR AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store Retrieval",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Extract department": {
      "main": [
        [
          {
            "node": "Retrieve all employees",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Text Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Extract department",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model4": {
      "ai_languageModel": [
        [
          {
            "node": "Identify most senior employee",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model5": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Extract departments": {
      "main": [
        [
          {
            "node": "Ensure uniqueness in department list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Employee Lookup Tool": {
      "ai_tool": [
        [
          {
            "node": "HR AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "HR AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve all employees": {
      "main": [
        [
          {
            "node": "Filter out other departments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter out non-pdf files": {
      "main": [
        [
          {
            "node": "Download file from BambooHR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Identify most senior employee",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Filter out other employees": {
      "main": [
        [
          {
            "node": "Stringify employee record for response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split out individual files": {
      "main": [
        [
          {
            "node": "Filter out non-pdf files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file from BambooHR": {
      "main": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter out other departments": {
      "main": [
        [
          {
            "node": "Extract relevant employee fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Identify most senior employee": {
      "main": [
        [
          {
            "node": "Format name for response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET all employees (second path)": {
      "main": [
        [
          {
            "node": "Extract departments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store Retrieval": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Extract relevant employee fields": {
      "main": [
        [
          {
            "node": "Identify most senior employee",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Employee initiates a conversation": {
      "main": [
        [
          {
            "node": "HR AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "GET all files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ensure uniqueness in department list": {
      "main": [
        [
          {
            "node": "Extract department",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter out files from undesired categories": {
      "main": [
        [
          {
            "node": "Split out individual files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI-Powered HR Benefits and Company Policies Chatbot": {
      "main": [
        [
          {
            "node": "Text Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}