File size: 839 Bytes
995f54d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from data import get_reviews_for_prompt


def get_text_from_reviews(reviews, kind):
    return [review["text"] for review in reviews[kind]]


def get_prompt(city, preferences):
    reviews = get_reviews_for_prompt(city, preferences)
    hotel_name = reviews["hotel_name"]
    positive_text, negative_text = [[review["text"] for review in reviews[kind]]
                                    for kind in ["positive", "negative"]]
    return f"You are an expert travel agent. A customer is looking for a hotel in the city of {city}. " \
           f"You need to convince the customer to book a stay in {hotel_name}. " \
           f"Rely on the following positive and negative reviews. " \
           f"Make your argument compelling yet honest. " \
           f"User reviews: " \
           f"{positive_text}" \
           f"{negative_text}."