Unlocking the Secrets of Prompt Engineering: Master the art of creative language generation to accelerate your journey from novice to pro
By Gilbert Mizrahi and Daniel Serfaty
()
Related to Unlocking the Secrets of Prompt Engineering
Related ebooks
Building LLM Powered Applications: Create intelligent apps and agents with large language models Rating: 0 out of 5 stars0 ratingsHuman Robot Agent: New Fundamentals for AI-Driven Leadership with Algorithmic Management Rating: 0 out of 5 stars0 ratingsSuccessful AI Product Creation: A 9-Step Framework Rating: 0 out of 5 stars0 ratingsAI In a Weekend An Executive's Guide Rating: 0 out of 5 stars0 ratingsAgentic AI and the Rise of the Digital Colleague: How agentic AI is transforming the workplace and reshaping the future of work Rating: 0 out of 5 stars0 ratingsThe Ai Republic: Building the Nexus Between Humans and Intelligent Automation Rating: 3 out of 5 stars3/5Explanation Based Learning: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsThe AI Value Playbook: How to make AI work in the real world Rating: 0 out of 5 stars0 ratingsMulti Agent System: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsBasics of Python Programming: Learn Python in 30 days (Beginners approach) - 2nd Edition Rating: 0 out of 5 stars0 ratingsPushing to the Front Rating: 0 out of 5 stars0 ratingsStudy Guide of Unit X by Raj M. Shah and Christopher Kirchhoff ( chapter clarity) Rating: 0 out of 5 stars0 ratingsMachine Learning: Hands-On for Developers and Technical Professionals Rating: 0 out of 5 stars0 ratingsImplementing Cryptography Using Python Rating: 0 out of 5 stars0 ratingsBuilding a Recommendation System with R: Learn the art of building robust and powerful recommendation engines using R Rating: 0 out of 5 stars0 ratingsArtificial Intelligence Rating: 0 out of 5 stars0 ratingsAlgorithmic Information Theory: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsTheory of Technology Evolution Rating: 0 out of 5 stars0 ratingsRecurrent Neural Networks: Fundamentals and Applications from Simple to Gated Architectures Rating: 0 out of 5 stars0 ratingsRational Rhetoric: The Role of Science in Popular Discourse Rating: 0 out of 5 stars0 ratingsONE: The Story of the Ultimate Myth Rating: 0 out of 5 stars0 ratingsStatistical Semantics: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsGraph Data Science with Python and Neo4j Rating: 0 out of 5 stars0 ratingsPredicting Malicious Behavior: Tools and Techniques for Ensuring Global Security Rating: 0 out of 5 stars0 ratingsBayesian Methods in Finance: Probabilistic Approaches to Market Uncertainty Rating: 0 out of 5 stars0 ratingsComplexity Rating: 0 out of 5 stars0 ratingsRaising Heretics: Teaching Kids to Change the World Rating: 0 out of 5 stars0 ratingsWar Economy: Strategies of Resource Mobilization, Navigating Conflict's Fiscal Frontlines Rating: 0 out of 5 stars0 ratings
Intelligence (AI) & Semantics For You
Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Generative AI For Dummies Rating: 2 out of 5 stars2/5Artificial Intelligence: A Guide for Thinking Humans Rating: 4 out of 5 stars4/5Writing AI Prompts For Dummies Rating: 0 out of 5 stars0 ratingsChatGPT Millionaire: Work From Home and Make Money Online, Tons of Business Models to Choose from Rating: 5 out of 5 stars5/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 4 out of 5 stars4/5100M Offers Made Easy: Create Your Own Irresistible Offers by Turning ChatGPT into Alex Hormozi Rating: 5 out of 5 stars5/5The Secrets of ChatGPT Prompt Engineering for Non-Developers Rating: 5 out of 5 stars5/5AI for Educators: AI for Educators Rating: 3 out of 5 stars3/5Midjourney Mastery - The Ultimate Handbook of Prompts Rating: 5 out of 5 stars5/5AI Money Machine: Unlock the Secrets to Making Money Online with AI Rating: 5 out of 5 stars5/5The ChatGPT Revolution: How to Simplify Your Work and Life Admin with AI Rating: 0 out of 5 stars0 ratings80 Ways to Use ChatGPT in the Classroom Rating: 5 out of 5 stars5/5Chat-GPT Income Ideas: Pioneering Monetization Concepts Utilizing Conversational AI for Profitable Ventures Rating: 4 out of 5 stars4/53550+ Most Effective ChatGPT Prompts Rating: 0 out of 5 stars0 ratingsThe Roadmap to AI Mastery: A Guide to Building and Scaling Projects Rating: 3 out of 5 stars3/5Artificial Intelligence For Dummies Rating: 3 out of 5 stars3/5Coding with AI For Dummies Rating: 1 out of 5 stars1/5A Quickstart Guide To Becoming A ChatGPT Millionaire: The ChatGPT Book For Beginners (Lazy Money Series®) Rating: 4 out of 5 stars4/5THE CHATGPT MILLIONAIRE'S HANDBOOK: UNLOCKING WEALTH THROUGH AI AUTOMATION Rating: 5 out of 5 stars5/5The Ultimate ChatGPT Handbook Rating: 0 out of 5 stars0 ratingsChatGPT For Fiction Writing: AI for Authors Rating: 5 out of 5 stars5/5Thinking in Algorithms: Strategic Thinking Skills, #2 Rating: 4 out of 5 stars4/5
Reviews for Unlocking the Secrets of Prompt Engineering
0 ratings0 reviews
Book preview
Unlocking the Secrets of Prompt Engineering - Gilbert Mizrahi
Unlocking the Secrets of Prompt Engineering
Copyright © 2023 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Group Product Manager: Niranjan Naikwadi
Publishing Product Manager: Nitin Nainani
Book Project Manager: Aishwarya Mohan
Senior Content Development Editor: Debolina Acharyya
Technical Editor: Reenish Kulshrestha
Copy Editor: Safis Editing
Proofreader: Safis Editing
Indexer: Manju Arasan
Production Designer: Jyoti Kadam
DevRel Marketing Coordinators: Vinishka Kalra
First published: January 2024
Production reference: 1111223
Published by Packt Publishing Ltd.
Grosvenor House
11 St Paul’s Square
Birmingham
B3 1RB, UK
ISBN 978-1-83508-383-3
www.packtpub.com
To my incredible wife, Maria Olga – you are my rock and my best friend. Thank you for always believing in me. To my son, Daniel, and daughter, Andrea – you both make me strive to be a better person every day. Your unwavering belief in me gave wings to this dream. This book is for you.
– Gilbert Mizrahi
Foreword
In the dynamic and fast-evolving landscape of AI (artificial intelligence), Gilbert Mizrahi’s latest book on the new discipline of Prompt Engineering stands as a beacon of practical knowledge and insight. As Founder and CEO of Aptima, Inc., I have known the author for more than 20 years since we were colleagues in the Company, inventing novel ways to engineer productive collaborations between humans and machines. It is my distinct honor and privilege to introduce this comprehensive and pioneering work.
Gilbert has always been at the forefront of innovation and technology since his days at Stanford, and this book is a testament to his deep understanding and insightful approach to large language models (LLMs) and generative AI. This work is not just a technical guide; it is a journey through the complex world of prompt engineering, underscored by a commitment to sound practices and a deep understanding of the transformative power of AI.
The book begins with a solid foundation in the basics of LLMs and moves through the intricacies of prompt engineering with the precision and clarity rarely found in the computer science and engineering field. His emphasis on ethics throughout the book is particularly commendable, ensuring that as we advance technologically, we do so with a conscientious mindset. As we experience throughout the book, prompt engineering is akin to crafting a meticulous recipe, where each ingredient – or, in this case, each element of the prompt – must be carefully honed to guide LLMs towards desired outcomes.
As we delve into the subsequent chapters of this incredible journey, the book masterfully decomposes and then synthesizes the core concepts. It also highlights innovative applications of prompt engineering across various industries. We are given a vivid glimpse into the future where prompt engineering could revolutionize fields like healthcare, offering compelling applications in clinical decision support, patient education, and drug discovery.
Gilbert’s foresight in anticipating future trends and breakthroughs in LLMs underscores the need for collaboration and continual learning in this field. His exploration of the diverse applications of LLMs illustrates their potential to fundamentally transform nearly every industry and domain. The book not only serves as a technical guide but also as a behavioral compass in the digital age, emphasizing the need for wisdom, care, and transparency as these capabilities advance.
In conclusion, Gilbert Mizrahi’s book is an indispensable resource for both newcomers and seasoned professionals in AI. It is a guide to understanding and mastering the art and science of prompt engineering to establish a fruitful dialog between the human user and the artificial intelligence, and a reminder of the collaborative effort required to harness its full potential responsibly. This book is a beacon for those navigating the evolving landscape of AI, reflecting a profound understanding of the technological, ethical, and practical aspects of LLMs.
I recommend this book to all who seek to explore the extraordinary possibilities of AI and prompt engineering. It is with great pride that I introduce this significant contribution to the field of AI, celebrating the achievements of a long-time colleague and friend.
Daniel Serfaty
Founder and CEO
Aptima, Inc.
Contributors
About the author
Gilbert Mizrahi is a product strategist, educator, and seasoned entrepreneur with a proven track record across a variety of industries. He brings a wealth of knowledge and experience in interactive data visualization, product strategy innovation, generative AI, and Software as a Service (SaaS). As a co-founder of Twnel, Gilbert steers product R&D, leveraging his expertise in artificial intelligence to craft cutting-edge solutions that enhance communication and productivity for businesses. His passion for data science and product growth is mirrored in his ventures.
He holds a master’s degree in operations research from Stanford University and a bachelor’s degree in industrial engineering. Gilbert's extensive background includes serving as a mentor at MassChallenge and Newchip Accelerator, business strategy and product development consultant at Looi Consulting, and holding senior research and technology positions at Aptima Inc.
Gilbert's forward-thinking approach, entrepreneurial spirit, and dedication to fostering innovation make him a vanguard in the application of generative AI and strategy in product development.
About the reviewers
Daniel Mizrahi, a software engineer at Google, specializes in automating third-party service deployments to Google Cloud. Over the past two years, he has focused on creating systems that not only enhance operational efficiency but also pave the way for more advanced cloud-based applications. His experience has given him a profound understanding of the nuances of modern cloud-based systems.
Before his current role at Google, Daniel was on the Amazon Prime Video team, working specifically on a portal for content providers. This experience honed his skills in creating user-focused software solutions and deepened his appreciation of the intricate relationship between software engineering and digital content distribution.
Daniel holds a master’s degree in computer science from the University of Southern California with a focus on machine learning and artificial intelligence. Daniel’s academic background forms the bedrock of his technical expertise.
Divit Gupta, a seasoned IT professional with 20 years of industry expertise, excels in driving strategic architecture initiatives and providing leadership in multi-pillar sales cycles. With a global impact, he spearheads technical partnerships, defines team vision, and champions new strategic endeavors.
As the host of popular podcasts such as Tech Talk with Divit, Live Labs with Divit, and Cloud Bites with Divit, he showcases Oracle’s technological initiatives and leadership. In 2022–23, he served as Oracle TV’s correspondent for Cloud World. His passion for knowledge sharing extends to international conference talks, technical blogs, and multiple books on emerging technologies.
A recognized expert, Divit presented on Oracle Database technology at Oracle CloudWorld FY 2023. Holding over 40 certifications from Microsoft, Oracle, AWS, and Databricks, he remains at the forefront of technology.
David Santiago Castillo, with an extensive tenure of over a decade at Twnel, is a seasoned software developer who has played a pivotal role in the evolution of the company’s communication platform. Twnel, initially founded as a messaging platform, has since transformed into a cutting-edge solution that automates business processes through conversational user interfaces. In the rapidly evolving landscape of AI and natural language processing, David has been at the forefront of harnessing the power of large language models to enhance and expand Twnel’s automation capabilities.
Table of Contents
Preface
Part 1: Introduction to Prompt Engineering
1
Understanding Prompting and Prompt Techniques
Technical requirements
Introducing LLM prompts
How LLM prompts work
Architecture
LLM training
A journey from prompt to reply – how inference helps LLMs fill in the blanks
Types of LLM prompts
Components of an LLM prompt
Adopt any persona – role prompting for tailored interactions
Few-shot learning – training models with example prompts
Finding your voice – defining personality in prompts
Using patterns to enhance prompt effectiveness
Mix and match – strategic combinations for enhanced prompts
Exploring LLM parameters
How to approach prompt engineering (experimentation)
The challenges and limitations of using LLM prompts
Summary
2
Generating Text with AI for Content Creation
Using AI for copywriting
Creating social media posts
Writing a Twitter thread
Writing an Instagram post
Producing high-converting sales copy
Writing video scripts
Generating blog posts, articles and news
Creating engaging content with AI
How to use AI for personalized messaging
Creating tailored content with AI
Summary
Part 2: Basic Prompt Engineering Techniques
3
Creating and Promoting a Podcast Using ChatGPT and Other Practical Examples
Crafting podcast questions for celebrity guests
Preparing podcast questions with everyday guests
Identify topics, ideas, and potential guest speakers for your podcast
Using AI to promote a podcast
Writing a summary of the podcast episode
Crafting engaging quotes for social media promotion
Conceptualizing podcast highlight reels
Repurposing podcasts into shareable blog content
Identifying insightful interview questions
Sharpening interview skills with AI-generated responses
Generating strategic questions for client engagements with AI
Summary
4
LLMs for Creative Writing
Using AI for creative writing
Using AI to generate fiction
Using AI to write poetry
Summary
5
Unlocking Insights from Unstructured Text – AI Techniques for Text Analysis
Sentiment analysis – AI techniques for emotion detection in text
Organizing unstructured data – using AI for automated text categorization and data classification
Cleaning up dirty data – how AI identifies and resolves issues in datasets
Making sense of unstructured data – pattern matching for information extraction
Summary
Part 3: Advanced Use Cases for Different Industries
6
Applications of LLMs in Education and Law
Creating course materials with ChatGPT
Creating handouts and other materials
Creating handouts for the unit
Creating solved examples
Word problems
Creating quizzes
Creating rubrics
Creating cloze comprehension tests
AI for legal research
Reviewing legal documents using an LLM
Drafting legal documents with an LLM
AI for legal education and training
LLMs for eDiscovery and litigation support
AI for intellectual property (IP) management
Other applications of LLMs for lawyers
Summary
7
The Rise of AI Pair Programmers – Teaming Up with Intelligent Assistants for Better Code
Code generation with coding assistants
From confusion to clarity – AI explains what code does in plain English
Commenting, formatting, and optimizing code
Fixing faulty code – how AI transforms the debugging process
Translating code from one language to another
Case study 1 – developing a website code using AI
Case study 2 – creating a Chrome extension using AI
Summary
8
AI for Chatbots
Technical requirements
How to use GPT-4 APIs and other LLM APIs to create chatbots
Building conversational interfaces with LLM APIs
How to use AI for customer support
Case study – a chatbot using AI to assist users in ordering products
Case study – creating interactive quizzes/assessments and deploying them as chatbot flows
Summary
9
Building Smarter Systems – Advanced LLM Integrations
Automating bulk prompting with spreadsheets
Integrating LLMs into your tech stack using Zapier and Make
Creating and translating product descriptions
Moving beyond APIs – building custom LLM pipelines with LangChain
LangChain’s building blocks
LangChain's no-code tools – Langflow and Flowise
LangSmith – debug, test, and monitor your LLM workflows
The future of LLM integration – plugins, agents, assistants, GPTs, and multimodal models
Summary
Part 4: Ethics, Limitations, and Future Developments
10
Generative AI – Emerging Issues at the Intersection of Ethics and Innovation
Exploring the ethical challenges of generative AI
Trust and accountability challenges of generative AI
Economic impact considerations
Environmental sustainability issues
Societal risks and reflections
Broader societal impacts
What machine creativity reveals about cognition
Concerns in defense and healthcare
The path forward – solutions and safeguards
Summary
11
Conclusion
Recap of the book’s content
Expanding possibilities – innovative prompt engineering applications
Achieving intended outcomes – prompt engineering goals
Understanding limitations and maintaining oversight
Summary
Index
Other Books You May Enjoy
Preface
The advent of large language models (LLMs), such as GPT-4, Bard, and Claude, represents a seismic shift in artificial intelligence (AI) capabilities. Fueled by vast datasets and compute power, these models can generate astonishingly human-like text and engage in complex dialogue. However, their potential is only fully realized through the art of prompt engineering – the process of carefully crafting the prompts that activate the models. Prompts encode instructions, context, examples, and guardrails to channel the models’ capabilities for specific tasks. Mastering prompt engineering unlocks the immense power of LLMs for a myriad of applications, from content creation to data analysis and beyond.
This book serves as a practical guide to prompt engineering across different domains. Through concrete examples and real-world case studies, readers will learn effective techniques for decomposing problems into discrete prompts, providing relevant background knowledge, iteratively refining prompts, and shaping model outputs. The journey equips readers with strategies to tap into the versatility of LLMs with properly engineered prompts. By following the techniques in this book, anyone can harness the problem-solving skills of AI systems such as GPT-4 and Claude to build solutions that create real value.
Who this book is for
Unlocking the Secrets of Prompt Engineering is written for anyone who wants to become an expert at crafting prompts for AI systems such as ChatGPT. Whether you’re a total beginner or have some experience in prompt engineering, this book will help you master the art and science of creating effective prompts. I’ve designed it for a broad audience, including students, researchers, entrepreneurs, marketers, customer service agents, and other professionals who want to utilize the power of prompts to get the most out of AI. My goal is to provide actionable strategies and techniques you can apply right away to improve your prompting skills. By the end of the book, you’ll know how to structure prompts that clearly communicate your intent, include the right amount of context and examples, and elicit the desired response from an AI system. The practical knowledge in this book will make you a prompt engineering pro!
What this book covers
Chapter 1, Understanding Prompting and Prompt Techniques
This introductory chapter provides a comprehensive overview of LLM prompts and the foundations of prompt engineering. It explores the components of prompts, different prompting techniques, LLM parameters, and a systematic framework for experimentation to craft effective prompts. The chapter also discusses challenges such as verbosity and inconsistency that need to be addressed. By equipping you with core knowledge about prompt engineering and how to guide LLM behavior, this chapter lays the groundwork for harnessing the power of AI for diverse applications in the following chapters.
Chapter 2, Craft Compelling Content Faster with AI Assistance
This chapter explores leveraging AI tools such as ChatGPT to generate, outline, and draft initial versions of content including social media posts, sales copy, video scripts, and articles. It covers providing context and examples to guide the AI, personalizing messaging, customizing the tone and voice, and refining the raw AI output. While AI shows promise to enhance human creativity and productivity in content creation through these techniques, human oversight remains critical. The key lessons focus on thoughtfully combining AI assistance with human creativity and intent to develop engaging and high-quality content.
Chapter 3, Creating and Promoting a Podcast Using ChatGPT and Other Practical Examples
This chapter provides practical examples of leveraging AI tools, for example, ChatGPT, for tasks such as crafting an engaging podcast and job interview questions. It explores prompts and techniques to identify podcast topics, potential guests, and promotional content. For job interviews, it covers how both interviewers and candidates can use AI to strategize relevant questions and thoughtful answers. The key lessons focus on using AI to accelerate preparation, idea generation, and content creation for podcasts and interviews while enhancing human creativity.
Chapter 4, LLMs for Creative Writing
This chapter explores how writers can leverage AI tools such as ChatGPT to enhance different aspects of the creative writing process. It provides examples of crafting prompts to generate ideas, characters, and plots for fiction as well as techniques for writing original poetry. The key lessons focus on using AI to spark imagination while retaining authorial vision and voice. With the right balance of human creativity and AI assistance, these models can accelerate idea generation, improve drafts through editing, and open new creative frontiers.
Chapter 5, Unlocking Insights from Unstructured Text - AI Techniques for Text Analysis
This chapter explores key applications of AI techniques such as sentiment analysis, data classification, data cleaning, and pattern matching to extract insights from unstructured text. It provides examples of using these techniques to perform tasks such as gauging emotion in content, categorizing data, resolving inconsistencies, and extracting structured information. The key lessons focus on leveraging AI to automate the analysis of qualitative data, saving time and effort while improving accuracy. With the right techniques, AI enables anyone to unlock value from the proliferation of unstructured text data.
Chapter 6, Applications of LLMs in Education and Law
This chapter demonstrates applications of AI systems such as ChatGPT in education and legal domains. It provides examples of using these tools to generate personalized course materials, practice questions, and rubrics tailored to learning objectives. For legal professionals, the chapter explores leveraging LLMs for research, drafting documents, intellectual property management, training law students, and other emerging use cases. However, human validation of AI responses remains critical. When thoughtfully implemented, tools such as ChatGPT show immense potential to assist professionals in education, law, and other fields by automating repetitive tasks and enhancing productivity.
Chapter 7, The Rise of AI Pair Programmers - Teaming Up with Intelligent Assistants for Better Code
LLMs such as GPT-4 are transforming coding by generating functional code blocks, explaining code, debugging, optimizing performance, and translating between programming languages. This chapter provides case studies demonstrating the use of AI to rapidly develop website code and Chrome extensions, allowing developers to focus on design rather than rote coding tasks. AI coding assistants such as GitHub Copilot leverage GPT-3 and GPT-4 to provide autonomous code generation tailored to developers’ needs. While AI can accelerate development, human oversight is still needed to review and refine the generated code before deployment. AI is unlikely to wholly replace developers soon, but it can augment human creativity and problem-solving abilities in coding. The future will involve fluent human-AI collaboration, with coders and assistants working together symbiotically.
Chapter 8, Conversational AI – Crafting Intelligent Chatbot LLMs
Chatbots powered by LLMs such as GPT-3/4 and Claude are transforming conversational AI and enabling more natural, human-like digital experiences. As demonstrated through the detailed examples in this chapter, these powerful generative models allow bots to truly understand natural language, hold free-flowing conversations with users, and complete sophisticated workflows from commerce transactions to personalized assessments.
The key to unlocking their capabilities is thoughtful prompt engineering. Developers can inject critical context, domain knowledge, business logic, data sources, and more into the prompts to shape the bot’s behavior. While interacting in the playground provides a glimpse of the potential, custom solutions built on LLM APIs open up many more possibilities.
Chapter 9, Building Smarter Systems – Advanced LLM Integrations
This chapter explored various techniques for integrating LLMs into practical workflows to unlock new possibilities. Easy-to-use templates such as SheetSmart simplify setting up formulas in spreadsheets to prompt LLMs such as GPT-3.5 in bulk. More powerful automation platforms such as Zapier and Make enable connecting web applications into pipelines with LLM APIs. This allows automating processes such as generating competitive intelligence briefings by ingesting data sources into an LLM.
For full customization, developer tools such as LangChain, Flowise, and Langflow provide frameworks for building sophisticated LLM applications involving reasoning, conversation, and contextual recommendations. The walk-throughs in this chapter demonstrate sample integrations for extracting insights from customer data to enrich CRM systems and conversing with PDF documents using LLMs.
Chapter 10, Generative AI – Emerging Issues at the Intersection of Ethics and Innovation
Generative AI introduces profound challenges around trust, accountability, bias risks, economic impacts ranging from productivity gains to job displacement, massive computational needs threatening sustainability, subtle societal risks, and philosophical questions around machine creativity. Solutions require collaboration on ethics by design, algorithmic assessments, thoughtful regulations, inclusive governance, and upholding human rights. The choices made today on AI ethics and governance will have profound implications. With humanism guiding development, these technologies can be steered toward uplifting and enriching society.
Chapter 11, Conclusion
Prompt engineering represents a breakthrough in guiding generative AI systems such as LLMs to automate tasks and enhance human capabilities across industries. Meticulously refining prompts based on outputs is key to steering these models, much like adjusting ingredients when cooking. For now, human expertise remains essential to oversee AI’s nascent abilities. Looking ahead, techniques such as conditional and causality prompting could enable more reliable, personalized applications. Healthcare and other fields, such as engineering and finance, exhibit immense potential for prompt engineering to assist professionals. However, we must acknowledge the current limitations and implement thoughtful governance to manage risks responsibly. Platforms integrating models with services and tools customizing outputs by training on unique data will expand the possibilities further. While focused on text generation, prompt engineering will grow even more versatile as multimodal LLMs advance.
Overall, this book provides an introductory survey of techniques to ignite exciting possibilities for transforming nearly every facet of life and work through thoughtful prompt engineering.
To get the most out of this book
To get the most out of this book on prompt engineering, you need access to OpenAI’s ChatGPT, Anthropic’s Claude 2, and Google’s Bard. We start from fundamentals, so no deep technical expertise is required. You should be keen to engage creatively and iteratively in crafting effective language model prompts. An inquiring mindset will be rewarded as prompt engineering develops skills in articulating tasks and unlocking capabilities. Our goal is to set you on a self-directed journey.
We primarily focus on crafting prompts for OpenAI’s ChatGPT, Claude from Anthropic, and Google’s new Bard language model, covering the available techniques across these industry-leading systems. The code and examples are compatible with macOS, Windows 10+, or common Linux distributions. Hardware requirements are modest – an internet connection and computer from the past 5-7 years will suffice.
We’ve structured the book to accelerate applying prompt engineering to real problems. If grasping concepts rapidly and jumping quickly into hands-on activities suits your learning style, you have found the right guide.
Download the example code files
There is a code file in ch 08 whose github link has been pasted below https://github.com/PacktPublishing/Unlocking-the-Secrets-of-Prompt-Engineering/tree/main
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Conventions used
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: The only thing that changed was that browser-action changed to action in the manifest.
Prompts are written as follows:
For the first set of questions, provide for each three potential good answers
Responses to prompts are written as follows:
1. As a successful solopreneur, how important do you believe personal branding is in the landscape of solopreneurship, and how has your own personal brand contributed to your success?
2.. Do you believe there's a potential risk for solopreneurs in blurring the lines between personal and professional branding? How do you maintain a balance?
3. Personal branding seems to be a powerful tool for standing out from the competition. How do you ensure your personal brand reflects your unique value proposition to your clients?
4. For solopreneurs who are just starting, what would be your advice on establishing a strong and credible personal brand?
When we wish to draw your attention to a particular part of a code block (in this case, a prompt), the relevant lines or items are set in bold:
Use the [text] extracted from an invoice using OCR. Structure it as a JSON object with the structure shown in the [JSON model].
[text]=
TEXT GENERATED BY OCR
[JSON model] = (the model from above)
keep the same structure of the JSON as in the model, including the same keys. Output:
Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, email us at [email protected] and mention the book title in the subject of your message.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.
Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Share Your Thoughts
Once you’ve read Unlocking the Secrets of Prompt Engineering, we’d love to hear your thoughts! Please click here to go straight to the Amazon review pagefor this book and share your feedback.
Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.
Download a free PDF copy of this book
Thanks for purchasing this book!
Do you like to read on the go but are unable to carry your print books everywhere?
Is your eBook purchase not compatible with the device of your choice?
Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.
Read anywhere, any place, on any device. Search, copy, and paste code from