Giter Site home page Giter Site logo

aws-samples / personalized-travel-itinerary-planner Goto Github PK

View Code? Open in Web Editor NEW
28.0 1.0 7.0 875 KB

A Generative AI Chatbot application to provide personalized travel recommendations using Amazon Redshift and Amazon Bedrock

License: MIT No Attribution

Python 100.00%
bedrock claude2 redshift redshift-serverless

personalized-travel-itinerary-planner's Introduction

personalized-travel-itinerary-planner

This solution contains two major components. At first, we will extract the user’s information like Name, location, hobbies, interests and Favourite food etc along with their upcoming travel booking details. With this information we will stitch a user prompt together and pass it to Amazon Bedrock/Anthropic Claude LLM to obtain a personalized travel itinerary that the Customers can use. Below architecture diagram provides us a high level overview of the workflow and the components involved in this architecture.

Architecture Diagram

We will obtain the user ID from the chatbot interface, which will be sent to the Prompt engineering module. User’s information like Name, Location, hobbies, interests and favorite food is extracted from the Redshift database along with their upcoming travel booking details like travel city, check In and check out dates.

Deploy this solution

Step 1: Ensure the account and the region where the solution is being deployed has access to Bedrock Base models.

On the AWS Console go to Bedrock Page > Model Access > Manage Model Access > Select Anthropic Claude and Click Save Changes. This might take a few minutes after which we should see Access Granted

Bedrock Access

Step 2: Launch the AWS CloudFormation template

Launch the following AWS CloudFormation template to deploy Amazon Redshift Serverless cluster along with all the related components, including the EC2 instance to host the webapp. Provide a Stack Name and an SSH Keypair and Deploy the Cloudformation template.

Bedrock Access

Step 3: Copy the Redshift Database Workgroup Name, Secret ARN, URL and Redshift Service Role ARN (highlighted below) in a notepad from the Outputs tab of the Cloudformation Stack.

CFN Output

Step 4: Connect to the EC2 instance using SSH - Open an SSH Client - Locate your private key file that was entered while launching the cloudformation stack - Change the permissions of the private key file to 400 (chmod 400 id_rsa) - Connect to the instance using its Public DNS or IP address Example: ssh -i “id_rsa” ec2-user@ ec2-54-xxx-xxx-187.compute-1.amazonaws.com

Step 5: Update the configuration file “data_feed_config.ini” with the Region, Workgroup Name and Secret ARN that was copied in Step 3.

Config Update

Step 6: Run the below command to create the database objects that contains the user information and the travel booking data

python3 ~/personalized-travel-itinerary-planner/core/redshift_ddl.py

This command creates the “travel” schema along with the tables named “user_profile” and “hotel_booking”

Step 7: Run the below command to launch the web service

streamlit run ~/personalized-travel-itinerary-planner/core/chatbot_app.py --server.port=8080 &

Step 8: Create a user account to login to the app

  • On AWS Console navigate to Amazon Cognito page.
  • Select the userpool that was created as part of cloudformation stack (travelplanner-user-pool)
  • Click Create User
  • Enter user name, email, password and click Create User

Step 9: Update the Callback URL on Cognito

  • On AWS Console navigate to Amazon Cognito page.
  • Select the userpool that was created as part of cloudformation stack (travelplanner-user-pool)
  • Under the “App Integration” Tab > “App Client List” section > Select the client that was created (travelplanner-client)
  • On the Hosted UI section Click Edit
  • Replace the text “replace_your_LB_url” with the URL that was copied from the cloudformation output tab in Step 3. Please convert the URL to Lowercase text if it’s not done already.
  • Click Save Changes

Step 10: In a new browser window enter https:// and login using the username and password that was created in Step 8. Change the password if prompted.

Step 11: Enter the User ID: 1028169

Step 12: Ask any question to the bot. Some samples shown below

  • Can you plan a detailed itinerary for my July trip?
  • Should I carry a jacket for my upcoming trip?
  • Can you recommend some places to travel in March?

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

personalized-travel-itinerary-planner's People

Contributors

amazon-auto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

personalized-travel-itinerary-planner's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.