Chapter 10. Building AI-Powered Applications

In this chapter, you’ll apply the five principles of prompting to an end-to-end AI workflow for content writing. The service will write blog posts based on the user’s responses to interview questions, in the style of the user’s writing. This system was first documented on the Saxifrage blog.

AI Blog Writing

The naive approach to creating a blog writing service using AI would be to prompt ChatGPT with Write a blog post on {blogPostTopic}. The resulting content would be of reasonable quality but wouldn’t likely contain any valuable opinions or unique experiences on the topic. The content would also likely be short and generic and therefore unlikely to rank on Google.

A more sophisticated approach might be to build up a longer prompt with further instructions. Detail on the prescribed writing tone, architecture of the blog post, and keywords to include could be added. An example of a common blog post writing prompt can be seen here.

Input:

Create a blog post about “{blogPostTopic}”. Write it in a “{tone}” tone.
Use transition words.
Use active voice. Write over 1000 words.
Use very creative titles for the blog post.
Add a title for each section. Ensure there are a minimum of 9 sections. Each
section should have a minimum of two paragraphs.
Include the following keywords: “{keywords}”.
Create a good slug for this post and a meta description with a maximum of 100
words and add it to the end of the blog post.

This longer, more sophisticated ...

Get Prompt Engineering for Generative AI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.