Bending OpenAI with Traditional Programming for Unique Recipe Creation
Drew Robbins
Engineering Leader | Driving Innovation and Observability in Generative AI Applications
Introduction?
In today's technological landscape, ChatGPT and other Large Language Models (LLM) have captured the attention of developers and tech enthusiasts alike. Beyond simple text interactions, these models offer innovative applications in diverse domains. One fascinating application is in the culinary arts. I used my summer learning time to develop RecipeGen, a tool that seamlessly combines the capabilities of Generative AI with structured tradiitional programming to produce personalized recipes based on user input. This article delves into the creation and mechanics of RecipeGen, highlighting its distinct features, the challenges faced during its development, and the broader implications for AI applications. I invite you to explore RecipeGen on GitHub or try it live at https://yumpop.ai.?
Why RecipeGen??
Over the past few months, I have been amazed by the recipes generated by ChatGPT. I have ventured into cooking styles I previously would never attempt, making everything from comfort foods like my mom's Chicken Paprikash to foods like Bun Cha from Vietnam, Coq au Vin from rustic France, and Doubles from the streets of Trinidad. RecipeGen wraps an engineered prompt, optimized to get the best recipes, into an intuitive user interface.??
What opportunities does an app like RecipeGen bring to the culinary world? Here are just a few:?
Integrating a Non-deterministic LLM with Traditional Programming?
ChatGPT and LLMs have gained immense popularity this past year, with people using them for all sorts of purposes from fun to getting work done.? A substantial percentage of software engineers report productivity improvements in coding tasks. In fact, ChatGPT can generate working code in an astounding number of programming languages.? It makes sense that ChatGPT could also generate ingredients and an instruction set for a culinary Recipe. I aimed to structure these recipes for easy integration into a traditional program.?
This interest is not unique to me. Scientists and researchers in the AI field have been exploring ways to amplify the abilities of these models. A piece of research, Coupling Large Language Models with Logic Programming for Robust and General Reasoning over Text (Zhun Yang, Adam Ishay, Joohyung Lee), looks at this combination using several NLP benchmarks. Instead of solely relying on the language model, they proposed integrating it with logic-based systems. While their approach is far more scientific than my trial-and-error approach, it confirmed my thoughts about doing this type of integration.?
What if I could combine the vast knowledge and creativity of a model like ChatGPT with structured traditional programming? By doing this, I could create a system that understands the nuances of human prompts and then uses traditional programming to provide more tailored responses. In the context of RecipeGen, this would mean not just suggesting recipes based on a database, but genuinely understanding user preferences and constraints to curate unique dishes.?
My journey was less about scientific rigor and more about iterative experimentation with some observable results to adjust the functionality. Each modification brought me closer to a tool that could blend the intuitive understanding of ChatGPT with the precision of traditional programming. Along the way, I made sure to emit metrics and logs that would surface issues. That data exposed several challenges with the integration of LLM with traditional programming:?
Non-Deterministic Responses:?
Model Version Updates:?
领英推荐
Language Variabilities:?
Service Misuse and Safety Concerns:?
Observability in RecipeGen?
The integration of LLMs with traditional programming, like RecipeGen, presents some significant challenges. These challenges are not just technical but also pertain to ensuring a consistently good user experience. Enter observability.??
Observability is not merely about monitoring or logging. It is about gaining a holistic, real-time understanding of the system's inner workings and the quality of its outputs. Observability ensures that when anomalies arise, they can be swiftly diagnosed and rectified.?
In addition to metrics, logging and/or tracing remain important tools to understand how the application is working. In RecipeGen, when a parsing error occurs, it is often a result of the model deviating from the expected structure in its response. Relying on a debugger in such scenarios would be futile given the model's unpredictable nature. Logs, on the other hand, capture the exact prompt and the model's response, allowing for an in-depth post-mortem analysis. This information aids in refining the system—be it tweaking the prompts, adjusting model parameters, or enhancing the parsing logic.?
I will cover more observability in RecipeGen in my Observability newsletter.?
More to Learn?
The integration of Generative AI and structured programming in RecipeGen represents a glimpse into the possibility for future AI applications. While I have learned a lot through this experiment, there is still more to learn. I’d like to add follow-on interactions that iterate on the recipe, which is exactly what I do in the ChatGPT interface when I’ve been creating recipes. For example, I often cannot acquire one of the ingredients in my small-town grocery store in Japan so I ask ChatGPT for a replacement.??
There is a literal explosion of tools available to assist with these types of applications. I have yet to explore Langchain and its extractions tools that parse output from an AI model. I currently just ask for YAML structured data back and use a general purpose YAML parsing library. I am interested in how services like Microsoft’s Semantic Kernel or Azure Machine Learning Prompt Flow will help if I move beyond a single shot prompt. I currently just use a text file and update the name/version of the file to associate metrics with specific versions of the prompt.??
As we push the boundaries of AI integration in our daily lives, RecipeGen offers a unique intersection of tech and taste. Try https://yumpop.ai and explore a new dimension in recipe creation. Your usage and feedback will be invaluable in refining and expanding its capabilities. If you like a recipe, or find some interesting response, feel free to copy and paste to a comment in this article. Try it out, and let's shape the future of culinary AI together.?
?
Great work having sampled first hand some of these dishes with you in Japan it’s great to see you continuing your learning and sharing the outcome with all of us.