'Address':['123 Main St','456 Oak Ave','789 Pine Ln','101 Elm Blvd','202 Cedar Dr'],
'Age':[25,30,22,35,28],
'reviews':[
"The food at this restaurant was absolutely amazing! Each dish was a delightful experience, and the service was top-notch.",
"Unfortunately, my experience at this restaurant was less than satisfactory. The service was slow, and the food arrived cold. I wouldn't recommend it.",
"I enjoyed the atmosphere of the restaurant, but the portions were disappointingly small. I left feeling hungry despite the tasty dishes.",
"The service was excellent, and the dishes were delicious. I will definitely come back to this restaurant in the future.",
"My visit to this restaurant was terrible. The staff was rude, and the food had no flavor. I won't be returning."
]
}
original_data=pd.DataFrame(data)
# In[4]:
original_data
# In[5]:
prompt="You are an AI Assistant that generates 5 synthetic data points upon user request. Only return the markdown table. Do not return additional text. Create new reviews"
query=f"Generate 5 new synthetic data with similar distribution, pattern and sentiment to the following data. Write new reviews:\n\n{original_data.to_markdown(index=False)}"
# Make a request to OpenAI GPT-3.5.
response=openai.ChatCompletion.create(
engine="INSERT MODEL NAME HERE",
messages=[
{"role":"system","content":prompt},
{"role":"user","content":query}
],
temperature=0.7,
stop=None
)
# In[6]:
# Function to get sentiment score
defget_sentiment_score(text):
sid=SentimentIntensityAnalyzer()
sentiment_scores=sid.polarity_scores(text)
returnsentiment_scores['compound']
# Add a new column 'sentiment_score' to the DataFrame