When running poetry run 01 with no option and without prior setting of the OPENAI_API_KEY, the application will throw an error (coming from the openai.OpenAI package).
Solution
Defensive programming—verifying the presence of the key before invoking openai.OpenAI—to catch the issue and provide concise instruction on what to do instead of a scary stack trace.
Tested On
macOS
Windows 10
Discussion
No big deal, but this is a low-hanging fruit on removing onboarding friction. On Window (at least 10), given Ctrl+C doesn't seem to kill the process once the server started, it made the UX even more awkward.
Problem
When running
poetry run 01
with no option and without prior setting of theOPENAI_API_KEY
, the application will throw an error (coming from theopenai.OpenAI
package).Solution
Defensive programming—verifying the presence of the key before invoking
openai.OpenAI
—to catch the issue and provide concise instruction on what to do instead of a scary stack trace.Tested On
Discussion
No big deal, but this is a low-hanging fruit on removing onboarding friction. On Window (at least 10), given Ctrl+C doesn't seem to kill the process once the server started, it made the UX even more awkward.
Before
After