DEV Community

MuhammedSalie
MuhammedSalie

Posted on

Mastering Prompt Engineering

How to Get the Best Responses from AI: The Secret to Winning Prompts!

If you’ve ever received vague or irrelevant answers from AI, the issue might be with the prompt itself. I’ve learned through completing the AWS AI Practitioner certification and while currently participating in the GenAI Bootcamp that how you phrase your request is key to getting precise, useful responses. Here’s a breakdown of the best ways to write prompts that yield the best results:

The COSTAR framework is a great guide for optimizing prompts when working with AI.

Image description

Source:https://towardsdatascience.com/how-i-won-singapores-gpt-4-prompt-engineering-competition-34c195a93d41

Here’s a quick recap of how each component helps get the most relevant and tailored responses:

🔹 1. Be Clear & Specific

❌ "Tell me about marketing."

✅ "As a digital marketing expert, explain SEO’s impact on website traffic for beginners in 3 paragraphs."

Clear prompts help AI understand exactly what you're asking for, which results in more focused and accurate answers. Specificity ensures the response is tailored to your needs.

🔹 2. Provide Context

The more context you give, the better AI can respond. Instead of simply saying, "Write a story," provide more details:

"Write a sci-fi story set in a post-apocalyptic world where humans coexist with AI-powered robots."

Adding context, whether for creative or technical tasks, helps AI generate more relevant outputs, something emphasized in both the GenAI Bootcamp and the AWS AI course.

🔹 3. Choose the Right Prompting Technique

Different tasks may benefit from different approaches:

Zero-shot: Direct request with no examples.

Few-shot: Provide examples to guide style, tone, or format.

Chain of Thought: Ask the AI to break down its reasoning step by step—ideal for complex problem-solving.

These techniques help guide the AI to generate responses that fit your needs more accurately.

🔹 4. Specify the Output Format & Audience

Be clear on how you want the information presented:

• "Summarize this in bullet points."

• "Explain blockchain to a 10-year-old."

AI works best when it knows exactly how to format the answer, whether it’s a summary, an explanation, or a creative piece tailored to a specific audience.

For more in-depth reading check out AWS Machine learning blog post https://aws.amazon.com/blogs/machine-learning/implementing-advanced-prompt-engineering-with-amazon-bedrock/

💡 Pro Tip: The more detailed and structured your prompt, the more spot-on the AI’s response will be!

Ready to take your AI interactions to the next level? It’s all in the art of the prompt!

Top comments (0)