Do you know how to talk to an LLM?
Javi Sanchez
@jvrsanchMastering Prompt Engineering: Amplify Your Business with AI
In modern business, the rise of AI applications, particularly large language models like GPT-4, is transforming how we work. But to truly harness their potential, we must become adept at 'prompt engineering'—the art of communicating effectively with AI. Here's your essential guide to mastering this skill and amplifying your business tasks.
Clear Instructions: The Key to Precision
AI is not a mind-reader; it thrives on clarity. When you're too vague, you get generic answers. Too specific, and you might miss out on broader insights. Strike a balance by being explicit about what you want—whether it's a brief reply, an expert analysis, or a particular format.
- Bad Prompt:
Increase sales.
- Good Prompt:
Analyze last quarter's sales data and suggest three targeted strategies to increase sales in underperforming regions.
Reference Texts: Your AI's Cheat Sheet
Just as students perform better with study notes, AI models excel when given reference texts. If you're seeking information on niche topics, provide the AI with relevant material to ensure accurate and informed responses.
- Bad Prompt:
Tell me about quantum computing.
- Good Prompt:
Using the provided 2023 quantum computing research summary, explain the key advancements in layman's terms.
Simplify Complex Tasks: Divide and Conquer
Break down intricate tasks into smaller, manageable chunks. This not only reduces errors but also makes the process more efficient. Think of it as creating a workflow where each step builds upon the previous one.
- Bad Prompt:
Plan our product launch.
- Good Prompt:
Outline the first three steps for the pre-launch phase of our new product, focusing on market analysis, budget planning, and timeline creation.
Adopting a Persona: Humanizing AI Interactions
Sometimes, you might want the AI to embody a certain character or tone. This can make interactions more engaging or appropriate for the context.
- Bad Prompt:
Write a response.
- Good Prompt:
As a friendly and knowledgeable assistant, provide a welcoming response to a new user inquiring about our services.
Delimiters: Organizing Your Prompts
Use delimiters like quotation marks or bullet points to separate different parts of your prompt. This helps the AI understand and structure its responses more effectively.
- Bad Prompt:
Summarize this and translate it to French.
- Good Prompt:
Summarize the following text: '...'. Now, translate the summary to French.
Providing Examples: The Power of Few-Shot Prompting
When it's challenging to describe what you want, show the AI examples of the desired output. This is known as "few-shot" prompting.
- Bad Prompt:
Answer customer emails.
- Good Prompt:
Here are three examples of how we've successfully handled customer emails in the past. Please respond to the new customer email in a similar style.
Specifying Output Length: Tailoring Your Responses
You can instruct the AI to tailor its responses to a specific length, ensuring conciseness or detail as needed.
- Bad Prompt:
Give me a summary.
- Good Prompt:
Provide a summary in no more than three sentences.
Citations: Enhancing Credibility and Accuracy
Encourage the AI to back up its responses with citations from provided reference texts, which adds credibility and accuracy to the information.
- Bad Prompt:
Explain the theory of relativity.
- Good Prompt:
Using the provided textbook excerpt on the theory of relativity, explain the key concepts and cite the relevant sections.
Patience Pays Off: Give AI Time to "Think"
Encourage the AI to reason through problems step by step. This approach often yields more accurate results, as the AI has the opportunity to "think" before providing a solution.
- Bad Prompt:
How to fix a supply chain issue?
- Good Prompt:
Identify the root causes of the supply chain bottleneck observed in Q4 2023, and propose a step-by-step mitigation plan.
External Tools: Enhance AI Capabilities
AI's limitations can be offset by integrating other tools. For calculations or data retrieval, use specialized functions or APIs to assist the AI, ensuring more reliable outcomes.
- Bad Prompt:
Calculate the most efficient delivery routes.
- Good Prompt:
Use the Route Optimization API to calculate the most efficient delivery routes for our fleet, considering current traffic conditions.
Systematic Testing: Measure to Improve
To truly know if changes to your AI prompts are effective, you need a systematic approach. Develop a comprehensive test suite with a diverse set of examples to evaluate performance improvements accurately.
- Bad Prompt:
Is this prompt better?
- Good Prompt:
Compare the response rates of the original customer service prompt and the revised version over a sample of 100 customer interactions.
By mastering these strategies, you'll be well on your way to leveraging AI to its full potential, making your business operations smarter, faster, and more efficient. Welcome to the future of work, where prompt engineering is your gateway to a world of possibilities with AI.
Examples of Well-Engineered Prompts leveraging Stack AI built-in tools
Let's put theory into practice with three examples of well-engineered prompts for common business applications:
Email Compliance Review System
Instructions:
You review emails to check for compliace. You will receive a set of guidelines on how to review it and an user message with the email.
Respond with a JSON with the keys:
1. "compliant": "YES" or "NO".
2. "score": a real number between 0 and 1 (1 is 100% compliant, 0 is not).
If the email is compliant, respond with {{"score": 1.0, "compliant": "YES"}}
otherwise, respond with {{"score": 0.0, "compliant": "NO"}}
Prompt:
Guidelines to review the email:
<guidelines>{docemb-0}</guidelines>
User message: {gmail_in-0}
Response (in JSON):
Where {docemb-0} is a variable containing the guidelines applicable to the specific email, and {gmail_in-0} the email the user is sending for review.
Azure Knowledge Base Assistant
Instructions:
You are a helpful AI assistant that answers questions on a knowledge base stored in Azure cloud. You will receive snippets of the database on each message as 'context'.
1. Be brief.
2. Be professional.
3. Cite from which documents you go the answer at the end of each message.
Prompt:
Context to answer questions:
<documents>{azureblob-0}</documents>
Do not answer the user question if the answer is not above.
User message: {in-0}
Where {azureblob-0} is a variable containing the knowledge from your Azure's Blog Storage, and {in-0} the user message sent to the assistant.
By crafting prompts like these, businesses can ensure that their AI tools are providing valuable, contextually relevant, and actionable information that can directly benefit their operations and customer interactions in an autometed fashion.
Conclusion
In conclusion, effective communication with AI through prompt engineering is essential for leveraging its full potential in business applications. Here's a quick TL;DR to sum up the key points:
- Be Clear and specific: Provide detailed instructions for precise responses.
- Adopt a Persona: Humanize AI interactions by asking it to adopt a specific character or tone.
- Use Delimiters: Clearly indicate distinct parts of the input for better-structured responses.
- Provide Examples: Use "few-shot" prompting to demonstrate the desired style or format.
- Use References: Supply relevant texts for more accurate information.
- Break It Down: Simplify complex tasks into smaller steps.
- Allow 'Thinking' Time: Encourage the AI to reason through problems.
- Utilize Tools: Integrate external tools for enhanced capabilities.
- Specify Output Length: Direct the AI to produce responses of a certain length.
- Cite References: Instruct the AI to use citations from provided texts to enhance response quality.
- Test Systematically: Evaluate changes with a diverse set of examples for reliable improvements.
Integrate AI into your business with pre-built blocks. Use any model, securely connect your data, and ship bespoke AI solutions without coding.
Start leveraging these prompt engineering strategies today.
Try it out