Exercise: Vacation Planner Using Artificial Intelligence

Test the concepts we’ve learned with a coding exercise.

We'll cover the following

Problem statement

In this exercise, enhance the functionality of the existing vacation planner application. The application will utilize the OpenAI model to generate personalized destination plans, vacation emails, and destination suggestions based on user preferences.

Coding challenge

You have to code three functions:

  1. create_destination_plan(preferences): This function generates a personalized destination plan based on user preferences using OpenAI. It constructs a conversation prompt between the user and the assistant, where the user expresses their desire to plan a vacation and shares their preferences. The OpenAI API is then used to complete the prompt, providing a detailed response that suggests an ideal destination.

  2. generate_vacation_email(user_preferences, destination_plan): This function creates a vacation email based on a given destination plan. It uses OpenAI to generate the email text by providing a prompt that incorporates the destination plan. The resulting email is intended to capture the essence of the vacation plan and can be used as a starting point for communicating the details of the vacation to others.

  3. destination_suggestions(preferences): This function provides personalized destination suggestions based on the user’s preferences. It utilizes OpenAI to generate suggestions by constructing a prompt that asks for destination recommendations tailored to the specified preferences. The function then extracts and returns the suggested destinations from the OpenAI API response.

Get hands-on with 1200+ tech skills courses.