Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Prompt Engineering - Guidelines
Sahil
SahilSubscriber

Posted on

     

Prompt Engineering - Guidelines

Prompt Engineering - Guidelines

Ask for clear and specific instructions

1. Use delimiters

Example prompt:

Summarize the text delimited by triple backticks.

This is some text to summarize.

Example output:

"This is a summary of the text."
Enter fullscreen modeExit fullscreen mode

Summary:
Delimiters help define and contain sections of the prompt, enhancing clarity and specificity.

2. Ask for structured output

Example Prompt:

"Generate a list of two book titles with authorsand genres in JSON format with keys:book_id, title, author, genre."
Enter fullscreen modeExit fullscreen mode

Example output:

"[{    "book_id": 1,    "title": "Fictional Book",    "author": "Fictional Author",    "genre": "Fiction"  },  {    "book_id": 2,    "title": "Fictional Book 2",    "author": "Fictional Author 2",    "genre": "Non-fiction"  }]"
Enter fullscreen modeExit fullscreen mode

Summary:
Requesting structured output allows the model to generate a clear, well-organized response.

3. Check whether conditions are satisfied

Example prompt:

"Rewrite these instructions in step format if present:

First, do this. Then, do that.

Example output:

"Step 1 - First, do this.Step 2 - Then, do that."
Enter fullscreen modeExit fullscreen mode

Summary:
Prompting the model to identify specific information and reformat it aids in getting responses that fulfill certain conditions.

4. Few-shot prompting - Give successful examples

Example Input:

"<child>: Teach me about patience.<grandparent>: Patience is a virtue.<child>: Teach me about kindness."
Enter fullscreen modeExit fullscreen mode

Example output:

"<grandparent>: Kindness is the act of being considerate, compassionate, and empathetic towards others."
Enter fullscreen modeExit fullscreen mode

Summary:
Providing a few successful examples before asking the final query helps guide the model to respond in a particular style or format.

Give the model time to think

  1. Specify the steps required to complete a task
    1. Ask for output in a specified format
  2. Instruct the model to work out its own solution before rushing to a conclusion

Model Limitations

  1. Hallucinations

Reducing hallucinations

First find relevant information, then answer the questions based on the relevant information


My first prompt using these guidelines:

Write a message to share on Twitter about this fantastic course I am doing:https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/2/guidelines

Please include the link to the coursehttps://learn.deeplearning.ai/chatgpt-prompt-eng/ in the message.

Please make sure the message is within the Twitter size limit.

Please make sure the content highlights the keyword "prompt engineering".

Please make sure it contains the relevant hashtags that can make the tweet popular.

Please make sure it involves some call to action so users reading can take some action on the tweet.

Output in the following format:

Tweet:

Hashtags:


Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Backend Engineer
  • Education
    IIT Jammu
  • Work
    Scaler
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp