In this article we show how the API can recommend books in a list format, given a book title and author.
There are three parts to this prompt:
Instruction - A description that helps the API understand what task we want to do
Example - This shows the API how to take the input and create the output
Input data - The text we want the API to format
The desired output is a numbered list of three books. By matching the terms in the instruction to the example, we can help the API understand its task and how we want it to output its results.
Three books are requested and a list of three is generated. The term “given book” is used in the instruction and "book", as a tag, within the prompt.
Notice the bold text in the prompt below stops after the “1.” This was needed to ensure that the API consistently outputs in the list format seen in the first example.
Recommend a list of three books with similar themes to the given book.
Book: Lord of the Rings, by J.R.R. Tolkien
1. The Naming, by Alison Croggon
2. Song of Blood & Stone, by L. Penelope
3. The Hobbit, by J.R.R. Tolkien
Book: The Art of War, by Sun Tzu
1. The Art of War, by Niccolò Machiavelli
2. The 48 Laws of Power, by Robert Greene
3. The Art of War for Women, by Lian Dolan
Try this yourself by replacing the second “given book” value with your own.