DEV Community

Cover image for Prompt Engineering: What I Learned About Getting Better Answers from Gen AI
Bella
Bella

Posted on

Prompt Engineering: What I Learned About Getting Better Answers from Gen AI

Generative AI: what is it?

The biggest challenge in using such a powerful tool as generative AI is learning how to get better answers, and how that process can be automated in some way.

I've been studying some ways to do that, and I came across prompt engineering. I really like the approach I found in the Google AI Prompt Essentials course.

Generative AI (or GenAI, for short) is software that takes a prompt, understands your request, and generates a response. It can create text, summaries and emails, answers to questions, reports and insights, computer code, images, translations, and call summaries.

Generative AI sits under the AI umbrella:

Artificial Intelligence → Generative AI → Large Language Models (LLMs) → tools such as ChatGPT

The consequence of a bad prompt

This is a gray zone. Every time you create a different prompt, you can receive a very different output. If you simply ask, "Generate a script to tell my team how to sell more," that's very vague. Which team? Sell what? What information should it use? Do you have references?

The GenAI will return a script, but it will be very poor and unfocused, because it doesn't know what you really need. That's why prompt engineering is so important.

The framework

While studying prompt engineering on Google Digital Skills, I learned a good framework that helped me get better outputs. Basically, you write your prompt based on:

Task + Context + References + Evaluate + Iterate

Evaluate: It's critical to actually read the output and evaluate whether it's coherent and heading in the direction you want for your idea.

GenAI can have hallucinations: when it returns a very confident answer that is incorrect or made up. This can happen because AI works by prediction. It's likely to produce whatever comes next based on patterns, but it doesn't "know" everything. Be careful!

Main takeaways

• A framework helps, but you can also explore other ways to improve your prompt.
• Don't rely on outputs with your eyes closed.
• Refined prompt, better results!

Top comments (0)