Created
December 15, 2022 19:23
-
-
Save iqbalali/99fb7ea1c09b47afefb0db67e99c410e to your computer and use it in GitHub Desktop.
Using OpenAI to tag user feedback. You can use this as starting block to build an app iterating over user feedback items and tagging them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openai | |
openai.api_key = 'sk-****' # Get your own API key from OpenAI, I ain't sharing mine! | |
prompt = """ | |
Decide whether to tag the following review with one or more of the following themes: | |
Pricing, Efficiency, Reliability, Food, Service, Positive, Negative | |
Review: Great authentic Indian food. Good prices and childrens menu too (seems quite rare in Indian restaurants). I would definitely recommend going. The waiter service was good and waiting Tim's for food was minimal. We visited based on the good reviews on here and they seemed justified. | |
The only reason it isn't a 5 star was because me and my family found the lady who greeted us quite abrupt and rude and didn't allow me yo point out we had a table booked instead sent us to wait for a table to be ready in the waiting area. | |
Theme: | |
""" | |
# create a completion | |
completion = openai.Completion.create(engine="text-davinci-003", prompt= prompt, temperature=0,max_tokens=60, top_p=1,frequency_penalty=0.5,presence_penalty=0) | |
# print the completion | |
print(completion.choices[0].text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment