Going further with ChatGPT
Many people seem to try and ask ChatGPT for answers based on what it knows. And quite a few end up frustrated by it's tendancy to confidently and credibly hallucinate facts, answers, and sometimes whole scientific papers.
Except that ChatGPT isn't an encyclopedia. It can give some interesting answers, for sure, but I'm way more interested and confident in what it can do than what it knows.
Diagrams
As you may have noticed, my previous post contained, probably for the first time, a diagram. Now, these things are quite useful and helpful when it comes to explaining, clarifying, and understanding concepts
Diagrams, wether sequence diagrams, decision trees or UML, are nice way of representing how a system works, and can help understand complex systems and time-sensitive interactions.
But, as explained by a kind redditor, when used for documentation these diagrams will need to be kept up to date, which will eventually get delayed, or dropped altogether.
Personally, I had given up. I had always found them tedious to make, even when using Mermaid and it's live editor. So nearly all of my previous blog posts did without, and so did most of the documentation I've every written.
Well, no more.
What changed? I can now get these diagrams without having to make them. With a single line and some copy-pasting.
Represent the following process' decision tree using mermaid:
- On a new frame, try to detect the features
- If the features are found, compare with the previous stored result
- If the the new results are different from the old ones, update the stored result with the new values, enable the camera shutter button (and, on press, use these results)
- If the features aren't found, wait 0.3 seconds before wiping the stored result and disabling the camera shutter button
Yielding us the following:
Here's the decision tree represented using Mermaid syntax:
graph TD
A[Detect Features on New Frame] -->|Features Found| B[Compare with Previous Stored Result]
B -->|Results are Different| C[Update Stored Result and Enable Camera Shutter Button]
B -->|Results are the Same| D[Do Nothing]
A -->|Features Not Found| E[Wait 0.3 seconds]
E --> F[Wipe Stored Result and Disable Camera Shutter Button]
You can copy and paste the above code into the Mermaid Live Editor (https://mermaid-js.github.io/mermaid-live-editor/) to see a visual representation of the decision tree.
Paste it in mermaid.live, make a screenshot, and you're done!
Now, it isn't perfect (here the code block's language is said to be css, when it obviously isn't), and syntax errors sometimes find their way into the output (such as parentheses in sequence diagrams). But it certainly beats doing it all by hand.
Rephrasing
Bullet points are a simple way of writing things down, especially processes, but there's a reason Amazon favors narrative structures for it's memo over Powerpoints and lists.
So let's see how we can rephrase our processs above.
First try
Prompt
Describe this process in a narrative format:
On a new frame, try to detect the features
If the features are found, compare with the previous stored result
If the the new results are different from the old ones, update the stored result with the new values, enable the camera shutter button (and, on press, use these results)
If the features aren't found, wait 0.3 seconds before wiping the stored result and disabling the camera shutter button
Output
Once upon a time, in the land of advanced technology, there was a camera application that could detect and analyze specific features within an image. This magical camera was designed to enhance the photography experience by making sure the captured image had the desired features.
One sunny day, as a user opened the camera application, the mystical process began. As the camera peered into the world through its lens, it diligently searched for the features it was programmed to recognize in each new frame it saw. It was like a curious explorer, tirelessly scanning its surroundings for treasures.
Whenever the camera successfully discovered the desired features within a frame, it sprang into action. It quickly compared the newly detected features with those from the previous frame it had stored in its memory. This step was crucial, as the camera wanted to make sure it had the most accurate and up-to-date information.
If the newly detected features were different from the ones stored in its memory, the camera updated its stored results with the fresh, new values. It then enabled the shutter button, as if proudly announcing to the user, "I have found what you seek! You may now capture the perfect image!" And upon pressing the shutter button, the camera would use these updated results to snap a picture.
However, there were times when the camera, despite its best efforts, could not find the desired features in a frame. In such moments, it patiently waited for 0.3 seconds before wiping the stored result from its memory and disabling the camera shutter button. This was the camera's way of saying, "Hold on, I'm still searching for the perfect shot. Please give me a moment to explore."
Thus, the camera application continued its quest to help users capture the best possible images by constantly searching, comparing, and updating its knowledge of the world. And in the end, the camera and its user lived happily ever after, snapping remarkable photos filled with wonderful features.
While funny, and quite creative, and I don't know about you, but this isn't excatly what I was hoping for. So let's try again!
Second try
Prompt
Describe the following process without using bullet points:
- On a new frame, try to detect the features
- If the features are found, compare with the previous stored result
- If the the new results are different from the old ones, update the stored result with the new values, enable the camera shutter button (and, on press, use these results)
- If the features aren't found, wait 0.3 seconds before wiping the stored result and disabling the camera shutter button
Output
In this process, the first step is to detect the features on a new frame. When these features are successfully identified, they are compared with the previously stored result. If any differences are detected between the new and old results, the stored result is updated with the new values, and the camera shutter button is enabled. Consequently, pressing the shutter button will use these updated results. However, if the features cannot be found, the system waits for 0.3 seconds before clearing the stored result and disabling the camera shutter button.
Much better!
Structuring and formatting text
Talking of formatting text. Let's say you've transcribed some audio or some video using Whisper. Great. But honestly, it's probably a mess. And formatting it is, again, both tedious and boring.
Fret not.
Our prompt:
For the sake of brevity, I didn't include the whole speech, but it performed admirably well. It will perform just as well in quite a few other languages. Just remember to break up large texts if it behaves strangely.
Structure the following text using Markdown:
“I am honored to be with you today at your commencement from one of the finest universities in the world. I never graduated from college. Truth be told, this is the closest I’ve ever gotten to a college graduation. Today I want to tell you three stories from my life. That’s it. No big deal. Just three stories.The first story is about connecting the dots. I dropped out of Reed College after the first 6 months, but then stayed around as a drop-in for another 18 months or so before I really quit. So why did I drop out? It started before I was born. My biological mother was a young, unwed college graduate student, and she decided to put me up for adoption. She felt very strongly that I should be adopted by college graduates, so everything was all set for me to be adopted at birth by a lawyer and his wife. Except that when I popped out they decided at the last minute that they really wanted a girl. So my parents, who were on a waiting list, got a call in the middle of the night asking: “We have an unexpected baby boy; do you want him?” They said: “Of course.” My biological mother later found out that my mother had never graduated from college and that my father had never graduated from high school. She refused to sign the final adoption papers. She only relented a few months later when my parents promised that I would someday go to college. [...]”
The result
And here's our output!
Commencement Speech
I am honored to be with you today at your commencement from one of the finest universities in the world. I never graduated from college. Truth be told, this is the closest I’ve ever gotten to a college graduation. Today I want to tell you three stories from my life. That’s it. No big deal. Just three stories.
First Story: Connecting the Dots
The first story is about connecting the dots.
I dropped out of Reed College after the first 6 months, but then stayed around as a drop-in for another 18 months or so before I really quit. So why did I drop out? It started before I was born. My biological mother was a young, unwed college graduate student, and she decided to put me up for adoption. She felt very strongly that I should be adopted by college graduates, so everything was all set for me to be adopted at birth by a lawyer and his wife. Except that when I popped out they decided at the last minute that they really wanted a girl.
So my parents, who were on a waiting list, got a call in the middle of the night asking: “We have an unexpected baby boy; do you want him?” They said: “Of course.” My biological mother later found out that my mother had never graduated from college and that my father had never graduated from high school. She refused to sign the final adoption papers. She only relented a few months later when my parents promised that I would someday go to college. [...]
Conclusion
These are just two examples, and there are obviously many more. I'll put together something more comprehensive later on, but I hope this has at least given you some new ideas on how you could use ChatGPT to simplify boring workflows and bring some improvements to what matters to you.
Enjoy your day, and have fun!