AI-First Attitude Adjustment
Developers who adopt an AI-first mindfulness, will run circles around their colleagues.
I recently saw a new feature request to add a formula to a platform that would proper-case names. Proper case, also known as title case) functions capitalize the first character in each word token irrespective of naming formats.
This is especially important when trying to format names such as
“Bill van der Made” and doing so correctly in databases, legal documents, or email correspondence matters greatly.
Most developers immediately jump to the code they know, reaching for regular expressions and then trying to anticipate the hundreds of possible edge cases that could trip them up.
Impertinent is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.
I’m lazy. This is what I want to avoid.
This is a coding shit show.
Name formats are all about text. Names are entities, and LLMs are trained with text and understand entities quite well. LLMs have seen every name and entity format imaginable.
What if we handed this entire problem domain over to an LLM?
The approach I leaned into for developing this formula uses an algorithm based solely on a text completion prompt. And that’s the way we want it. By design, we want to avoid baking a lot of code into the solution because code is like parts in machines - the fewer there are, the more likely it will always work.
Reformat this person's name using the proper name convention.
There’s more to this prompt, but this gives you the gist. Doing this job well requires a more complex prompt, but this is where it all begins.
The complete prompt considers many factors. Here’s the full prompt with examples. The API code for use with the PaLM API is also included.