Putting GPT to Good Use

Photo by Jeff Sheldon on Unsplash

Recently I wrote about how GPT-like technologies are far from good at generating things like recipes or anything that involves connecting concepts through logic and reasoning; this doesn’t mean we can’t have these technologies to assist us on these tasks. Advanced assisted editing tasks are the topic of today’s blog post.

One of the strengths of generative AI is that I can understand the meaning of prompts explained in simple words and use its vast knowledge to generate more intricate and extensive versions of the same prompt. For example, if you tell the AI to ‘write a blog post about how much I love my grandmother because of her great qualities,’ It will probably do a great creative job and save me a lot of typing and copywriting time.

Given these strengths of generative AI, I put it to the task of solving a problem I have. My friends know me for cooking delicious meals and being creative with the ingredients I have, and on a recent poll on my Instagram account, they unanimously voted that I should post the recipes I create. The problem is that writing recipes takes a lot of time! I put GPT to good use and built a GPT-Assisted recipe editor. You can access it here: https://editor.juancavallotti.com

My AI-Assisted Recipe Editor!

With my editor, you can build a recipe by naming its components; for example, you could say ‘beef empanada stuffing’ and then add ‘homemade empanada shells’ to produce a full-from-scratch empanada recipe. Edit the title, adjust the quantities, and done! Ready to export or print.

Other Uses of Generative AI

Even though many GPT demos feature recipe creation, it’s not only scoped to recipes. Advanced editing could mean integration with your word processor, spreadsheets, development environment, or journaling app, to name a few. The sky is the limit. Even more, I see in the future five potential families of use cases for generative technologies like GPT:

  1. AI-powered editors.
  2. Zero-shot data classification and validation.
  3. Zero-shot data standardization.
  4. Conversational agents that deliver specific knowledge.
  5. AI-powered search engines, AKA semantic search.

The Technology Stack

I used the opportunity to leverage bleeding-edge technology and remove some rust from my web app coding repertoire.

I built the app using NodeJS, particularly the NextJS framework, which I found extremely pleasant to code with. I loved how it made my life easy by automatically reloading the page from the browser without any special plugin or losing the app’s state. Building server-side and client-side code was a breeze, all using Typescript, and it took care of the communication between the server and browser automatically; I only had to define the boundaries in the form of comments.

I’m used to leveraging Bootstrap CSS for over a decade for the UI, but this time I gave Tailwind CSS a chance. I found Tailwind much more intuitive, but it didn’t have a rich set of components (for free, at least) for me to leverage as Bootstrap has. However, it took care very nicely of things like switching to dark mode and responsive design. The NextJS community strongly supports Tailwind, which I also liked. Overall the experience was great.

I implemented the whole UI as a ReactJS widget tree. It made it very easy to implement things like drag and drop and editable HTML elements. I didn’t have direct experience with React or Typescript, but having built native iOS apps with SwiftUI and Flutter, I felt I could transfer the concepts of state management directly.

I leveraged OpenAI’s GPT API using their Node client library; this was not new to me, but I had to do some prompt engineering and ended up settling for the DaVinci-3 engine, which uses GPT-3.5. I leveraged it both to assist with the editing and to validate the input. In the future, if I allow sharing recipe links, I will use the GPT API to validate the recipe text before publishing. It was very convenient! Let me know in the comments if you think I should do it! I also used Dall-e to generate the site’s icon.

Finally, I deployed the app to my GCP Cloud Run instance. Building a Docker container for this app was also a breeze by following NextJS’s documentation on containerizing it. It was effortless to follow.

Conclusion

Generative AI struggles to generate perfect recipes or other content that requires connecting concepts and reasoning, but it’s helpful when it comes to assisted editing and zero-shot classification; this is tasks like validating user input. I pleasantly discovered UI frameworks that allowed me to create a rich user experience with minimal effort and allowed me to transfer the knowledge I had from Flutter and SwiftUI.

Leave a comment