DEV Community

Cover image for Prompt Engineering
sachintha_ lakshan
sachintha_ lakshan

Posted on

Prompt Engineering

Image description

๐Ÿ’ก Think about Inputs and Outputs....

If the Input is confused one, the Output will also be a confused one. So, to get a good Output from anything there must be a good Input.

โžก๏ธ What is the Prompt Engineering ?

Simply, It is the skill of writing effective and clear instruction (effective and clear prompt) for AI tools like ChatGPT / Claude / Google Gemini.. to get the best Results

๐Ÿกบ ex ): When we want to get a story using AI tool ,

prompt 1 -: " Give me a story "
prompt 2 -: " Write a 10 sentence story about two best friends in a
class "

Consider these two prompts ;

  • prompt 1 > ๐Ÿ‘Ž [ bad prompt ]
  • prompt 2 > ๐Ÿ‘ [ good prompt (not bad) ]

There are not even basic instruction in prompt 1.

  • What is this story about ?
  • What is the purpose of story ?
  • How many sentences or words do you need for the story ?

So we won't get a good output using this prompt (prompt 1).

โžก๏ธ How to write a clear and effective prompt for AI tools ?

These are written under some Models. One of them is shown bellow

โญ RACEC Model

Image description

Role - Define the role or persona of the chatbot

    ex : Think like this.. / Act as that person...
Enter fullscreen mode Exit fullscreen mode

Action - Explain as you give instructions to an assistant

    ex : Write and essay, letter ,email / Analyze this sales data.
Enter fullscreen mode Exit fullscreen mode

Context - What is the Target Audience

    ex : write to university professor 
Enter fullscreen mode Exit fullscreen mode

Examples - Using examples for your prompt

Constraints and Formatting - Explain what are the necessary and
unnecessary things

๐Ÿ“ By using models like RACEC, you can structure your prompts to be more effective, creative, and useful !!!

Resources - Prof. Hiran Amarasekera ( Youtube - ๐’๐ญ๐ฎ๐๐ž๐ง๐ญ ๐‹๐š๐ง๐ค๐š )

Top comments (0)