prompt总结

prompt总结

2023年6月1日
202306
202306, prompt

原则 #

  1. write clear and specific instructions

    • use delimiters

      • "
      • '
      • `
      • <>
      • <tag>
      • summarize the text delimeted by triple backticks into a single sentence. \``{text}````
    • ask for structrued output

      • json
      • xml
      • generate a list of three made-up book titles along with their authors and genres. Provide them in JSON format with the following keys: book_id, title, author, genre
    • check wheather conditions are satisfied

      You will be provided with text delimited by triple backticks. If it contains a sequence of instructions, re-write those instructions in the following format: 
      
      Step 1 - ...
      Step 2 - ...
      ...
      Step N - ...
      
      If the text does not contain a sequence of instructions, write "No instructions provided."
      
      Text:
      \`\`\`{text}\`\`\`
      
    • few-shot prompting

      • Give successful examples of completing tasks. Then ask model to perform the task.

        Your task is to answer in a consistent style.
        
        <child>: Teach me about patience.
        <grandparent>: The river that carves the deepest valley flows from a modest spring; the grandest symphony originates from a single note; the most intricate tapestry begins with a solitary thread.
        <child>: Teach me about resilience.
        
  2. 给模型时间思考

    • Specify the steps to complete a task

      Perform the following actions:
      1 - Summarize the following text delimited by triple backticks with 1 sentence.
      2 - Translate the summary into French.
      3 - List each name in the French summary
      4 - Output a json object that contains the following keys: french_summary num_names.
      
      Separate your answer with line breaks.
      
      Text:
      \`\`\`{text}\`\`\`
      
      Perform the following actions:
      1 - Summarize the following text delimited by triple backticks with 1 sentence.
      2 - Translate the summary into French.
      3 - List each name in the French summary
      4 - Output a json object that contains the following keys: french_summary num_names.
      
      Use the following format:
      Text: <text to summarize>
      Summary: <summary>
      Translation: <translation>
      Names: <list of names in Italian summary>
      Output Json: <json with summary and num_names>
      
      Text:
      \`\`\`{text}\`\`\`
      
    • Instruct the model to work out its own solution before rushing to a conclusion

      Your task is to determine if the student's solution is correct or not.
      To solve the problem do the following:
      - First, work out your own solution to the problem.
      - Second, compare your solution to the student's solution and evaluate if the student's solution is correct or not.
      Don't decide if the student's solution is correct or not until you have done the problem yourself.
      
    • reducing hallucinations(幻觉)

      • first find relavant information
      • then answer the question based on the relavant information

迭代prompt #

  1. try something
  2. analyze where the result does not give what you want
  3. clarify instructions, give more time to think
  4. refine prompts with a batch of examples

Summarizing Text #

  • summarize

    Your task is to generate a summary of a product review from an ecommerce site to give feeedback to the Shipping department.
    
    Summarize the review below, delimited by triple backticks, in at most 30 words, and focusing on any aspects that mention shipping and delivery of the product.
    
    Review: \`\`\`{review}\`\`\`
    
    Your task is to generate a summary of a product review from an ecommerce site to give feeedback to the pricing department, responsible for determining the price of the product.
    
    Summarize the review below, delimited by triple backticks, in at most 30 words, and focusing on any aspects that are relevant to the price and perceived value.
    
    Review: \`\`\`{review}\`\`\`
    
  • extract

    Your task is to extract relevant infomation from a product review from an ecommerce site to give feeedback to the Shipping department.
    

inferring #

  • infer

    What is the sentiment of the following product review, which is delimited by triple backticks?
    
    Give your answer as a single word, either "positive" or "negative".
    
    Review text: \`\`\`{review}\`\`\`