Home Gotopia Articles Putting a Prompt...

Putting a Prompt into Production

Discover the power of prompt engineering to boost your AI's effectiveness in "Putting a Prompt into Production." This article guides you through essential strategies to refine your AI prompts, ensuring they deliver reliable and scalable results. Learn to minimize errors, optimize performance, and prepare your prompts for the demands of real-world applications.

Share on:
linkedin facebook
Copied!

About the experts

Mike Taylor

Mike Taylor ( author )

Founder, author, prompt engineering expert

The Five Principles of Prompting

  1. Give Direction: Describe the desired style in detail, or reference a relevant persona.
  2. Specify Format: Define what rules to follow, and the required structure of the response.
  3. Provide Examples: Insert a diverse set of test cases where the task was done correctly.
  4. Evaluate Quality: Identify errors and rate responses, testing what drives performance.
  5. Divide Labor: Split tasks into multiple steps, chained together for complex goals.
Check out Mike's masterclass!

A Case Study

    Please summarize the following news article:

{article_text}
  

1. Give Direction

    Please summarize the following news article, preserving nuance and the original author's intended tone as much as possible. The summary should give the reader a concise understanding of the key points, but not state claims more definitively than the original article did:

{article_text}
  

2. Specify Format

    Please summarize the following news article, preserving nuance and the original author's 
intended tone as much as possible. The summary should give the reader a concise understanding 
of the key points, but not state claims more definitively than the original article did.

Return the summary in this JSON format:

{ "summary": "text of the summary here", "keyPoints": ["list of 3-5 key takeaways"] }

{article_text}
  

3. Provide Examples

    Please summarize the following news article, preserving nuance and the original author's intended tone as much as possible. The summary should give the reader a concise understanding of the key points, but not state claims more definitively than the original article did.

Here are some examples of high-quality summaries in the desired format:

Example 1
{ "summary": "Mike Johnson wants to help Donald Trump with his legal problems. He has a plan to stop giving money to certain lawyers and to investigate them. One idea is to make a new rule so that Trump can move his cases to different courts with judges who might like him more. This could help Trump pardon himself. The rule might not be allowed and probably won't happen this year because the other party is in charge. But if Mike Johnson's party wins more elections, they might try this plan again.", "keyPoints": [ "Mike Johnson wants to help Trump with his legal problems.", "He plans to stop giving money to some lawyers and investigate them.", "One idea is to let Trump move his cases to courts with friendlier judges.", "This could help Trump pardon himself.", "The plan might not happen this year, but they might try again if they win more elections." ] }

Example 2
{ "summary": "Jordan Rubin answers why former President Trump's trials might not be done before the election. He says that even though people want answers quickly, the law has rules that make trials take a long time. These rules mean we might not know what happens in Trump's trials until after the election. If Trump becomes president again, he might stop the trials altogether.", "keyPoints": [ "People want Trump's trials to be fast, but the law has rules that make them take longer.", "The law says the person on trial has a right to a quick trial, but it doesn't mean the public gets to see it quickly.", "The trials might not happen before the election because of these rules.", "If Trump wins the election again, he could stop the trials.", "People can think about the charges and decide who to vote for, even if the trials aren't done." ] }

Now please summarize this article:

{article_text}
  

4. Evaluate Quality

  • ROUGE score (a measure of similarity) of generated summaries vs reference summaries made by humans
  • Qualitative evaluation of summary quality on a 1-5 scale (by multiple human raters)
  • Classifying the key points as fully supported/partially supported/unsupported by the article text (this could be done by another call to an LLM)
  • Sentiment analysis of summaries vs original articles to see if they match
  • Fraction of summaries containing factual inaccuracies (checked by humans)

5. Divide Labor

  1. Key point extraction prompt
  2. Main summarization prompt
  3. Fact checking/error detection prompt
  4. (Optional) human review prompt for uncertain cases