Building a text generation app
Check out our prompting guide for strategies on how to write effective prompts.
Every text generation app consists of adding inputs, writing prompts, and formatting outputs.
Referencing inputs
To reference your input, @
it within the prompt.
For example, if you’re writing a prompt to generate social posts based on a blog post, do the following:
- Input:
Blog post
- Prompt 1: instructions for creating a social post
In your prompt, reference @Blog post
so that Writer understands that the social post should be based on the blog input.
If you have more than one input, you can @
each one within a single
prompt.
Referencing prompts
You can reference other prompts within a prompt by using the @
symbol, a feature known as prompt chaining.
For example, if you have a long blog post, you might want to summarize it in your first prompt, and use that summary to generate a social media post in your second prompt:
Input
Long blog
Prompt 1
Instructions for generating a summary of the @Long blog
post.
Prompt 2
Instructions for generating a social media post based on Prompt 1
.
In the second prompt, you’d reference @Prompt 1
to indicate that you want the social media post to be based on the blog summary.
Formatting the output
Next, format your output—the final assembled app. To do this, take all your prompt outputs (if you have more than one), format their style, add any static text such as a disclaimer, and combine them together.
You can use Markdown or HTML to specify how you’d like your output to be formatted.
For example, you can use the following formatting:
Heading Tags
Use <h1>
, </h1>
, <h2>
, </h2>
, and <h3>
, </h3>
to denote heading
text.
Bold Text
Use <strong>
and </strong>
to denote bolded text.
Here’s the final app that your users will see.
The simplest app will have only one prompt. A more complex app might have multiple section headers, each with its own prompt output.
Before adding even more prompts to your app, ask yourself:
- Does the user want this content?
- Do I need these inputs to generate this output?
You don’t have to include every prompt in your output formatting. For example, a prompt might be used only to summarize and then to create a LinkedIn post (based on the summary). If you don’t want to include the summary in your output, you don’t have to.
Because you don’t need to reference every prompt in your final output, you can leave interim prompts in your apps for A/B testing or to get feedback. Combined with the Rerun
option, this is a great way to efficiently iterate on your apps.