DATA STORIES | GENAI | KNIME ANALYTICS PLATFORM

GenAI Trip Planner: How to plan your next trip with GenAI and KNIME

A step-by-step tutorial to build and customize your GenAI-driven applications in 10 minutes

MAHANTESH PATTADKAL
Low Code for Data Science

--

šŸŒŸ Are you tired of the same old trip planning apps that just donā€™t get it? šŸ˜‘ Itā€™s time to level up your travel game with a GenAI trip planner thatā€™s smart, fast, and super useful! šŸ¤© And the best part? You can build it yourself in just 10 minutes using KNIMEšŸŒˆ So grab your virtual passport and letā€™s dive into it! šŸ’«

What is KNIME?

KNIME is a powerful tool that enables data scientists and analysts to build and deploy machine learning models quickly and easily. It provides a drag-and-drop interface for building data pipelines, as well as a wide range of pre-built nodes for data manipulation, visualization, and analysis.

But what makes KNIME a game changer for building GenAI applications is the KNIME AI Extension. This KNIME extension provides nodes for connecting to and prompting large language models (LLMs), chat and embeddings models provided by OpenAI, Hugging Face Hub and GPT4ALL.

Letā€™s Build the Trip Planner!

Start Page: Enter Trip Destination

Page Idea: Enable the user to enter source and destination cities and OpenAI API key to access LLMs.

Given below is the workflow of the page, the String Widget nodes to get source and destination information and OpenAI Authenticator node to access OpenAI models.

Workflow and Page View

Workflow of Start Page.
Start Page: Get source and destination cities.

Use the OpenAI key entered by the user to authenticate OpenAI, this will enable you to use LLMs to generate images and text.

First Page: Source City Banner

Page Idea : Show the banner image of the source city.

The task of generating image with LLMs is simplified so much using KNIME, as shown in the workflow below I use a String Manipulation node to pass the prompt with the source city entered by the user and supply this prompt to the OpenAI DALL-E View node and it generates the image.

Prompt: ā€œGenerate image of the identifier of the city mentioned below, e.g.: City : Paris, Image : Eiffel tower
Generate image for the city : $${Sstring-input}$$)ā€

Workflow and Page View

Workflow of First Page: Generate image of source city (Berlin).
First Page: Banner Image of Source City (Berlin).

Second Page: Destination City Summary View

Page Idea : Display the destination city image with a short commentary on the cityā€™s history, culture and tourist attractions.

In the workflow, the image generation part is similar to that of the previous page, added the workflow segment that can generate the summary text of the destination city using LLM GPT4o-mini. As seen in the wokflow, I use the ā€œOpenAI Chat Model Connectorā€ to select the LLM of my choice and then supply the following prompt to the ā€œLLM Prompterā€ node. This node will generate the text based on the provided prompt

Prompt: ā€œWrite a brief note about the city: $${SdestinationCity}$$.
Make sure the text is enticing and will want people to visit it and use maximum 100 wordsā€.

The LLM generates the following image of Paris (left) and summary about Paris(right)

Second Page: Destination City summary view.

Last Page : Detailed Itinerary

Page Idea: Display the detailed itinerary of the trip.

The last page will display the detailed itinerary with a 2 days trip plan. The workflow uses the LLM GPT4o-mini to generate itinerary. I have used the given below prompt.

Prompt: ā€œProvide an itinerary for the trip from the city:$${SSourceCity}$$ to the city : $${SDestinationCity}$$. Also provide a 2 day plan on what to visit and what to see and what to eat, provide this in a standard html format, so that I can display it as a .html pageā€

Last Page: Detailed Itinerary.

Conclusion

šŸš€ Without writing a single line of code, I built a GenAI-based trip planner that can send prompts to LLMs and get responses. I even made a simple UI to make it more user-friendly! Isnā€™t it awesome that by just connecting some nodes with an OpenAI API Key, I created a useful app in just 10 minutes? šŸŽ‰šŸŒŸ

šŸš€ While I start my journey to Paris, you can start your KNIME journey by simply downloading it at https://www.knime.com/downloads
šŸŒŸšŸ’» Happy exploring! šŸŽ‰

Workflow is here : https://hub.knime.com/-/spaces/-/~0cUYgvWFc1eujgsf/current-state/

--

--