hotel-recommender / prompt.py
Tom Beer
close loop
995f54d
raw
history blame
839 Bytes
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}."