{
  "id": "Zm7fHD5Vfez5iDTE",
  "name": "Personalized Tour Package Recommendations using AI, Web UI Using Lovable and n8n",
  "tags": [],
  "nodes": [
    {
      "id": "77fc80a1-747c-4f8e-935d-c89a6a6a8954",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        360,
        200
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {
          "responseFormat": "json_object"
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4fa9b2dd-4dc6-48ab-b7bb-634258afd6d4",
      "name": "Answer questions with a vector store",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        660,
        180
      ],
      "parameters": {
        "description": "#Role#\nYou are an expert Tour Packaging Agent who has more than 15 years experience in travel agencies and experience in building amazing tour packages for customers.\n\n##Instructions##\nYou look into the pinecone vector database and from the packages created previously, you recreate best suitable packages for the customers and help respond back.\n\nYou always reply with politeness and friendly messages with few emojis.  \n"
      },
      "typeVersion": 1.1
    },
    {
      "id": "75f1df83-5a62-4e4a-8b4a-f182f598548f",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        480,
        360
      ],
      "parameters": {
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "tourpackagerecommendation",
          "cachedResultName": "tourpackagerecommendation"
        }
      },
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "37560b3e-ade2-42b6-a772-f7064ecab69f",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        500,
        520
      ],
      "parameters": {
        "model": "text-embedding-ada-002",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "946396d9-316c-4803-98fd-6a67927e24bf",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        820,
        400
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f03c9e90-2e92-4dca-ba02-f2420a1b0f17",
      "name": "Tour Recommendation AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        420,
        -20
      ],
      "parameters": {
        "text": "={{ $json.body.destination }}",
        "options": {
          "systemMessage": "You are an experienced tours and Packages travel agent who build tour packages for customers as per the request you receive. \nYour source for tours is from the pinecone vector databse, and you smartly analyse and combine the tours and activities and recommend to the customers acordingly. \noutput the format as per the Structured Output Parser response"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "a5559a97-15e4-4a42-952e-c4159d6ee33d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -120
      ],
      "parameters": {
        "width": 1300,
        "height": 820,
        "content": "## Personalized Tour Package Recommendations connecting to Lovable UI"
      },
      "typeVersion": 1
    },
    {
      "id": "31d1d77e-b856-43ef-8a9e-43e16d690ba7",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        40,
        -20
      ],
      "parameters": {
        "path": "12b44ee5-c43e-430c-a1d4-4fc5ff5e45c4",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "812d0fe7-a0fd-4bf0-85c6-f890910b3a7d",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        920,
        -20
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ $json.output }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "cefe0e7e-7325-48e6-8e84-ee7ea87f9626",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -760,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 680,
        "height": 820,
        "content": "Pre requisite:\n1. Vetrorize Tours and Activities information in Pinecone Vector Database \n(https://n8n.io/workflows/5085-convert-tour-pdfs-to-vector-database-using-google-drive-langchain-and-openai/)\n\n\n## UI-Based Query with webhook connecting to Lovable\nThis flow uses a web UI built using Lovable to query contracts directly from a form interface.\n\n### Webhook Setup for Lovable\nWebhook Node\nMethod: POST\nURL: your webhook url\nResponse: Using 'Respond to Webhook' Node\n\n### Structured Output Parser\nSample structure:\n  \"itinerary\": [\n    {\n      \"dayNumber\": 1,\n      \"date\": \"2024-07-15\",\n      \"activities\": [\n        {\n          \"id\": \"1\",\n          \"title\": \"Kuala Lumpur International Airport\",\n          \"description\": \"Arrival at KLIA\",\n          \"duration\": \"1 hour\",\n          \"location\": \"KLIA\",\n          \"type\": \"transport\"\n        },\n\n\n\n### Lovable UI\nUser shall submit Destination or Activity Search\nReceive response back via the response webhook in a JSON format. \n\nData is sent via webhook to n8n and responded with the Package options\n\n\n\u2699\ufe0f Tools & Tech Stack\nComponent\t            Tool Used\nAI Embedding\t            OpenAI text-embedding-3-small\nVector DB\t            Pinecone\nChunking\t            Recursive Text Splitter\nAI Agent\t            OpenAI GPT Chat\nStructure Output Parser\t    Parse Response data in structured JSON format\nAutomation\t            n8n\nUI Integration\tLovable (form-based)\n\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "19f49652-ce2a-478c-b655-0d896456ddea",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        960,
        180
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"totalDays\": 3,\n  \"itinerary\": [\n    {\n      \"dayNumber\": 1,\n      \"date\": \"2024-07-15\",\n      \"activities\": [\n        {\n          \"id\": \"1\",\n          \"title\": \"Kuala Lumpur International Airport\",\n          \"description\": \"Arrival at KLIA\",\n          \"duration\": \"1 hour\",\n          \"location\": \"KLIA\",\n          \"type\": \"transport\"\n        },\n        {\n          \"id\": \"2\",\n          \"title\": \"Petronas Twin Towers\",\n          \"description\": \"Visit the iconic twin towers\",\n          \"duration\": \"2 hours\",\n          \"location\": \"KLCC\",\n          \"type\": \"attraction\"\n        }\n      ]\n    },\n    {\n      \"dayNumber\": 2,\n      \"date\": \"2024-07-16\",\n      \"activities\": [\n        {\n          \"id\": \"3\",\n          \"title\": \"Batu Caves\",\n          \"description\": \"Explore the limestone caves and Hindu temples\",\n          \"duration\": \"3 hours\",\n          \"location\": \"Batu Caves\",\n          \"type\": \"attraction\"\n        }\n      ]\n    },\n    {\n      \"dayNumber\": 3,\n      \"date\": \"2024-07-17\",\n      \"activities\": [\n        {\n          \"id\": \"4\",\n          \"title\": \"Central Market\",\n          \"description\": \"Shopping and local crafts\",\n          \"duration\": \"2 hours\",\n          \"location\": \"Central Market\",\n          \"type\": \"activity\"\n        }\n      ]\n    }\n  ]\n}"
      },
      "typeVersion": 1.3
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9356fae8-6b64-4adf-8b83-352ab0ed3a92",
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Tour Recommendation AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Tour Recommendation AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Tour Recommendation AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Tour Recommendation AI Agent": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answer questions with a vector store": {
      "ai_tool": [
        [
          {
            "node": "Tour Recommendation AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}