By Jody in Prompt Engineering —

Inline-executed metaprompting

I want to share an idea I have been playing with. There isn't a standard term for it, but for now I am calling it "inline-executed metaprompting." I am a big fan of metaprogramming - I love languages like Ruby and JavaScript that make it easy to do - and was wondering what the equivalent would be for large language models (LLMs). My answer to this is a prompt that creates a prompt and immediately executes it.

Let's look at an example of what this might look like:

You are someone who deeply understands internet marketing.

Create me a high quality prompt.

It should ask a set of load-bearing questions - one at a time - and then create a detailed highly actionable marketing plan. 

Once you have created this prompt show me and then execute it.

It is common practice to get LLMs to help you create and shape prompts; this just takes it a step further and executes it straight away. The key to making this work well is getting the LLM to show you the prompt before executing it. This is really just a variation on chain-of-thought prompting (which I have written about earlier): It is the act of outputting the prompt into the context window that gives the LLM something concrete to work with.