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
š 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
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
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)
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ā
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/