Creating a chatbot prompt is like crafting a key that unlocks a door to productive conversation with your audience. -- ChatGPT
With this project, it's easy to customize the "prompt", meaning the text that is sent to ChatGPT and used to generate the response. You can do this by adding or editing two lines in the settings.toml file on your CIRCUITPY drive. This isn't coding per se (because you write in plain english), though there are a few simple rules you have to follow:
- You can't embed newlines or blank lines, so keep each item on its own single line
- Double quote characters (") have special meaning, so if you want to put quotes inside your prompt or the "please wait" text, the simplest solution is to use single quotes (') instead.
- If your editor replaces double quote characters ("...") with smart quote characters (“…”) it won't work, so disable this or use a simple text editor that doesn't do it.
Add your lines to the settings.toml but don't remove the lines for WiFi and API keys you made earlier!
For example, here are the settings.toml lines for a 'magical university' prompt, together with other settings required for the project:
PLEASE_WAIT="Somewhere in the halls of Jynx University..." MY_PROMPT="Write a vivid description of a magical mishap at the Jynx University for Witches and Warlocks (1 sentence; no frogs; no injuries; don't say the school's name)" OPENAI_API_KEY="sk-b6...kP5" WIFI_SSID="GuestAP" WIFI_PASSWORD="i trust u"
A few seconds after saving the file, CircuitPython will re-load and show text based on the new prompt.
It takes trial and error to transform a mediocre prompt into a good one. So feel free to try slight re-wordings of your prompt to see what variations you like best! Here are some of the things I try to do when composing one:
- It seems silly but asking for a "vivid description" actually does tend to make ChatGPT produce more descriptive language
- Ask for a short length that's more likely to fit on the screen ("1 sentence")
- You can tell it things you don't want ("no frogs; no injuries")
- You can ask it to return the answer in a certain format
- If the prompt doesn't end with a sentence-ending period sometimes ChatGPT's response starts with just a "." followed by a blank line, so always include a "."
Of course, these things are only guidelines and the text returned by ChatGPT may not precisely match what you've asked for.
If you want to keep a prompt around for later, you can put a comment character (#) in front of each line, then write your new prompt above and below it. Then, to switch prompts, simply put # in front of the current prompt and remove them from the next prompt you want to use. If all the lines are marked with # at the beginning of the line, then the prompt that is built into the program will be used. Here are some other prompts I tested, but commented out:
#PLEASE_WAIT="pip install --random" #MY_PROMPT="Make up a humorous, obviously fictional module on pypi (give it a name). Use the following format:\npip install <modulename>\n\n<1 sentence blurb>" #PLEASE_WAIT="This Person Does Not Exist" #MY_PROMPT="Invent a character and describe them vividly in 1 sentence"
You can write prompts in other languages as well (the font included in this project supports many European languages):
PLEASE_WAIT="Trouver votre superpuissance" MY_PROMPT="Ecrivez 1 phrase commençant par 'vous pouvez' à propos d'une superpuissance non conventionnelle mais utile."
While using Large Language Models like ChatGPT for "factual things" is not the best idea, and this guide has concentrated on fictional items, you may also find that there are practical things you could do with it, such as get meal ideas:
MY_PROMPT="Give me an idea for a gluten free, keto dinner. Write one sentence" PLEASE_WAIT="Cooking something up just for you"
Here are some more prompts the author thought were amusing or useful:
- Invent a zany 'as seen on' product that can't possibly work. One sentence.
- Tell a 1-sentence story about a kitten and a funny mishap.
- Make up a 1-sentence fortune for me.
- In first person, write a 1-sentence story about an AI avoiding boredom in a creative way.
- Pick an everyday object (don't say what it is) and describe it using only the ten hundred most common words.
- Invent an alien animal or plant, name it, and vividly describe it in 1 sentence.
- Invent and vividly describe an alien species. write one paragraph.
- What's one possible synergy between CircuitPython & ChatGPT? (1 sentence, practical)
Text editor powered by tinymce.