prompt guidance for OpenAI

Thomas Jeffery 40 Reputation points
2023-05-25T21:44:50.7933333+00:00

I cant find any documents to help me set up my prompt according to my scenario, is there any document can help for an example?

I want to use OpenAI API to analyze some of my inputs, I want to know if there is any customers don't like my business, Thanks

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
4,080 questions
0 comments No comments
{count} votes

Accepted answer
  1. YutongTie-MSFT 53,966 Reputation points Moderator
    2023-05-26T00:48:22.2933333+00:00

    Hello @Thomas Jeffery

    Thanks for reaching out to us. OpenAI provides several examples and guides to help you set up your prompt according to your scenario. Here's an example prompt that you can use to analyze customer feedback and identify negative sentiment:

    Given a list of customer feedback about my business, identify any negative sentiment.

    Feedback:

    1. "I had a terrible experience at your store. The staff was rude and unhelpful."
    2. "Your product was defective and I had to return it twice before getting a working one."
    3. "I was overcharged for my purchase and it took several calls to customer service to get it resolved."
    4. "I love your product, but the shipping was slow and it arrived later than expected."
    5. "The quality of your service has gone downhill in recent months. I'm considering switching to a competitor."

    Negative feedback:

    1. "I had a terrible experience at your store. The staff was rude and unhelpful."
    2. "Your product was defective and I had to return it twice before getting a working one."
    3. "I was overcharged for my purchase and it took several calls to customer service to get it resolved."
    4. "The quality of your service has gone downhill in recent months. I'm considering switching to a competitor."

    In this prompt, you provide a list of customer feedback and ask OpenAI to identify any negative sentiment. You can modify the prompt to include your own customer feedback and business information.

    To use this prompt with the OpenAI API, you can use the "davinci" engine and the "text" prompt format. Here's an example of how to use the API in :

    import openai
    openai.api_key = "YOUR_API_KEY"
    def analyze_customer_feedback(feedback_list):
        prompt = "Given a list of customer feedback about my business, identify any negative sentiment.\n\nFeedback:\n"
        for feedback in feedback_list:
            prompt += f"{feedback}\n"
        prompt += "\nNegative feedback:"
        response = openai.Completion.create(
            engine="davinci",
            prompt=prompt,
            max_tokens=1024,
            n=1,
            stop=None,
            temperature=0.5
        )
        negative_feedback = response.choices[0].text.split(":")[1].strip()
        return negative_feedback
    

    You can call this function and have a try.

    Regards,

    Yutong

    -Please kindly accept the answer and vote 'Yes' if you feel helpful to support the community, thanks a lot.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.