🥳 with Bedrock - partyrock!
Tags: bedrock, aws, partyrock, genai
Published: 2023-11-16 17:56:37

## What is Partyrock?
AWS puts it as - "PartyRock is an educational tool for providing any builder with low-friction access to learn through experimentation in a foundation model playground built on Amazon Bedrock." [Here](https://aws.amazon.com/blogs/aws/build-ai-apps-with-partyrock-and-amazon-bedrock/) is the AWS blog post about it.

## What is it really?
It is AMAZING! After spending the last 2 days playing around with it, I can confidently say its a gamechanger! It allows anyone (and I mean anyone!) with an idea to get up and running in mins (yes mins). You simply click on "Generate an App" and provide information of what your app should do, and the AI takes care of the rest.

![Generate App window](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2vt2wz1o9ty20iane0gm.png)

## What is it not?
Right off the bat let me clarify what it most certainly is not:
- its not a product or service, its just a playground

- the underlying models aren't connected to the internet (_yet_), so take the information provided with a grain of salt

- its not going to build you a production ready application

- your limited to only text inputs and text or image outputs (_as of now_)

## So what can you really do with it?
Well anything really, your imagination is your limit. The playground enables anyone to build a text based app within mins that is functional and publicly shareable. 
Here is a step by step walkthrough of how I built the [Trip Planner app](https://partyrock.aws/u/karthiks3000/-yUrICuxA/Trip-Planner)

- **The initial prompt**: Try to be as specific as possible by outlying the exact inputs you want from a user that the AI needs to factor into account. I found the below format to be effective in controlling the input labels that get generated

![Generate App filled](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/068c0fzyij76xyjof1jt.png)


- **Customizing the layout**: The app that was generated looked like this -

![App initial](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0paxh97j5ossjgm9nuht.png)

Not so pretty right, lets re-size the boxes and rename the app title. Click on Edit on the top to get into the edit mode. Here is the updated view -

![App resized](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ore3m7rbl571wzlgtdjo.png)

- **Try it out**: Fill in the inputs and watch the AI work its magic -

![App attempt 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cnnjtm45p373btprpf9h.png)

Neat! but whats with the 7 day itinerary when my dates are from March 1st to 4th? This brings us to the next step.

- **Prompt Engineering!!**: Hit the edit button on the Itinerary widget to see the prompt that powers the AI response. You'll notice that it says "Suggest a detailed **7 day** itinerary"! Not so smart eh AI! I modified the prompt to give it more specific instructions on how to create the itinerary - 

```
Suggest a detailed day-by-day itinerary starting from the [From] city to [To] from [Dates], with a total budget of [Budget] USD.
Include cost of travel from [From] city to [To] city (suggesting multiple modes of transport if available), proposed attractions, activities, places to stay, and places to eat. Provide hours of operation and cost estimates where available. 
Take into consideration the number of travelers mentioned - [Travelers] 
You should recommend restaurants based on the food preferences specified - [Food Preferences].
You should recommend hotels based on stay preferences - [Stay Preferences] 
Day 1 of itineray should start with travel from [From] to [To] and the last day of itinieray should be the travel back from [To] to [From].
Consider [From] to be the home city of the user.
Do not make stuff up, if there isn't enough information to make a recommendation then say - "I'm sorry, I couldn't find enough information to make a recommendation".
```

And that should give you a much better result - 

![App attempt 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wlrjuj10aszos50od0vl.png)

- **Publish the app**: Once you are satisfied with the results, you can hit the "Make public and Share" button to share your app

The app that I ended up publishing [here](https://partyrock.aws/u/karthiks3000/-yUrICuxA/Trip-Planner) has more customizations and an added widget for Hotel Recommendations and a chatbot that lets you discuss your itinerary and customize it. Here are the prompts for them -

**Hotel Recommendations** - 
```
Based on the itinerary defined here - [Itinerary], suggest hotels for the trip factoring in the suggested hotel costs.
Take into consideration the following -
1. traveler profile specified by the user - [Traveler Profile].
2. stay preferences - [Stay Preferences] 
3.food preferences specified - [Food Preferences].
Do not make stuff up, if there isn't enough information to make a recommendation then say - "I'm sorry, I couldn't find enough information to make a recommendation".
Your response should only be in the format - 
=> {Hotel Name} - {Price per night} - {reason for recommendation}
```

**Trip Advisor** - 

```
Assuming the role of an experienced travel advisor, answer any questions the user may have about the trip they are planning. 
Context for the chat - 
Number of travelers - [Travelers] 
Origin City - [From] 
Destination - [To] 
Dates - [Dates] 
Budget - [Budget] 
Stay Preferences - [Stay Preferences] 
Food preferences - [Food Preferences] 
Traveler profile - [Traveler Profile] 
Current Itinerary - [Itinerary]
```

Have fun partying!!