ChatGPT Custom Instructions And Prompt Engineering— Day 26 of #30daysofAI
A few weeks ago ChatGPT released a new feature to all users called custom instructions. Today I spent some time looking into this and some other recent updates from the past month by the OpenAI team. Here’s what I learned.
For those missing context, this is related to a blog series called 30 Days of AI, where I challenged myself to spend the next 30 days learning more about AI.
What Are Custom Instructions?
Custom instructions are a way to add context to ChatGPT for every new chat created, so you don’t need to repeat the same bit of context when starting a new conversation or replying. This streamlines prompts and makes it easier to get ChatGPT to give more relevant responses.
In specific, all users now have a setting accessible from their user configuration which allows you to set 2 useful pieces of information:
- A pre-prompt of info that provides general context about who you are and what you are looking for
- A pre-prompt of info that tells ChatGPT how it should format or present the responses
ChatGPT’s custom instruction feature gives some of the benefit of prompt engineering by baking it directly into your ChatGPT user profile. This looks like the start of built-in prompt engineering features in ChatGPT.
How To Utilize Custom Instructions
Since custom instructions allow you to bake in context to every conversation by default, there are countless ways to take advantage of this to improve your ChatGPT responses. Here are a few ideas with some examples to try out.
Programmers — Specify Your Preferred Dev Environment
Usually when I ask ChatGPT a programming question, it defaults to giving the answer in Python, or sometimes in a programming environment I don’t normally use. You can use custom instructions to sort this out automatically, like so:
Notice that this now automatically has ChatGPT provide coding responses in Typescript:
Formatting Responses As Tables And CSV
Another minor annoyance of ChatGPT prompting is having to repeat the same bit of prompt text to tell it how to format output. For example, if you prefer to see data as a table or CSV file, you typically have to add that bit of information after each prompt to enforce ChatGPT giving the responses that way. Here’s an idea on how to do this automatically with custom instructions:
This is an example of what output looks like using this custom instruction and a very simple prompt:
Language Translated Responses
Another interesting idea, for those that prefer doing prompting in another language and often seeing ChatGPT respond in English- use custom instructions to enforce responses in your native/preferred language. Here’s the sample instructions I used:
And a sample prompt (in English) that shows responses as Spanish using these instructions in my profile:
What About Prompt Engineering?
Prompt engineering is the mechanism of crafting prompts in a specific way that results in better responses for some types of data. This can be done in many different ways, including:
- Providing very reusable context as a pre-prompt
- Using chain-of-thought prompting, aka chaining multiple prompts together in sequence to get better results. Conversations in ChatGPT also can make use of this type of technique by default to give better results as a conversation has more replies.
- Adding examples to a prompt, or adding few-shot prompting techniques
- Providing reusable instructions as a post-prompt. For example, to give instructions on how to format the output of a response
OpenAI gives some best practices for how to do prompt engineering with OpenAI/ChatGPT for those curious to learn more. I also did a bit of an introduction on prompt writing tips a few weeks ago in another post, which is worth a look for anyone seeking easy ways to improve prompt responses.
ChatGPT Recent Updates
ChatGPT has also rolled out a few other interesting features recently (aside from custom instructions). Here’s a quick rundown of a few notable ones:
- Example prompts to help get started in new chats, rather than just having a blank prompt textbox. Here’s what this looks like:
- ChatGPT will now often give suggestions on how to continue the conversation at the end of responses, called “suggested replies”. Here’s an example of what this looks like:
- There are several useful keyboard shortcuts accessible within the ChatGPT window on the web. Here’s a summary:
The best place to keep up to date with OpenAI and ChatGPT features is to check out the ChatGPT Release Notes.
<< EOM >>
I hope this quick rundown of recent ChatGPT changes spurs some productivity improvements to those already working with it, and gives some friendly pointers to new ChatGPT users on how to get a faster head start on prompting.
Drop me a line in the comments if you have thoughts or ideas related to these new ChatGPT features.