
Master Prompt Engineering: Build AI apps with Claude & PartyRock
In this article, you'll learn about prompt engineering techniques and best practices, explore practical strategies to boost your productivity with Claude, and get step-by-step guidance on how to use PartyRock to build AI apps without coding, simply by crafting prompts.
fix grammar: <Text>
But sometimes, AI assistants try to be overly helpful, rephrasing your words and adding extra context. As you can see on the video below, Claude AI assistant rephrased my original text extending it from 5 lines to 6 lines, which wasn’t my intention.Act as you are an English teacher. Please help me to fix my message. I want you to strictly correct my grammar mistakes and typos and keep my natural tone of voice:
Message: <Message>
A prompt includes various elements, each serving a specific purpose in guiding the response of LLM. Let’s look at a breakdown of some common elements.
- Instruction: “Act as you are an experienced Data Scientist. Consider the context below to answer the user’s questions with a friendly tone. Provide a short concise answer.”
- Context: “You are at a meeting with customers from a manufacturing company that are interested in starting developing generative AI applications. They have a question.”
- User Input: “We would like to establish success criteria for our first POC. Can you suggest metrics?”
Pro tip: Directly allow it to say "I don't know" when an AI assistant is unsure of the answer to your question. This will significantly reduce the chance of an AI assistant inadvertently generating false information, often referred to as "hallucinations".
In this example, we ask Claude to help us with the classification of AWS certifications by difficulty level without offering extra details. By clearly defining the target classifications (easy, intermediate, or difficult) and outlining the expected output format, we guide the model to make accurate predictions .
Classify the following certification exam as either easy, intermediate or difficult: [AWS Solutions Architect Associate]. If you don't know you can say I don't know or ask for more information.
Without knowing more about the specifics, I would guess the AWS Solutions Architect Associate certification exam may be at an intermediate level of difficulty for most candidates. But the actual experience can vary based on individual's existing AWS and cloud architecture knowledge. Let me know if you need any clarification or have additional details to help assess the difficulty level.
Pro tip: Start with simple examples and gradually move to more complex ones, progressively building the model's understanding. This step-by-step approach helps the model better process new information.
Similar to the previous example, we ask to classify AWS certifications by difficulty level, but this time we provide a few examples to guide the model.
AWS Cloud Practitioner is an example of easy difficulty exam
AWS Solutions Architect Associate is an example of intermediate difficulty exam
AWS Specialty Machine Learning is an example difficult difficulty exam
Classify AWS Networking Specialty Certification
Based on the examples you have provided for easy, intermediate and difficult AWS certification exams, I would classify the AWS Networking Specialty certification exam as difficult.
Pro tip: Use the phrase "Think step by step" in your prompt to invoke CoT reasoning. This method is particularly useful for tasks that involve multiple layers or stages, as it encourages the AI to outline its thought process for each stage, making the reasoning transparent and the conclusions well-founded.
In this example, we ask to create a study plan for an AWS certification that incorporates different types of resources that have to be planned week-by-week.
Create a weekly preparation plan for AWS Cloud Practitioner exam. Before answering, think step-by-step and break down the plan into study topics. For each week, suggest a study topic that includes the following resources: a lesson from a video course, official documentation (FAQs, whitepapers, guides), and a hands-on exercise for practice (workshop, hands-on lab, tutorial).
Here is a suggested 6 week preparation plan for the AWS Cloud Practitioner certification exam:
Week 1:
Study Topic: AWS Cloud Concepts
Video Lesson: AWS Cloud Concepts from acloud.guru
Official Documentation: AWS Whitepaper Overview
Hands-On: Sign up for AWS free tier account
....
One challenge of constructing long prompts that include context is token limitation, which defines how much context they can process at one time. For Claude 2.1, the limit is currently 200,000 tokens translating to roughly 150,000 words, or over 500 pages of material and trained on data up to December 2022. The latest model GPT-4 Turbo has context window 128,000 tokens and trained on data up to April 2023.
To manage documents exceeding this limit, enclose lengthy text within XML tags to distinguish it from direct instructions. This ensures clarity and helps the LLM focus on relevant input portions.
Pro tip: For document Q&A, ask the question at the end of the prompt after other input information. Additionally, instruct Claude to identify quotes from the document related to your query before providing an answer. This step ensures that answers are directly linked to the content in the document, improving the relevance and accuracy of AI responses.
You're considering a new certification and are intrigued by the recently announced AWS Certified Data Engineer - Associate certification, which Claude doesn't yet know about. To help Claude advise which certification best aligns with your skills and goals, you download the exam guides for both the new AWS Certified Data Engineer - Associate and the AWS Certified Developer - Associate and provide them to Claude. You ask Claude to make a recommendation on which certification you should pursue based on your career objectives.
Read the attached documents carefully, because I'm going to ask you a question about it.
First, find the quotes from the document that are most relevant to answering the question, and then print them in numbered order. Quotes should be relatively short. If there are no relevant quotes, write "No relevant quotes" instead.
Then, answer the question, starting with "Answer:". Do not include or reference quoted content verbatim in the answer. Don't say "According to Quote [1]" when answering. Instead make references to quotes relevant to each section of the answer solely by adding their bracketed numbers at the end of relevant sentences.
Here is the first question:
I am considering to take an AWS certification exam. I've been building serverless data analytics pipeline for 3 years using services such as AWS Glue, AWS Step Functions, Amazon Redshift. Which certification should I take?
If the question cannot be answered by the document, say so.
<documents>
Quote 1: The AWS Certified Data Engineer - Associate (DEA-C01) exam validates a candidate’s ability to implement data pipelines and to monitor, troubleshoot, and optimize cost and performance issues in accordance with best practices.
The exam also validates a candidate’s ability to complete the following tasks:
Ingest and transform data, and orchestrate data pipelines while applying programming concepts.
.....
Answer: Based on the quotes, I would recommend taking the AWS Certified Data Engineer - Associate (DEA-C01) exam given your 3 years of experience building serverless data analytics pipelines using relevant AWS services like AWS Glue, AWS Step Functions, and Amazon Redshift. The DEA-C01 exam validates skills in data ingestion, transformation, pipeline orchestration, data store management, operations, security, and governance, which aligns with your background. Meeting the 2-3 years data engineering experience and 1-2 years hands-on AWS experience requirements makes you a good fit as the target candidate for this certification exam.
</documents>
- What information will users need to provide? This will be entered into my input widget.
- What information will the app generate? This will be displayed in my output widget.
- What type of information will be created? It could be an image or text.
- Do I need to include a chatbot assistant as part of my app?
This app will suggest an AWS certification that aligns with the user's career goals and create a weekly study plan based on the time the user can allocate for preparation.
Pretend you are an AWS Instructor. You suggested an AWS Certification in @Suggested Certification based on the user goals in @User Goal and allocated study time specified in @Study Time. The user will now have a follow up conversation with you.
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.