{
  "name": "OpenAI assistant with custom tools",
  "nodes": [
    {
      "id": "79573e58-f33f-445a-ad9a-0a92fde845c2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        480
      ],
      "parameters": {
        "width": 1174.6162657502882,
        "height": 578.9520146851776,
        "content": "## Sub-workflow: Return the capitals of fictional countries\nIt can either list the countries it knows about or return the capital of a specific country"
      }
    },
    {
      "id": "5eddcce9-7ee5-4ec7-a0a1-525a9b806994",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        -80
      ],
      "parameters": {
        "width": 1168,
        "height": 528,
        "content": "## Main workflow: Chat with OpenAI Assistant\nClick the 'Chat' button at the bottom of the screen to try"
      }
    },
    {
      "id": "a6c38394-1be1-4002-a9b7-c4672823aaa5",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -180,
        40
      ]
    },
    {
      "id": "de0398ea-c2ad-49b9-860b-695149b94590",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        100,
        40
      ]
    },
    {
      "id": "050042f4-f5ff-433a-9651-43cbec8eafb6",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        360,
        260
      ]
    },
    {
      "id": "e4ed4cfe-78fb-44a5-8bef-67168dac95ec",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -180,
        740
      ]
    },
    {
      "id": "a3a1059c-5c36-4d90-90e2-98e37f62bdd2",
      "name": "Tool to call the workflow below",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        40,
        260
      ]
    },
    {
      "id": "80924ec9-5e82-4e90-8b72-42fc805d83c0",
      "name": "Tool: Get current date and time",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        200,
        260
      ]
    },
    {
      "id": "8f6a83bd-71eb-4f2d-b906-a18476f18f40",
      "name": "List countries?",
      "type": "n8n-nodes-base.if",
      "position": [
        40,
        740
      ]
    },
    {
      "id": "40d93a59-4c91-43e4-a4a3-3732475617d6",
      "name": "Mapping data",
      "type": "n8n-nodes-base.code",
      "position": [
        260,
        600
      ]
    },
    {
      "id": "8765b405-8991-421c-bdc5-3eb6d3757fcb",
      "name": "Concatenate country names",
      "type": "n8n-nodes-base.summarize",
      "position": [
        460,
        600
      ]
    },
    {
      "id": "c0b21934-8518-49b4-bbab-f13ad0a74343",
      "name": "Return country list",
      "type": "n8n-nodes-base.set",
      "position": [
        660,
        600
      ]
    },
    {
      "id": "5d4f05cc-f4e3-4ce6-9ea8-a324257fa7c3",
      "name": "Mapping data1",
      "type": "n8n-nodes-base.code",
      "position": [
        260,
        880
      ]
    },
    {
      "id": "5ed65e2c-b56d-49d9-a205-1e4cc8914fa9",
      "name": "Get the matching country's details",
      "type": "n8n-nodes-base.merge",
      "position": [
        460,
        820
      ]
    },
    {
      "id": "313775a0-a4ce-488e-a7db-b1ddd49dc3cd",
      "name": "Return specific capital",
      "type": "n8n-nodes-base.set",
      "position": [
        660,
        820
      ]
    }
  ],
  "connections": {
    "Mapping data": {
      "main": [
        [
          {
            "node": "Concatenate country names",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mapping data1": {
      "main": [
        [
          {
            "node": "Get the matching country's details",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "OpenAI",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "List countries?": {
      "main": [
        [
          {
            "node": "Mapping data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get the matching country's details",
            "type": "main",
            "index": 0
          },
          {
            "node": "Mapping data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Concatenate country names": {
      "main": [
        [
          {
            "node": "Return country list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tool to call the workflow below": {
      "ai_tool": [
        [
          {
            "node": "OpenAI",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Tool: Get current date and time": {
      "ai_tool": [
        [
          {
            "node": "OpenAI",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "List countries?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get the matching country's details": {
      "main": [
        [
          {
            "node": "Return specific capital",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}